// ==========================================================================
// Source: http://javascript.about.com/library/scripts/blflashdetect.htm
// Date: July 29, 2003
// 
// Sample (original) <BODY> tag code:
// <SCRIPT Language = "JavaScript">
// if (FlashInstalled())
// 	 FlashWrite('images/aboutbanner.swf',468,60);
// else
// 	 document.write('Flash required to view this movie');
// </SCRIPT>
// ==========================================================================

function FlashInstalled()
{
	result = false;

	if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"])
	{
		result = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
	}
	else if (document.all && (navigator.appVersion.indexOf("Mac")==-1))
	{
		// IE Windows only -- check for ActiveX control, have to hide code in eval from Netscape (doesn't like try)
		eval ('try {var xObj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if (xObj)	result = true; xObj = null;	} catch (e)	{}');
	}
	return result;
}

// Original function. Rewritten below on July 30, 2003 to use additional parameters.
//function FlashWrite(url,width,height)
//{
//	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
//	document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ');
//	document.write('  WIDTH=' + width + ' HEIGHT=' + height + '>');
//	document.write(' <PARAM NAME=movie VALUE="' + url + '"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF>  '); 
//	document.write(' <EMBED src="' + url + '" quality=high bgcolor=#FFFFFF  ');
//	document.write(' swLiveConnect=FALSE WIDTH=' + width + ' HEIGHT=' + height);
//	document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
//	document.write(' </EMBED></OBJECT>');
//}

function FlashWrite( sFlashUrl, nWidth, nHeight, bLoop, sQuality, sBgColor, sMode )
{
	var sId;
	var sTemp = new String(sFlashUrl);
	sId = sTemp.substring( sTemp.lastIndexOf( "/" )+1, sTemp.lastIndexOf( "." ) )
	
	document.write( "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' " );
	document.write( "  codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' " );
	document.write( "  width='" + nWidth + "' " );
	document.write( "  height='" + nHeight + "' " );
	document.write( "  id='" + sId + "'>" );
	document.write( "  name='" + sId + "'>" );
	document.write( "<param name='movie' value='" + sFlashUrl + "'>" );
	document.write( "<param name='loop' " )
	if ( bLoop )
		document.write( " value='true'>" );
	else
		document.write( " value='false'>" );
	document.write( "<param name='quality' value='" + sQuality + "'>" );
	document.write( "<param name='bgcolor' value='" + sBgColor + "'>" );
	document.write( "<param name='wmode' value='" + sMode + "'>" );
	document.write( "<embed src='" + sFlashUrl + "' " );
	if ( bLoop )
		document.write( "  loop='true' " );
	else
		document.write( "  loop='false' " );
	document.write( "  quality='" + sQuality + "' " );
	document.write( "  bgcolor='" + sBgColor + "' " );
	document.write( "  wmode='" + sMode + "' " );
	document.write( "  width='" + nWidth + "' " );
	document.write( "  height='" + nHeight + "' " );
	document.write( "  type='application/x-shockwave-flash' " );
	document.write( "  pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'>" );
	document.write( "</embed>" );
	document.write( "</object>" );
}
