//
//	FLASH OBJECT            
//	---------------------------------
//	Insert flash code with flash detection, 
//	html alternative and fix eolas
//

//flash detection player version 6 and higher
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');
}

//insert flash code
function insertFlashObj(fileName,w,h,params,bgc,flashContainer,wmode){
	if (bgc == ""){
		bgc = "ffffff";
	}
	var  flashSource = "";
	if ( MM_FlashCanPlay ) {
		flashSource = composeFlSource(fileName,w,h,params,bgc,wmode);
		document.getElementById(flashContainer).innerHTML = flashSource;
	}
}

function replaceClassByFlashObj(fileName,w,h,params,bgc,clsName,wmode){
	if (bgc == ""){
		bgc = "ffffff";
	}
	var  flashSource = "";
	if ( MM_FlashCanPlay ) {
		flashSource = composeFlSource(fileName,w,h,params,bgc,wmode);
		clsContent = document.getElementsByTagName("div");
		for (i=0;i<clsContent.length;i++) {
			thisBox = clsContent[i];
			if (thisBox.className == clsName)
				thisBox.innerHTML = flashSource;
		}
	}
}

function replaceTextByFlashObj(fileName,w,h,params,bgc,objTxtName,wmode){
	if (bgc == ""){
		bgc = "ffffff";
	}
	var  flashSource = "";
	if ( MM_FlashCanPlay ) {
		clsContent = document.getElementsByTagName("span");
		for (i=0;i<clsContent.length;i++) {
			thisBox = clsContent[i];
			if (thisBox.className == objTxtName){
				thisParams = "";
				thisParams = params+thisBox.innerHTML;
				thisParams = thisParams.replace(/\"/g,"'");
				flashSource = composeFlSource(fileName,w,h,thisParams,bgc,wmode);
				thisBox.innerHTML = flashSource;
			}
		}
	}
}

function composeFlSource(fileName,w,h,params,bgc,wmode){
		var output ="";
		output += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" ";
		output += "id=\"flashItem\" width=\""+w+"\" height=\""+h+"\" border=\"0\">";
		output += "<param name=\"movie\" value=\""+fileName+"\" /><param name=\"loop\" value=\"false\" /><param name=\"menu\" value=\"false\">";
		if (wmode) output += "<param name=\"wmode\" value=\"transparent\">";
		output += "<param name=\"quality\" value=\"high\" /><param name=\"scale\" value=\"noscale\" /><param name=\"salign\" value=\"lt\" /><param name=\"bgcolor\" value=\"#"+bgc+"\" />";
		if (params != "") output += "<param name=\"flashvars\" value=\""+params+"\" />";
		output += "<embed src=\""+fileName+"\" loop=\"false\" menu=\"false\" quality=\"high\" bgcolor=\"#"+bgc+"\"";
		if (wmode) output += " wmode=\"transparent\"";
		output += " swLiveConnect=\"false\" width=\""+w+"\" height=\""+h+"\" name=\"flashItem\"";
		output += " type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"";
		if (params!="") output += " flashvars=\""+params+"\"";
		output += ">";
		output += "</embed>";
		output += "</object>";
		return output;
}