// This script will test up to the following version.
var flash_versions = 10;
// Initialize variables and arrays
var flash = new Object();
flash.installed = false;
flash.version = '0.0';
// Dig through Netscape-compatible plug-ins first.
if(navigator.plugins && navigator.plugins.length) {
	for(var x=0; x<navigator.plugins.length; x++) {
		if(navigator.plugins[x].name.indexOf('Shockwave Flash') != -1) {
			flash.version = navigator.plugins[x].description.split('Shockwave Flash ')[1];
			flash.installed = true;
			break;
		}
	}
// Then, dig through ActiveX-style plug-ins afterwords
} else if(window.ActiveXObject) {
	for(x=2; x<=flash_versions; x++) {
		try {
			oFlash = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + x + "');");
			if(oFlash) {
				flash.installed = true;
				flash.version = x + '.0';
			}
		}
		catch(e) {}
	}
}
// Create sniffing variables in the following style: flash.ver[x]
flash.ver = Array();
for(var i=4; i<=flash_versions; i++)
	flash.ver[i] = (flash.installed && parseInt(flash.version) >= i);

/******************
 * Write SWF Code *
 ******************/
function writeSWFCode(swfSrc, swfWidth, swfHeight, wmode, flashVars) {
	var writeString = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + swfWidth + '" height="' + swfHeight + '">';
	writeString += '<param name="movie" value="' + swfSrc + '" />';
	if(wmode != null) writeString += '<param name="wmode" value="' + wmode + '" />';
	if(flashVars != null) writeString += '<param name="flashvars" value="' + flashVars + '" />';
	writeString += '<param name="quality" value="high" />';
	writeString += '<param name="showmenu" value="false" />';
	writeString += '<embed src="' + swfSrc + '" quality="high" showmenu="false" ';
	if(wmode != null) writeString += 'wmode="' + wmode + '" ';
	if(flashVars != null) writeString += 'flashvars="' + flashVars + '" ';
	writeString += 'pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + swfWidth + '" height="' + swfHeight + '"></embed>';
	writeString += '</object>';
	document.write(writeString);
	delete writeString;
}