// Detect Macromedia Flash Plug-In - Part B
// NOTE: This part should be included as "JavaScript" or "JavaScript1.0".

// Detect Flash.
function detectFlash() {
 // Detect for Netscape Navigator
 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;
  }
 }

 // Set actualVersion; highest for WebTV is 3.
 if (navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;
 else for (var count = 2; count <= maxVersion; ++count)
  if (eval("flash" + count + "Installed") == true)
   actualVersion = count; 

 // Set hasRightversion.
 hasRightVersion = (actualVersion >= requiredVersion);

 // Redirect if necessary.
 if (useRedirect)
  redirectTimer = window.setTimeout("redirect();", 100);

 return true;
}

// Redirect to a new page if right version is not available.
function redirect () {
 window.clearTimeout(redirectTimer);
 if (!hasRightVersion) {
  if (jsVersion > 1.0)
   window.location.replace((actualVersion > 0) ? upgradePage : noFlashPage);
  else
   window.location = (actualVersion > 0) ? upgradePage : noFlashPage;
 }
 return true;
}

detectFlash();