// Detects flash and places the specified movie if found. 
// Otherwises place the altHTML in its place.


// Flag. Values 0 - untested, 1 - has flash, 2 - No Flash.
var canPlay = 0;

// minVersion	: minimum version of flash required to play the movie.
// movieURL		: URL of the movie.
// movieWidth	: width of the movie.
// movieHeight	: height of the movie.
// movieName	: name of the movie (used as ID for other scripts).
// movieBG		: Background color for the movie.
// movieAlign	: Horiz. Alignment
// altHTML		: Alternative HTML to be displayed if flash not available.

function TSL_EmbedMovie(minVersion, movieURL, movieWidth, movieHeight, movieName, movieBG, movieAlign, altHTML){
	if ((canPlay != 1) && (canPlay != 2)){
		var contentVersion = minVersion;
		var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
		var MM_FlashCanPlay = -1;
		
		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]; 
			}

			MM_FlashCanPlay = MM_PluginVersion >= contentVersion;
		} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
				&& (navigator.appVersion.indexOf("Win") != -1)) {
					document.write('<SCR'+'IPT LANGUAGE=VBScript>\n');
					document.write('on error resume next\n');
					document.write('var x\n');
					document.write('x = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+contentVersion+'"))\n');
					document.write('if not x=true Then\n');
					document.write('x = false\n');
					document.write('end if\n');
					document.write('</scr'+'ipt>\n');
					MM_FlashCanPlay = x
		} 

		if (MM_FlashCanPlay){
			canPlay = 1;
		} else {
			canPlay = 2;
		}
	}
	
	if ( canPlay == 1) {
		document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
		document.write(' ID="'+movieName+'" WIDTH="'+movieWidth+'" HEIGHT="'+movieHeight+'" ALIGN="">');
		document.write(' <PARAM NAME=movie VALUE="'+movieURL+'"> <PARAM NAME=quality VALUE=high> <PARAM NAME="menu" value=false><PARAM NAME=bgcolor VALUE='+movieBG+'>  '); 
		document.write(' <EMBED src="'+movieURL+'" quality=high bgcolor='+movieBG+'  ');
		document.write(' swLiveConnect=FALSE WIDTH="'+movieWidth+'" HEIGHT="'+movieHeight+'" NAME="'+movieName+'" ALIGN="'+movieAlign+'"');
		document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
		document.write(' </EMBED>');
		document.write(' </OBJECT>');
	} else{
		document.write(altHTML);
	}
}
