function detectFlash() {  
  if (navigator.plugins) {
    if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
      var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
      flash2Installed = flashVersion == 2;
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion == 6;
      flash7Installed = flashVersion >= 7;
    }
  }
  
  // Loop through all versions we're checking, and set actualVersion to highest detected version.
  for (var i = 2; i <= maxVersion; i++) {  
    if (eval("flash" + i + "Installed") == true) actualVersion = i;
  }
  
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;  
  
  // alert("version detected: " + actualVersion);
  // we're finished getting the version. time to take the appropriate action
  if (actualVersion >= requiredVersion) {
    if (useRedirect) {
      if(jsVersion > 1.0) {
        window.location.replace(flashPage);  
      } else {
        window.location = flashPage;
      }
    }
    hasRightVersion = true;                
  } else {  
    if (useRedirect) {
      if(jsVersion > 1.0) {
        window.location.replace((actualVersion >= 2) ? upgradePage : noFlashPage);
      } else {
        window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
      }
    }
  }
  
  	if (hasRightVersion == true && requiresTransparency == true) {
		hasRightVersion = checkBrowserTransparencySupport();
	}
}

// this function overrides Moock Flash detection if Flash movie requires transparency support
// must be turned on by setting requiresTransparency = true in flashDetect1.js
function checkBrowserTransparencySupport()
{
	var bSupported = true;
	var sBrowserName = navigator.userAgent;
	var sBrowserVersion = navigator.appVersion;
	var iBrowserVersion = parseInt(sBrowserVersion.charAt(0));
	var aUnsupportedBrowsers = [
		["Opera","7"], 
		["Netscape6","5"]
	]

	for (i = 0; i < aUnsupportedBrowsers.length; i++) {
		if (sBrowserName.indexOf(aUnsupportedBrowsers[i][0]) != -1 && iBrowserVersion <= aUnsupportedBrowsers[i][1]) {
			bSupported = false;
		}
	}
	
	return bSupported;
}

detectFlash();
