var g_flashDetectMinTarget="";
var g_flashDectectVersion="";
function GetFlashVersion(minTarget)
{
	if (navigator.appVersion.indexOf("Win")>=0)
	{
	     //minTarget must be "" or an integer >0 to be valid
	    if(typeof(minTarget)=="undefined" || minTarget=="")
	    {
		    minTarget=1;
	    }
	    
	    if (parseFloat(navigator.appVersion.substr(navigator.appVersion.indexOf("MSIE ")+5))>=4)
	    {   
		    g_flashDetectMinTarget=minTarget;
		    document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
		    document.write('on error resume next \n');
		    document.write('For vb_i = 9 To g_flashDetectMinTarget Step -1\n');
			    document.write('vb_CLSID="ShockwaveFlash.ShockwaveFlash." & vb_i\n');
			    document.write('Set vb_FlashObj = CreateObject(vb_CLSID)\n');
			    document.write('If IsObject(vb_FlashObj) Then\n');
				    document.write('Set vb_FlashObj = nothing\n');
				    document.write('g_flashDectectVersion=vb_i\n');
				    document.write('Exit For\n');
			    document.write('End If\n');
			    document.write('Next\n');											
		    document.write('</SCR' + 'IPT\>');
		  
	    }
	    else if(parseFloat(navigator.appVersion.indexOf("MSIE "))== -1)  //This is not IE
	    { 		    
           if (navigator.plugins != null && navigator.plugins.length > 0) 
           {
                if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) 
                {
                    var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
                    var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
                    descArray = flashDescription.split(" ");
                    tempArrayMajor = descArray[2].split(".");
                    versionMajor = tempArrayMajor[0];
                    if ( descArray[3] != "" ) 
                    {
                        tempArrayMinor = descArray[3].split("r");
                    } 
                    else 
                    {
                        tempArrayMinor = descArray[4].split("r");
                    }
                    versionMinor = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
                    g_flashDectectVersion = parseFloat(versionMajor + "." + versionMinor);
                } 
          }
		    
 	    }
	}
	return g_flashDectectVersion;
}

function HasFlashVersion(minVersion)
{
	var currentVersion=GetFlashVersion(minVersion);
	if(currentVersion!="" && currentVersion>=minVersion)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function ForceFlashUpgrade(minVersion, launchRetURL)
{
	//this code was removed but some CMS code still calls this (MZKI) so can't delete the method until all calls removed.
}
	

function writeFlash(width, height, ID, swfPath, basePath, bgcolor)
{	writeFlashEx2(width, height, ID, swfPath, basePath, bgcolor,"", "");
}

function writeFlashEx(width, height, ID, swfPath, basePath, bgcolor, flashVars)
{
	writeFlashEx2(width, height, ID, swfPath, basePath, bgcolor, flashVars, "");
}

function writeFlashEx2(width, height, ID, swfPath, basePath, bgcolor, flashVars, configObj)
{
	var version=configObj.version;
	try
		{
		if(version==undefined)
		{
			version="6,0,0,0";
		}
	}
	catch(e)
	{
		version="6,0,0,0";
	}
	
	var wmode=configObj.wmode;
	try
	{
		if(wmode==undefined)
		{
			wmode="opaque";
		}
	}
	catch(e)
	{
		wmode="opaque";
	}

	var play = configObj.play;
	try
	{
		if(play==undefined)
		{
			play="true";
		}
	}
	catch(e)
	{
		play="true";
	}

	document.writeln("<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + version + "\" width=\"" + width + "\" height=\"" + height + "\" name=\""+ ID + "\" id=\"" + ID + "\"VIEWASTEXT>");
	document.writeln("<PARAM name=\"wmode\" value=\"" + wmode + "\">");	
	document.writeln("<PARAM name=\"movie\" value=\"" + swfPath + "\">");	
	document.writeln("<PARAM name=\"name\" value=\"" + ID + "\">");	
	document.writeln("<PARAM name=\"flashvars\" value=\"" + flashVars + "\">");
	document.writeln("<PARAM name=\"play\" value=\"" + play + "\">");
	document.writeln("<PARAM name=\"bgcolor\" value=\"" + bgcolor + "\">");
	document.writeln("<PARAM name=\"base\" value=\"" + basePath + "\">");
	document.writeln("<PARAM name=\"allowScriptAccess\" value=\"always\">");
	document.writeln("<PARAM name=\"menu\" value=\"false\">");
	document.writeln("<PARAM name=\"swliveconnect\" value=\"true\">");
	document.writeln("<EMBED id=\"" + ID + "\" src=\"" + swfPath + "\"");
	document.writeln("wmode=\"" + wmode + "\"");
        document.writeln("flashvars=\"" + flashVars + "\"");
	document.writeln("play=\"" + play + "\"");
	document.writeln("bgcolor=\"" + bgcolor + "\"");
	document.writeln("width=\"" + width + "\"");
	document.writeln("height=\"" + height + "\"");
	document.writeln("type=\"application/x-shockwave-flash\"");
	document.writeln("pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"");
	document.writeln("base=\"" + basePath + "\"");
	document.writeln("menu=\"false\">");
	document.writeln("</embed>");	
	document.writeln("<noembed>");
	document.writeln("<blockquote><font face=\"Lucida Console, Monaco, mono\" size=\"-2\"><A href=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" target=\"_self\">This site requires Macromedia Flash to be properly installed in a capable browser.<BR> Follow this link, and you'll find out everything you need to know.</A></font></blockquote>");
	document.writeln("</noembed>");
	document.writeln("</OBJECT>");
}

function injectFlashEx(width, height, ID, swfPath, basePath, bgcolor, flashVars, configObj)
{
	var version=configObj.version;
	try
		{
		if(version==undefined)
		{
			version="6,0,0,0";
		}
	}
	catch(e)
	{
		version="6,0,0,0";
	}
	
	var wmode=configObj.wmode;
	try
	{
		if(wmode==undefined)
		{
			wmode="opaque";
		}
	}
	catch(e)
	{
		wmode="opaque";
	}

	var play = configObj.play;
	try
	{
		if(play==undefined)
		{
			play="true";
		}
	}
	catch(e)
	{
		play="true";
	}
    var strObject = "";
	strObject = "<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + version + "\" width=\"" + width + "\" height=\"" + height + "\" name=\""+ ID + "\" id=\"" + ID + "\"VIEWASTEXT>";
	strObject += "<PARAM name=\"wmode\" value=\"" + wmode + "\">";
	strObject += "<PARAM name=\"movie\" value=\"" + swfPath + "\">";
	strObject += "<PARAM name=\"name\" value=\"" + ID + "\">";
	strObject += "<PARAM name=\"flashvars\" value=\"" + flashVars + "\">";
	strObject += "<PARAM name=\"play\" value=\"" + play + "\">";
	strObject += "<PARAM name=\"bgcolor\" value=\"" + bgcolor + "\">";
	strObject += "<PARAM name=\"base\" value=\"" + basePath + "\">";
	strObject += "<PARAM name=\"allowScriptAccess\" value=\"always\">";
	strObject += "<PARAM name=\"menu\" value=\"false\">";
	strObject += "<PARAM name=\"swliveconnect\" value=\"true\">";
	strObject += "<EMBED id=\"" + ID + "\" src=\"" + swfPath + "\"";
	strObject += "wmode=\"" + wmode + "\"";
    strObject += "flashvars=\"" + flashVars + "\"";
	strObject += "play=\"" + play + "\"";
	strObject += "bgcolor=\"" + bgcolor + "\"";
	strObject += "width=\"" + width + "\"";
	strObject += "height=\"" + height + "\"";
	strObject += "type=\"application/x-shockwave-flash\"";
	strObject += "pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"";
	strObject += "base=\"" + basePath + "\"";
	strObject += "menu=\"false\">";
	strObject += "</embed>";	
	strObject += "<noembed>";
	strObject += "<blockquote><font face=\"Lucida Console, Monaco, mono\" size=\"-2\"><A href=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" target=\"_self\">This site requires Macromedia Flash to be properly installed in a capable browser.<BR> Follow this link, and you'll find out everything you need to know.</A></font></blockquote>";
	strObject += "</noembed>";
	strObject += "</OBJECT>";
	
	return strObject;
}