// flash_detect.js - 3.1
// lowest flash version to check
flashContentVersion = 6;
// run flash detection and set flashCanPlay
var flashCanPlay;
runFlashDetect = function () {
	var foundPlugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if (foundPlugin) {
		var words_array = navigator.plugins["Shockwave Flash"].description.split(" ");
		for (var i = 0; i < words_array.length; ++i) {
			if (isNaN(parseInt(words_array[i]))) continue;
			var PluginVersion = words_array[i];
		}
		flashCanPlay = PluginVersion >= flashContentVersion;
	} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
		document.write('on error resume next \n');
		document.write('flashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & flashContentVersion)))\n');
		document.write('</SCR' + 'IPT\> \n');
	}
};
runFlashDetect();
// check flashCanPlay and write the appropriate code
var flashVars = "";
loadFlash = function (flashSetup, flashVars, staticCode) {
	if (flashCanPlay) {
		// flashSetup array -> src, width, height, quality, bgcolor, scale, wmode
		var flashSetup = flashSetup.split(",");
		// check for flashVars and flashContentVersion, then append variables to the url
		if (flashVars != "" && flashContentVersion < 6) flashSetup[0] += "?" + flashVars; // otherwise, we use the v6+ FlashVars attribute
		// write the plugin code
		document.write('<embed src="'+flashSetup[0]+'" width="'+flashSetup[1]+'" height="'+flashSetup[2]+'" quality="'+flashSetup[3]+'" bgcolor="'+flashSetup[4]+'" scale="'+flashSetup[5]+'" wmode="'+flashSetup[6]+'" FlashVars="'+flashVars+'" menu="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer/"></embed>');
	} else {
		// write the static code
		document.write(staticCode);
	}
};

