var g_bolUseVBDetection = false;


function detectFlash(intVersion) {
  var intDetectedVersion=0;
  var objPluginFlash=navigator.plugins["Shockwave Flash"];
  if(objPluginFlash) {
  	var strFlashDesc = objPluginFlash.description;
  	intDetectedVersion = parseInt(strFlashDesc.charAt(strFlashDesc.indexOf(".") - 1));
	}
  bolFlash=(intDetectedVersion>=intVersion);
  if(!bolFlash && g_bolUseVBDetection) {
	  intDetectedVersion=(detectActiveXControl('ShockwaveFlash.ShockwaveFlash.2'))?2:0;
	  intDetectedVersion=(detectActiveXControl('ShockwaveFlash.ShockwaveFlash.3'))?3:intDetectedVersion;
	  intDetectedVersion=(detectActiveXControl('ShockwaveFlash.ShockwaveFlash.4'))?4:intDetectedVersion;
	  intDetectedVersion=(detectActiveXControl('ShockwaveFlash.ShockwaveFlash.5'))?5:intDetectedVersion;
	  intDetectedVersion=(detectActiveXControl('ShockwaveFlash.ShockwaveFlash.6'))?6:intDetectedVersion;
	  intDetectedVersion=(detectActiveXControl('ShockwaveFlash.ShockwaveFlash.7'))?7:intDetectedVersion;
    bolFlash=(intDetectedVersion>=intVersion);
  }
  return bolFlash;
}

if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
  document.writeln('<script language="VBscript">');
  document.writeln('g_bolUseVBDetection = False');
  document.writeln('If ScriptEngineMajorVersion >= 2 then');
  document.writeln('  g_bolUseVBDetection = True');
  document.writeln('End If');
  document.writeln('Function detectActiveXControl(activeXControlName)');
  document.writeln('  on error resume next');
  document.writeln('  detectActiveXControl = False');
  document.writeln('  If g_bolUseVBDetection Then');
  document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
  document.writeln('  End If');
  document.writeln('End Function');
  document.writeln('</scr' + 'ipt>');
}

function insertFlash(strSrc,intH,intW,strBgC,strID,strAltImg) {
  if (g_bolFlashOK){
//    document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
//    document.write('width="'+intW+'" height="'+intH+'" name="'+strID+'" ID="'+strID+'"> ');
//    document.write('<PARAM name="Movie" value="'+strSrc+'"> ');
//    document.write('<PARAM name="quality" value="high"> ');
//    document.write('<PARAM name="play" value="true"> ');
//    document.write('<PARAM name="bgcolor" value="'+strBgC+'">');
    if(!lay)document.write('<div style="position:relative;top:0;left:0;">');
    document.write('<EMBED src="'+strSrc+'" width="'+intW+'" ');
    document.write('height="'+intH+'" quality="high" ');
    document.write('bgcolor="'+strBgC+'" name="+strId+" type="application/x-shockwave-flash" ');
    document.write('pluginspage="http://www.macromedia.com/go/getflashplayer">');
    if(!lay)document.write('</div>');
//    document.write('</OBJECT>');
  } else {
    document.write('<IMG src="'+strAltImg+'" width="'+intW+'" ');
    document.write('height="'+intH+'" alt="">');
  }
}
