// FLASH DETECT

var detectableWithVB 	= false;
var pluginFound 		= false;
var flashVersion 		= 0;
var passedFlashCheck 	= false;
var passedVersionCheck	= false;
var proceedToFlashPage 	= false;

	function getFlashStatus() {
	    pluginFound = detectPlugin('Shockwave','Flash'); 
	    if(!pluginFound && detectableWithVB) {
		pluginFound = detectActiveXControl('ShockwaveFlash.ShockwaveFlash.1');
	    }
	    return pluginFound;
	}
	function detectPlugin() {
	    var daPlugins = detectPlugin.arguments;
	    var pluginFound = false;
	    if (navigator.plugins && navigator.plugins.length > 0) {
		var pluginsArrayLength = navigator.plugins.length;
		for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
		    var numFound = 0;
		    for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) {
			if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || 
			    (navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
			    numFound++;
			}   
		    }
		    if(numFound == daPlugins.length) {
			pluginFound = true;
			break;
		    }
		}
	    }
	    return pluginFound;
	}
		if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
		    document.writeln('<script language="VBscript">');
		    document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
		    document.writeln('detectableWithVB = False');
		    document.writeln('If ScriptEngineMajorVersion >= 2 then');
		    document.writeln('  detectableWithVB = True');
		    document.writeln('End If');
		    document.writeln('\'this next function will detect most plugins');
		    document.writeln('Function detectActiveXControl(activeXControlName)');
		    document.writeln('  on error resume next');
		    document.writeln('  detectActiveXControl = False');
		    document.writeln('  If detectableWithVB Then');
		    document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
		    document.writeln('  End If');
		    document.writeln('End Function');
		    document.writeln('</scr' + 'ipt>');
		}

	function getFlashVersion() {
		var agent = navigator.userAgent.toLowerCase(); 
		if (navigator.plugins != null && navigator.plugins.length > 0) {
			var flashPlugin = navigator.plugins['Shockwave Flash'];
			if (typeof flashPlugin == 'object') {
				if (flashPlugin.description.indexOf('8.') != -1) flashVersion = 8;
				else if (flashPlugin.description.indexOf('7.') != -1) flashVersion = 7;
				else if (flashPlugin.description.indexOf('6.') != -1) flashVersion = 6;
				else if (flashPlugin.description.indexOf('5.') != -1) flashVersion = 5;
				else flashVersion = 0;
			}
		}
		else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
		   	document.write('<scr' + 'ipt language="VBScript"\> \n');
			document.write('on error resume next \n');
			document.write('dim obFlash \n');
			document.write('set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.8") \n');
			document.write('if IsObject(obFlash) then \n');
			document.write('flashVersion = 8 \n');
			document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.7") end if \n');
			document.write('if IsObject(obFlash) then \n');
			document.write('flashVersion = 7 \n');
			document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.6") end if \n');
			document.write('if flashVersion < 7 and IsObject(obFlash) then \n');
			document.write('flashVersion = 6 \n');
			document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.5") end if \n');
			document.write('if flashVersion < 6 and IsObject(obFlash) then \n');
			document.write('flashVersion = 5 \n');
			document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.4") end if \n');
			document.write('if flashVersion < 5 and IsObject(obFlash) then \n');
			document.write('flashVersion = 0 \n');
			document.write('end if');
			document.write('</scr' + 'ipt\> \n');
	  	}
		else {
			flashVersion = 0;
		}
		return flashVersion;
	}
	passedFlashCheck 	= getFlashStatus();
	passedVersionCheck	= getFlashVersion();

	function FlashDetect(whichVersion) {
		if (passedFlashCheck == true && passedVersionCheck >= whichVersion) {
			proceedToFlashPage = true;
		} else {
			proceedToFlashPage = false;
		}
		return proceedToFlashPage;
	}
	


function runFlash(flashFile,width,height) {
	
	//if (FlashDetect(6)) {
		
		document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+width+'" height="'+height+'">');
		document.write('<param name="movie" value="'+flashFile+'" />');
		document.write('<param name="quality" value="high" />');
		document.write('<embed src="'+flashFile+'" quality="high" width="'+width+'" height="'+height+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
		document.getElementById('altInfo').style.display = 'none';
	//}
	
}


