var blnHasFlash = false;
function CN_HasFlash(FlashVersion)
{
	var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
	var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
	
	// Write vbscript detection on ie win. IE on Win 
	if(isIE && isWin)
	{
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('blnHasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.' + FlashVersion + '"))) \n');  
		document.write('</SCR' + 'IPT\> \n');
	} 
	// ElseIf netscape or mac(not version 4.5)
	else if (navigator.plugins) 
	{		
		if (navigator.plugins["Shockwave Flash"])// ...then check flash 3+. 
		{
			var strFlashDescription = navigator.plugins["Shockwave Flash"].description;
			var intFlashVersion = parseInt(strFlashDescription.charAt(strFlashDescription.indexOf(".") - 1));
			blnHasFlash = intFlashVersion >= FlashVersion;  
		}
	}

	if (blnHasFlash != true)
		blnHasFlash = false;
		
	return blnHasFlash;
}

function CN_WriteFlash(FlashVersion, FlashSource, FlashWidth, FlashHeight, FlashBgColor, FlashImage)
{
	var Result = CN_HasFlash(FlashVersion);
	
	if (Result)
	{
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + FlashVersion + ',0,0,0" width="' + FlashWidth + '" height="' + FlashHeight + '" id="flashtest">');
		document.write('<param name="movie" value="' + FlashSource + '"> ');
		document.write('<param name="quality" value="high"> ');
		document.write('<param name="menu" value="false">');
		document.write('<param name="wmode" value="transparent" />');
		document.write('<embed swliveconnect="true" name="flashtest" src="' + FlashSource + '" quality="high" menu="false" ');
		document.write('swLiveConnect="false" width="' + FlashWidth + '" height="' + FlashHeight + '"');
		document.write('type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" wmode="transparent">');
		document.write('</object>');
	}
	else if (FlashImage != '')
	{
		document.write('<a href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">')
		document.write('<img src="' + FlashImage + '" border="0" alt="Click here to get flash player">')
		document.write('</a>')
	}
	
	return Result;
}
