/* This script is based upon moock fpi, version 1.3.5 written by colin moock, www.moock.org */
/* Changes made by Jamie Gehrlich, Popular Front Interactive, to allow detection in AOL.    */

var flash2Installed = false;
var flash3Installed = false;
var flash4Installed = false;
var flash5Installed = false;
var flash6Installed = false;
var maxVersion = 6;
var actualVersion = 0;
var hasRightVersion = false;
var jsVersion = 1.0;
var isMac = false;
var skipDetect = false;
var sSearch = location.search.substring(1);

requiredVersion = 6;

var isMac = (navigator.appVersion.indexOf("Mac") != -1) ? true : false;
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
var isAOL = (navigator.appVersion.indexOf("AOL") != -1) ? true : false;
jsVersion = 1.1;

if(isIE && isWin && !isAOL){ 
	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('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');	
	document.write('</scr' + 'ipt\> \n');
}  

function detectFlash(){
	
	if(sSearch.indexOf("skipDetect=true") != -1) skipDetect = true;	

	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 flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
			flash2Installed = flashVersion == 2;		
			flash3Installed = flashVersion == 3;
			flash4Installed = flashVersion == 4;
			flash5Installed = flashVersion == 5;
			flash6Installed = flashVersion >= 6;
		}
	}
	
	for(var i = 2; i <= maxVersion; i++) 
		if(eval("flash" + i + "Installed") == true) actualVersion = i;

	if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 2;	
	
	if (actualVersion >= requiredVersion)
		hasRightVersion = true;
		
}

detectFlash();
	
function WriteFlash()
{
    if (hasRightVersion || isAOL || skipDetect) {
    	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"\n');
    	document.write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"\n');
    	document.write('width="800" height="600"\n');
    	document.write('id="ColderFusionDemo">\n');
    	document.write('<param name="movie" value="ColderFusion.swf">\n');
    	document.write('<param name="quality" value="high">\n');
    	document.write('<param name="bgcolor" value="#FFFFFF">\n');
    	document.write('<embed src="ColderFusion.swf"\n');
    	document.write('quality="high"\n');
    	document.write('bgcolor="#FFFFFF"\n');
    	document.write('width="800" height="600"\n');
    	document.write('name="ColderFusionDemo"\n');
    	document.write('type="application/x-shockwave-flash"\n');
    	document.write('pluginspage="http://www.macromedia.com/go/getflashplayer">\n');
    	document.write('</embed>\n');
    	document.write('</object>\n');
    } else {
	document.write('You will need the Macromedia Flash 6 player to view this presentation.');
	document.write('<p>You can <a href="http://www.macromedia.com/go/getflashplayer" target="_blank">download the latest Flash player here</a>.');
	document.write('<p>If you know that you have the Flash 6 player installed, <a href="index.html?skipDetect=true">click here to continue</a>.');
    }
}
