var currentFlashVersion = 0;          // version the user really has
var minFlashVersion = 2;             // lowest  version we can actually detect
var maxFlashVersion = 6;             // highest version we can actually detect
for(i=minFlashVersion; i<=maxFlashVersion; i++){
	eval("var flash"+i+"Installed = false")
}
////////////////////////////////////////////////////////////////////////////////////////////////

// Check the browser...we're looking for ie/win
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // true if we're on windows

// Write vbscript detection on ie win. IE on Windows doesn't support regular
// JavaScript plugins array detection.
if(isIE && isWin){

  temp = "<SCR" + "IPT LANGUAGE=VBScript\> \n";
  temp += "on error resume next \n";
  for (var i = maxFlashVersion; i >= minFlashVersion; i--)
  {  
 	  temp += ("flash" + i + "Installed = (IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash." + i + "\"))) \n");
  }
  temp += "</SCR" + "IPT\> \n";
  document.write(temp);
  
}

////////////////////////////////////////////////////////////////////////////////////////////////


function GetFlashVersion()
{  
  
  if( navigator.plugins )
  {

    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 currentFlashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
      eval("flash"+currentFlashVersion+"Installed=true");
    } // end_2nd_if
  

  } // end_1st_if
  
  // Loop through all versions we're checking, and
  // set currentFlashVersion to highest detected version.
  for (var i = maxFlashVersion; i >= minFlashVersion; i--)
  {  
    if (eval("flash" + i + "Installed") == true)
	{
		currentFlashVersion = i;
		break;
	}	
  }
  
  if(navigator.userAgent.indexOf("WebTV") != -1) currentFlashVersion = 3;  
   
  //alert(currentFlashVersion)
  return(currentFlashVersion)
}



function DetectFlashVersion(wantedFlashVersion)
{
	if(wantedFlashVersion == null)
		wantedFlashVersion = maxFlashVersion;
	currentFlashVersion = GetFlashVersion();	
	if(currentFlashVersion >= wantedFlashVersion)	
		return true;
	else
		return false;
}
////////////////////////////////////////////////////////////////////////////////////////////////


function openPopup(){

	var upgradeFlash = "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash";
	
	window.open( upgradeFlash, "upgradeWin" , "width=450,height=520,resizable=yes,scrollbars=yes,top=100,left=200" );
	
	window.setTimeout( "showEnterDiv()", 10000 ); 
}

function showEnterDiv(){
	
	if( document.layers ){
		
		document.layers['enterDiv'].visibility = "visible";
	}
	
	else if( document.all ){
		
		document.all.enterDiv.style.visibility = "visible";
	}
	
	else if( document.getElementById ){
		
		document.getElementById('enterDiv').style.visibility = "visible"; 
	}
}

function OfferDownload()
{
	message = "<br><span class='spnStyle'>Sorry ! <br><br>You have to upgrade your flash-version<br>for this activity !</span><br><br>"; 	
	message += "<span class='verStyle'>[ Your Flash Version is : "+currentFlashVersion+" ]</span>";
	message += "<br><br><a href='javascript:openPopup()' class='refStyle'>Download new version.</a>";
	document.write("<div id='messageDiv' class='messageDivStyle'><center>"+message+"</center></div>");
	document.write("<div id='enterDiv' class='enterDivStyle'><center><br><a href='javascript:window.location.href=\"findFlashVr.htm\"' class='enterStyle'>E N T E R</a></center></div>");
}