//Detect flash plugin version
var FlashVersion = 0;
var FlashUncertainty = 0;

var isNetscape     = ( navigator.appName   && navigator.appName.indexOf("Netscape")  >= 0 );
var isIE           = ( navigator.userAgent && navigator.userAgent.indexOf("MSIE")    >= 0 );
var isIE5          = ( navigator.userAgent && navigator.userAgent.indexOf("MSIE 5")  >= 0 );
var isMac          = ( navigator.platform  && navigator.platform.indexOf("Mac")      >= 0 );
var isWindows      = ( navigator.userAgent && navigator.userAgent.indexOf("Windows") >= 0 );
var browserVersion = parseInt( navigator.appVersion );

if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] &&
	 navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)
{
	FlashVersion = 1;
	if (navigator.plugins && navigator.plugins["Shockwave Flash"]) {
		FlashVersion = 3;
		plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
		version = parseInt(plugin.description.substr(plugin.description.indexOf(".") - 2, 2), 10);
		if (version > 3) {
	        FlashVersion = version;
	    }
	}
}
else {
	if (isIE) {
		if (isMac || browserVersion < 4) {
			FlashUncertainty = 1;
		}
	}
	else if (!isNetscape) {
		FlashUncertainty = 1;
	}
}

function flashDetectDocWrite(str) {
	document.write(str);
}

if (isIE && isWindows) {
	document.writeln('<scr'+'ipt language="VBScript">');
	document.writeln('on error resume next');
	document.writeln('testFlashInstalled = False');
	document.writeln('testFlashInstalled = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash"))');
	document.writeln('If testFlashInstalled Then FlashVersion = 1');
	document.writeln('testFlashInstalled = False');
	for (var i = 3; i < 20; i++) {
		document.writeln('testFlashInstalled = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.' + i + '"))');
		document.writeln('If testFlashInstalled Then FlashVersion = ' + i);
		document.writeln('testFlashInstalled = False');
	}
	document.writeln('</scr'+'ipt>');
}
