var targetMajor = 9;	// The major version you want to detect - mustn't contain decimals
var targetMinor = 0;	// The release number (example where 79 is the minor version: 6,0,79,0) - leave as 0 if uncertain

// Leave the following untouched unless you know what you're doing
var hasFlash = false,
    hasActiveX = false,
    navPlugins = (navigator.plugins.length > 0),

    isIE = (navigator.appVersion.indexOf("MSIE") > -1),
    ieVer = parseFloat(navigator.appVersion.split("MSIE")[1]),
    isWin = (navigator.appVersion.indexOf("Windows") > -1),
    isMac = (navigator.appVersion.indexOf("Mac") > -1);

// Variables that will later contain version information
var fullVersion, majorVersion, minorVersion;

if(navPlugins || (isIE && isMac && ieVer >= 5)) {	// Less than IE5 on the MAC have no plugins object
	var plugin = navigator.plugins["Shockwave Flash"];
	if(plugin){
		var pluginDescription = plugin.description.split(" ");
		for(var i=0; i<pluginDescription.length; i++) {
			if(!isNaN(parseInt(pluginDescription[i]))) {
				majorVersion = parseInt(pluginDescription[i]);
				minorVersion = parseInt(plugin.description.split("r")[1]);
				break;
			}
		}
		if(majorVersion >= targetMajor && minorVersion >= targetMinor) hasFlash = true;
	}else{
		hasFlash = false;	
	}
} else if(isWin && isIE) {
	document.write('<script language=VBScript\>\n');
	document.write('function isHere(chk)\n');
	document.write('  isHere = false\n');
	document.write('  on error resume next\n');
	document.write('  if ScriptEngineMajorVersion > 1 then\n');
	document.write('    isHere = IsObject(CreateObject(chk))\n');
	document.write('  end if\n');
	document.write('end function\n');
	document.write('</script\>');

	try {
		hasActiveX = isHere("msxml");
		if(!hasActiveX) hasActiveX = isHere("Microsoft.ActiveXPlugin.1");
	} catch(e) {
		hasActiveX = false;
	}

	if(hasActiveX) {
		for(var i=2; i<=targetMajor; i++) {
			if(isHere("ShockwaveFlash.ShockwaveFlash."+i)) majorVersion = i;
		}
	}

	minorVersion = 0;	// You cannot detect minor Flash plugin versions in IE on the PC, so cabversion specifies it in the <object> tag
	if(majorVersion >= targetMajor) hasFlash = true;

}

fullVersion = majorVersion+",0,"+minorVersion+",0";	// Can't be trusted in IE on the PC due to the minorVersion problem

if(hasActiveX || navPlugins){
	if(!hasFlash){
		$('.noflash').removeClass('hide');
	}else{
		// Nothing for now.
	}
}