
var f2Inst = false; 
var f3Inst = false;   
var f4Inst = false;    
var f5Inst = false;   
var f6Inst = false;  
var f7Inst = false;   
var f8Inst = false;   
var f9Inst = false;    
var maxVersion = 9;             
var actualVersion = 0;         
var hasRightVersion = false;   
var isAOL = (navigator.appVersion.indexOf("AOL") != -1) ? true : false;
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; 
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var notInstalled=false;
if(isIE && isWin && !isAOL){
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('f2Inst = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('f3Inst = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('f4Inst = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('f5Inst = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
  document.write('f6Inst = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
  document.write('f7Inst = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
  document.write('f8Inst = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
  document.write('f9Inst = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
  document.write('<\/SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
}
parameters="";
function detectFlash() {  
  // If navigator.plugins exists...
  if (navigator.plugins) {
    // ...then check for flash 2 or flash 3+.
    if (navigator.plugins["Shockwave Flash 2.0"]
        || navigator.plugins["Shockwave Flash"]) {
      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
      var flashVersion = parseInt(flashDescription.substring(16));
      f2Inst = flashVersion == 2;    
      f3Inst = flashVersion == 3;
      f4Inst = flashVersion == 4;
      f5Inst = flashVersion == 5;
      f6Inst = flashVersion == 6;
      f7Inst = flashVersion == 7;
      f8Inst = flashVersion == 8;
      f9Inst = flashVersion >= 9;
    } else {
		notInstalled=true;
	}
  }
  for (var i = 2; i <= maxVersion; i++) {  
    if (eval("f" + i + "Inst") == true) actualVersion = i;
  }
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 4;  
  if (actualVersion >= requiredVersion) {
    hasRightVersion = true;                
  } else {  
	hasRightVersion = false; 
  }
}

function embedFlash(w,h,imageURL,imageAltText,altImageURL) {
	pStrg = "";
	eStrg = 'TYPE="application/x-shockwave-flash" ';
	if(parameters!=""){
	for (i=0;i<parameters.length;i++) {
		pStrg += '<PARAM NAME="'+parameters[i][0]+'" VALUE="'+parameters[i][1]+'"> ';
		if(parameters[i][0]=="movie") {
			eStrg+='SRC="'+parameters[i][1]+'" ';
		} else {
			eStrg+= parameters[i][0]+'="'+parameters[i][1]+ '" ';
		}
	}
	parameters="";
	}
	//alert(eStrg)
  if(hasRightVersion) {  // if we've detected an acceptable version
    var oeTags = '<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
    + 'WIDTH="'+w+'" HEIGHT="'+h+'" '
    + 'CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
    +  pStrg
    + '<EMBED '
    + 'WIDTH="'+w+'" HEIGHT="'+h+'" '
    + eStrg
    + 'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
    + '<\/EMBED>'
    + '<\/OBJECT>';
	//alert(oeTags)
    document.write(oeTags);   // embed the flash movie
  } else {  // flash is too old or we can't detect the plugin
   	var alternateContent;
	if(imageURL!="") {
		if(altImageURL!="") {
			alternateContent = '<a href="'+altImageURL+'"><IMG SRC="'+imageURL+'" WIDTH="'+w+'" alt="'+imageAltText+'" border="0"><br /><IMG SRC="'+imageURL.split(".jpg")[0]+".gif"+'" WIDTH="'+w+'" alt="'+imageAltText+'" border="0"></a>';
		} else {
			alternateContent = '<IMG SRC="'+imageURL+'" WIDTH="'+w+'" alt="'+imageAltText+'"><br /><IMG SRC="'+imageURL.split(".jpg")[0]+".gif"+'" WIDTH="'+w+'" alt="'+imageAltText+'" border="0">';
		}
    } else {
		if(notInstalled) {
		alternateContent = '<table width="100%" cellpadding="0" cellspacing="0" border="0">'
		+'<tr>'
		+'<td align="center">You need Flash to see this. Download the <a href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">latest version</a>. </td>'
		+'</tr>'
		+'</table>';
		} else {
		alternateContent = '<table width="100%" cellpadding="0" cellspacing="0" border="0">'
		+'<tr>'
		+'<td align="center">You need Flash Version '+requiredVersion+' installed. Download the <a href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">required version</a>. </td>'
		+'</tr>'
		+'</table>';
		}
	}
	document.write(alternateContent);  // insert non-flash content
  
  }

}
