var flashVersion = "Flash_Not_Installed";
var actualVersion = 0;
var maxVersion = 10; //remember to change when a new player is realeased
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i) {
	   	if (isNaN(parseInt(words[i])))
	    continue;
		actualVersion = parseInt(words[i]);
	}
} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
	for (var j = 2; j <= maxVersion; ++j) {
	    document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	    document.write('on error resume next \n');
		document.write('MM_FlashCanPlay = false \n');
		document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & j)))\n');
		document.write('If MM_FlashCanPlay Then actualVersion = j \n');
		document.write('</SCR' + 'IPT\> \n');
	}
}

//detect javascript version in use
var jsVersion = 1.0;
document.write('<script language="JavaScript1.1"> jsVersion = 1.1; </script>');
document.write('<script language="JavaScript1.2"> jsVersion = 1.2; </script>');
document.write('<script language="JavaScript1.3"> jsVersion = 1.3; </script>');
document.write('<script language="JavaScript1.4"> jsVersion = 1.4; </script>');

//redirection script
function flashRedirector() {
	if (useRedirect) {
		// If the user has a new enough version...
		if (actualVersion >= requiredVersion) {
			// ...then we'll redirect them to the flash page, unless we've
			// been told not to redirect.
			// Need javascript1.1 to do location.replace
			if(jsVersion > 1.0) {
				// It's safe to use replace(). Good...we won't break the back button.
				window.location.replace(flashPage);  
			} else {
				// JavaScript version is too old, so use .location to load
				// the flash page.
				window.location = flashPage;
			}
		} else {  
			// The user doesn't have a new enough version.
			// Do the same .replace() call only if js1.1+ is available.
			if(jsVersion > 1.0) {
				window.location.replace((actualVersion >= 2) ? upgradePage : noFlashPage);
			} else {
				window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
			}
		}
	}
}

flashRedirector()
