// Insert Flash MOVIES

var MovieCount = 0;

var MM_contentVersion = 8;
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 insertFlash(MovieURL, Params, NoEmbedImageURL)
{
	MovieCount ++;
	
	var sParamTags	= "", sEmbedAttributes = "", sImageTag = "", sNoEmbedTag = "";
	var iWidth = "100", iHeight = "100", sAlign = "default";
	var sMovieID = "Movie" + MovieCount;
	
		
	if(Params)
	{
		Params = Params.replace(" ", "").replace(", ", ",").split(",");
		for(i=0; i<Params.length; i++)
		{
			var Param = Params[i].split("=");
			
			switch(Param[0].toLowerCase())
			{
				case "width":
					iWidth = Param[1];
					break;
				
				case "height":
					iHeight = Param[1];
					break;
					
				case "id":
					sMovieID = Param[1];
					break;
				
				case "align":
					sAlign = Param[1];
					break;
				
				default:
					sParamTags += "<param name='" + Param[0] + "' value='" + Param[1] + "'>";	
					sEmbedAttributes += Param[0] + "='" + Param[1] + "' ";	
			}
		}
	}
	
	
	if(NoEmbedImageURL)
	{
		sImageTag = "<img src='" + NoEmbedImageURL + "' width='" + iWidth + "' height='" + iHeight + "' align='" + sAlign + "' name='" + sMovieID + "' id='" + sMovieID + "' usemap='#" + sMovieID + "' border='0'>";
		sNoEmbedTag = "<noembed>" + sImageTag + "</noembed>";
	}




	if ( MM_FlashCanPlay ) {

		document.write("<object " +
				"classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' " + 
				"codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' " +
				"width='" + iWidth + "' " +
				"height='" + iHeight + "' " +
				"id='" + sMovieID + "' " + 
				"align='" + sAlign + "'>");

		document.write("<param name='movie' value='" + MovieURL + "'>");

		document.write(sParamTags);

		document.write("<embed pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' " +
				"type='application/x-shockwave-flash' " +
				"src='" + MovieURL + "' " + 
				sEmbedAttributes + 
				"width='" + iWidth + "' " +
				"height='" + iHeight + "' " + 
				"name='" + sMovieID + "' " + 
				"align='" + sAlign + "' >" + sNoEmbedTag + "</embed>");

		document.write("</object>");
	} else{
		if(NoEmbedImageURL!="")
		{document.write(sImageTag);}
		else
		{
			document.write("<div style=\"padding: 3px; border: 3px solid #EEEEEE;\"><h4>You need to install the latest Flash plugin to view this page.</h4>" + 
							"<p>Go to <a href=\"http://www.adobe.com/products/flashplayer/\" target=\"flash\" style=\"font-weight: bold;\">the Macromedia website</a> to install and download.</p></div>");
		}
	}
}




// Insert Java APPLETS
var sSpecialParamTags = "";

function addSpecialParamTag(sName, sValue)
{
	sSpecialParamTags += "<param name=\"" + sName + "\" value=\"" + sValue + "\">";
}

function insertApplet(CodeName, CodeBaseURL, CodeURL, Attributes, Params, Extras)
{
	var iWidth = 0;
	var iHeight = 0;
	var sParamTags = "", sAttributes = "";
	
	if(Params)
	{
		Params = Params.split(",");
		for(i=0; i<Params.length; i++)
		{
			var Param = Params[i].split("=");
			sParamTags += "<param name=\"" + Param[0] + "\" value=\"" + Param[1] + "\">";	
		}
	}
	
	if(Attributes)
	{
		Attributes = Attributes.split(",");
		for(i=0; i<Attributes.length; i++)
		{
			var Attribute = Attributes[i].split("=");
			sAttributes += Attribute[0] + "=\"" + Attribute[1] + "\" ";
		}
	}
	
	if(!Extras) Extras = "";
		
	document.write("<applet name=\"" + CodeName + "\" codebase=\"" + CodeBaseURL + "\" code=\"" + CodeURL + "\"" + sAttributes + Extras + ">");
	document.write(sParamTags + sSpecialParamTags);
	document.write("</applet>");
	
	sSpecialParamTags = "";
}
