// this is the minimum requred flash version you are detecting for
var flash_contentVersion = 8;

// check to see if there is a plugin
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

// if there is
if ( plugin ) {
	
	// if the plugin is flash
	if (navigator.plugins["Shockwave Flash"]) {
		
		// following lines get the version of the flash file
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
			for (var i = 0; i < words.length; ++i)
			{
		if (isNaN(parseInt(words[i])))
		continue;
		var flash_PluginVersion = words[i];
			}
	// set this variable (used in the document calling the function) to true if the 
	// version of flash is greater to or equal than the value set at the top of this doc.
	var flash_CanPlay = flash_PluginVersion >= flash_contentVersion;
	}
}
// if we are using an unusual browser, set the can play variable a different way.
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('flash_CanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & flash_contentVersion)))\n');
	document.write('</scr' + 'ipt\> \n');
}


// this function builds the flash movie. flashvars is a variable you can pass into the root of the 
// flash movie. the varaible will have the name flashvars always
function buildFlash(src, width, height, bgcolor, flashvars) {

	// decalare some variables
	var sFlashBg1 = "";
	var sFlashBg2 = "";
	var sFlashVars1 = "";
	var sFlashVars2 = "";

	// if there is background colour passed to the function
	if (bgcolor != "") {
		
		// set the background colour to be inserted in between the <object> tags
		sFlashBg1 = ' <param name="bgcolor" value="' + bgcolor + '">';
		
		// set the background colour variable to be inserted in the <embed> tag 
		sFlashBg2 = ' bgcolor="' + bgcolor + '"';

	}
	
	// if there is flashvars passed to the function
	if (flashvars != "") {
		
		// set the flashvars paramiter to be inserted in between the <object> tags 
		sFlashVars1 = ' <param name="FlashVars" value="' + flashvars + '">';
		
		// set the flashvars variable to be inserted in the <embed> tag
		sFlashVars2 = ' FlashVars="' + flashvars + '"';
	}

	
	// this builds the flash movie. the movie is stored in a variable sFlashHtml
	var sFlashHtml = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + width + '" height="' + height + '">';
	sFlashHtml += '<param name="movie" value="' + src + '">' + sFlashVars1 + ' <param name="menu" value="false"><param name="quality" value="high"><param name="scale" value="noscale"><param name="allowScriptAccess" value="sameDomain">' + sFlashBg1;
	sFlashHtml += '<embed src="' + src + '"' + sFlashVars2 + ' width="' + width + '" height="' + height + '"' + sFlashBg2 + ' menu="false" scale="noscale" quality="high" allowScriptAccess="sameDomain" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
	sFlashHtml += '</object>';
	
	
	// write the flash movie (sFlashHtml) to the screen
	document.write(sFlashHtml);

}
