

var flash5 = false;
var flash4 = false;
var flash3 = false;

//detect the version of flash plugin. It doesn't work for Windows on Mac.
//flashdetect() will return the version. For Windows on Mac, it will return 5.
function flashdetect()
{
	var version=5;	
	var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;	
		
	var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; 
	if (!isIE)
	{
		version=0;
		var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] ? 
		navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0);	
		if(plugin)
		{version=parseInt(plugin.description.substring(plugin.description.indexOf(".")-1));}
	}

	if(isIE && isWin){ 
		version=0;
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('flash3 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
		document.write('flash4 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
		document.write('flash5 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');	
		document.write('</SCR' + 'IPT\> \n'); 
		if (!version){version=flash5?5:0;}
		if (!version){version=flash4?4:0;}
		if (!version){version=flash3?3:0;}
	}

	return version;
}

//if the client computer has flash plugin version 4 or up, it will display a flash file--flashname.
//if the client computer doesn't have flash plugin version 4 or up, it will display a image file--imagename.
//w-- width of flash file
//h-- height of flash file.
// the image file and flash file should have same size

function writeflash(flashname,imagename,w,h)
{
	
	var strTemp="";
	var flashversion=flashdetect();
	
	if (flashversion>=5)
	{
		strTemp = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0"';
		strTemp += ' width="'+w+ '"height="'+h+'">';
		strTemp += '<param name=movie value="'+flashname+'"><PARAM NAME="MENU" VALUE="false"><param name=quality value=high>';
		strTemp +='<embed src="'+flashname+'" quality=high MENU="false" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"';
		strTemp += ' width="' +w + '"height="' + h +'"></embed></object>';
		//strTemp += ' width="550" height="400"></embed></object>';
	}
	else
	{
		strTemp='<img src="'+imagename+'" width="550" height="400" border="0" alt="CBEEDAC" title=""CBEEDAC">';
		
	}
	document.write (strTemp);
}

