/* -----------------------------------------------------------------
  function for Flash Movies and alternative imagery
 ----------------------------------------------------------------- */

		// FLASH MOVIE
			var MM_contentVersion = 6;
			var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
			if ( plugin ) {
					var words = navigator.plugins["Shockwave Flash"].description.split(" ");
				    for (var i = 0; i < words.length; ++i)
				    {
					if (isNaN(parseInt(words[i])))
					continue;
					var MM_PluginVersion = words[i];
				    }
				var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
			}
			else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
			   && (navigator.appVersion.indexOf("Win") != -1)) {
				document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
				document.write('on error resume next \n');
				document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
				document.write('</SCR' + 'IPT\> \n');
			}


function flashMovie(version, filepath, width, height, bgcolor, id, img) {
	var swf = '';
	if (detectFlash()){
		swf += '<object';
		swf += ' width="'+width+'"';
		swf += ' height="'+height+'"';
		swf += ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
		swf += ' codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+version+',0,0,0" align="absmiddle" id="'+id+'">';
		swf += '<param name="movie" value="'+filepath+'?path='+PATH+'">';
		//swf += '<param name="wmode" value="transparent">';
		swf += '<param name="bgcolor" value="'+bgcolor+'">';
		swf += '<param name="quality" value="high">';
			swf += '<embed src="'+filepath+'?path='+PATH+'"';
			swf += ' align="absmiddle"';
			swf += ' width="'+width+'"';
			swf += ' height="'+height+'"';
			//swf += ' wmode="transparent"';
			swf += ' bgcolor="'+bgcolor+'"';
			swf += ' quality="high"';
			swf += ' type="application/x-shockwave-flash"';
			swf += ' pluginspage="https://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">';
			swf += '<\/embed>';
		swf += '<\/object>';
	}
	else {
		swf += '<img src="'+PATH+'flash/'+img+'" border="0" />';
	}
	document.write(swf);
}

function detectFlash(){
	var retVal = 0;
//	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			retVal = 1;
		}
	}else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ // if Windows CE
		var axo = 1;
		var counter = 3;
		while(axo) {
			try {
				counter++;
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
				retVal = 1;
			} catch (e) {
				axo = null;
			}
		}
	} else { // Win IE (non mobile)
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				retVal = 1;
				axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			retVal = 1;
		}
	}
	return retVal;
}

