// look for query string
var urlParam = location.search.substring(1, location.search.length);

var msg="";
	msg+='<div align="center">';
	msg+='<img src="images/spacer.gif" width=100 height=48 border=0><br>';
	msg+='<a href="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" target="newWIn"><img src="images/bttn_getflash.gif" width=211 height=30 border=0></a><br>';
	msg+='<img src="images/spacer.gif" width=100 height=21 border=0><br>';
	msg+='<a href="index.html?play"><img src="images/bttn_play.gif" width=200 height=32 border=0></a><br>';
	msg+='<img src="images/spacer.gif" width=100 height=48 border=0><br>';
	msg+='</div>';
var noFlashMsg = msg;

// FLASH DETECTION
var requiredVersion = 6;   		// Version needed to view site
var flash2Installed = false;    // boolean. true if flash 2
var flash3Installed = false;    // boolean. true if flash 3
var flash4Installed = false;    // boolean. true if flash 4
var flash5Installed = false;    // boolean. true if flash 5
var flash6Installed = false;    // boolean. true if flash 6
var maxVersion = 6;             // highest detectable version
var userVersion = 0;          // version the user has
var hasRightVersion = false;    // boolean. true if user has the right version

var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if ie
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // true if windows

if(isIE && isWin){
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
  document.write('</SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
}

function detectFlash() {
  if (navigator.plugins) {
    if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
      // Flash detected, now which version
      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;
    }
  }

  for (var i = 2; i <= maxVersion; i++) {
    if (eval("flash" + i + "Installed") == true) userVersion = i;
  }

  if(navigator.userAgent.indexOf("WebTV") != -1) userVersion = 3;

  // If user has right version...
  if (userVersion >= requiredVersion) {
  	hasRightVersion = true;
  }
  if (urlParam == "play") {
  	hasRightVersion = true;
  }
}

detectFlash();  // call detector after it's loaded.
