var flash2Installed = false;    
var flash3Installed = false;    
var flash4Installed = false;    
var flash5Installed = false;    
var flash6Installed = false; 
var flash7Installed = false; 
var flash8Installed = false; 


function qs() {
var query = window.location.search.substring(1);
var parms = query.split('&');
var parameterfound = false;
for (var i=0; i<parms.length; i++) {
   var pos = parms[i].indexOf('=');
   if (pos > 0) {
      var key = parms[i].substring(0,pos);
      if (key == "flash"){
				parameterfound = true;
				return parameterfound;
			}
      }
   }
}

function FlashInstalled() {
	/*if(qs()){
		return true;
	}*/
	var requiredVersion = 6;
	var maxVersion = 8;    
	var actualVersion = 0;    
	
	var hasRightVersion = false;  
	var agent = navigator.userAgent.toLowerCase(); 
	var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; 
	var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;

	if (navigator.mimeTypes && navigator.mimeTypes.length)
	{
		x = navigator.mimeTypes['application/x-shockwave-flash'];
		if (x && x.enabledPlugin)
		{
			return true;
		}
	}

	else {
		// NS3 needs flashVersion to be a local variable
		if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
			actualVersion = 0;
		}
		
		// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
		if (navigator.plugins != null && navigator.plugins.length > 0) {
			var flashPlugin = navigator.plugins['Shockwave Flash'];
			if (typeof flashPlugin == 'object') { 
				for (var i = maxVersion; i >= 3; i--) {
					if (flashPlugin.description.indexOf(i + '.') != -1) {
					   actualVersion = i;
					   break;
					}
				}
			}
		}
		else 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('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
			document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');  
			document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');  
			document.write('</SCR' + 'IPT\> \n'); 
		}
		
		// 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;
		}
		
		if (actualVersion >= requiredVersion) {
			hasRightVersion = true;
		}
		
		return hasRightVersion;
	}
}

/* write flash player to browser */
function FlashWrite(url,width,height) {

	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ');
	document.write('  WIDTH=' + width + ' HEIGHT=' + height + '>');
	document.write(' <PARAM NAME=movie VALUE="' + url + '"> <PARAM NAME=quality VALUE=high> ');
	document.write(' <EMBED src="' + url + '" quality=high ');
	document.write(' swLiveConnect=FALSE WIDTH=' + width + ' HEIGHT=' + height);
	document.write(' MENU="false" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
	document.write(' </EMBED></OBJECT>');
}

function renderFlash(url,width,height,imgSrc,imgAlt,hyperLink) {
	if (FlashInstalled()) {
		FlashWrite(url,width,height);
	}
	else { 
		if (typeof(hyperLink) == "undefined") {
			document.write('<IMG SRC="' + imgSrc + '" border="0" alt="' + imgAlt + '">');
		}
		else {
			document.write('<a href="' + hyperLink + '"><IMG SRC="' + imgSrc + '" border="0" alt="' + imgAlt + '"></a>');
		}
	}
}


