var requiredVersion = 5;		// version the user needs to view site is 5
var useFlashFile = false; 		// "true" loads flash, "false" embeds .gif into current page
var flash2Installed = false;		// boolean. true if flash 2 is installed
var flash3Installed = false;		// boolean. true if flash 3 is installed
var flash4Installed = false;		// boolean. true if flash 4 is installed
var flash5Installed = false;		// boolean. true if flash 5 is installed
var maxVersion = 5;				// highest version we can actually detect
var actualVersion = 0;				
var hasRightVersion = false;

// check the browser and operating system
var agt=navigator.userAgent.toLowerCase();
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
var is_vers = parseInt(navigator.appVersion);
var is_ie3  = (isIE && (is_vers < 4));
var is_ie4  = (isIE && (is_vers == 4) && (agt.indexOf("msie 4")!=-1) );
var is_ie5up = (isIE && !is_ie3 && !is_ie4);


// write vbscript detection if we are using IE and PC
if(isIE && isWin){ 
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
	document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
	document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');	
	document.write('</SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
}

// check to see if we have flash 5 installed
function detectFlash(strPopUp){	
	if (navigator.plugins){ 
		// this next bit will only fire with NN, and not IE. 		
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]){
			// set references to flash 2 and the plugin description
			var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
			// we can get the major version by grabbing the character before the period
			var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
			// if the flashversion is 5, set the variable to true
			flash2Installed = flashVersion == 2;		
			flash3Installed = flashVersion == 3;
			flash4Installed = flashVersion == 4;
			flash5Installed = flashVersion == 5;
		}
	}
	
	// loop through all versions we're checking, and set actualVersion to highest detected version
	for (var i = 2; i <= maxVersion; i++) {	
		if (eval("flash" + i + "Installed") == true) actualVersion = i;
	}
	
	// this code is fired regardless of OS or browser.  if we are in IE, it will acccess the VBScript variables
	if ((actualVersion == requiredVersion ) && ( is_ie5up )) { 
		hasRightVersion = true;
	} else {
		hasRightVersion = false;
 	}
} 