// OK, now start detection...

var flashVersion = 0;

// Check the browser...we're looking for ie/win
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // true if we're on windows

// Write vbscript detection on ie win. IE on Windows doesn't support regular
// JavaScript plugins array detection.
if(isIE && isWin){
  document.write('<scr' + 'ipt language=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
  document.write('</scr' + 'ipt\> \n'); // break up end tag so it doesn't end our script
	if(flash5Installed){
		flashVersion = 5;
	}
	if(flash6Installed){
		flashVersion = 6;
	}
}




// Detect Flash version    
function detectFlash() {
 	// If navigator.plugins exists...
 	if (navigator.plugins) {
		// ...then check for flash 2 or flash 3+.
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			// Some version of Flash was found. Time to figure out which.
      
			// Set convenient references to flash 2 and the plugin description.
			var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;

			flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
		}
 	}
}
detectFlash();

function embedIt(movie, width, height, bgcolor, multipleVersions){
	if(flashVersion == 5 || flashVersion == 6) {
		document.write('<object data="' + movie + (multipleVersions ? +flashVersion : '') + '.swf" width="'+width+'" height="'+height+'" type="application/x-shockwave-flash">');
		document.write('<embed src="' + movie + (multipleVersions ? +flashVersion : '') + '.swf" menu="false" quality="high" bgcolor="'+bgcolor+'"  width="'+width+'" height="'+height+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>');
		document.write('<param name="movie" value="' + movie + (multipleVersions ? +flashVersion : '') + '.swf" />');
		document.write('<param name="menu" value="false" />');
		document.write('<param name="quality" value="high" />');
		document.write('<param name="wmode" value="transparent" />');
		document.write('<param name="bgcolor" value="'+bgcolor+'" />');
		document.write('</object>');
	} else  {
		document.write('Please upgrade your Flash plugin.');
	}
}
