<!--
// ***********************************************
// ***** MASTER CLIENT SNIFFER SCRIPT BEGINS *****
// ***********************************************

// Flash Detect System globals
var hasFlashInstalled = false;  // boolean. true if flash is found (any version)
var requiredVersion = 7;        // Version the user needs to view site (max 9, min 2)
var useRedirect = false;        // Flag indicating whether or not to redirect to a separate page.
var flash2Installed = false;    // boolean. true if flash 2 is installed
var flash3Installed = false;    // boolean. true if flash 3 is installed
var flash4Installed = false;    // boolean. true if flash 4 is installed
var flash5Installed = false;    // boolean. true if flash 5 is installed
var flash6Installed = false;    // boolean. true if flash 6 is installed
var flash7Installed = false;    // boolean. true if flash 7 is installed
var flash8Installed = false;    // boolean. true if flash 8 is installed
var flash9Installed = false;    // boolean. true if flash 9 is installed
var maxVersion = 9;             // highest version we can actually detect
var actualVersion = 0;          // flash version the user really has
var hasRightVersion = false;    // boolean. true if it's safe to embed the flash movie in the page

// Only set next three vars if useRedirect is true...
var flashPage   = "movie.html"    // The location of the flash movie page
var noFlashPage = "noflash.html"  // Page displayed if the user doesn't have the
                                  // plugin or we can't detect it.
var upgradePage = "upgrade.html"  // Page displayed if we detect an old plugin
var jsVersion = 1.0;              // the version of javascript supported

// convert all characters to lowercase to simplify testing 
var agt=navigator.userAgent.toLowerCase(); 

// set the Platform type
if (agt.indexOf("mac") != -1){
	var	is_mac = true;
	var is_windows = false;
	var is_linux   = false;
}
else if (agt.indexOf("linux") != -1){
	var	is_mac = false;
	var is_windows = false;
	var is_linux   = true;
}
else {
	var	is_mac = false;
	var is_windows = true;
	var is_linux   = false;
}

// Note: On IE5, these return 4, so use is_ie5up to detect IE5.
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

// Note: Opera and WebTV spoof Navigator.  We do strict client detection.
// If you want to allow spoofing, take out the tests for opera and webtv.
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
            && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav2 = (is_nav && (is_major == 2));
var is_nav3 = (is_nav && (is_major == 3));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_navonly = (is_nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) );
var is_nav6 = (is_nav && (is_major == 5));
var is_nav6up = (is_nav && (is_major >= 5));
var is_gecko = (agt.indexOf('gecko') != -1);

var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3    = (is_ie && (is_major < 4));
var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
var is_ie4up  = (is_ie && (is_major >= 4));
var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);

// ***********************************************
// *****  MASTER CLIENT SNIFFER SCRIPT ENDS  *****
// ***********************************************

// ***********************************************
// ********      DETECT FOR PLUG-INS      ********
// ***********************************************

// initialize global variables
var detectableWithVB = false;
var pluginFound = false;

// function that can be used to redirect users
function goURL(daURL) {
    // if the browser can do it, use replace to preserve back button
    if(jsVersion > 1.0) {
	window.location.replace(daURL);
    } else {
	window.location = daURL;
    }
    return;
}

function redirectCheck(pluginFound, redirectURL, redirectIfFound) {
    // check for redirection
    if( redirectURL && ((pluginFound && redirectIfFound) || 
	(!pluginFound && !redirectIfFound)) ) {
	// go away
	goURL(redirectURL);
	return pluginFound;
    } else {
	// stay here and return result of plugin detection
	return pluginFound;
    }	
}

function canDetectPlugins() {
    if( detectableWithVB || (navigator.plugins && navigator.plugins.length > 0) ) {
	return true;
    } else {
	return false;
    }
}

function detectFlash(redirectURL, redirectIfFound) {

 try {
  pluginFound = detectPlugin('Shockwave','Flash'); 
  
  // if not found, try to detect with VisualBasic
  if(!pluginFound && detectableWithVB) {
	pluginFound = detectActiveXControl('ShockwaveFlash.ShockwaveFlash.1');
  }
    
  // If navigator.plugins exists...
  if (navigator.plugins) {
    // ...then check for flash 2 or flash 3+.
    if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {     
      // Set convenient references to flash 2 and the plugin description.
      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;

      // DEBUGGING: uncomment next line to see the actual description.
      // alert("Flash plugin description: " + flashDescription);
      
      // A flash plugin-description looks like this: Shockwave Flash 4.0 r5
      var flashVersion = parseInt(flashDescription.substring(16));

      // We found the version, now set appropriate version flags.
      flash2Installed = flashVersion == 2;    
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion == 6;
      flash7Installed = flashVersion == 7;
      flash8Installed = flashVersion == 8;
      flash9Installed = flashVersion >= 9;
    }
  }
  
  // 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 we're on msntv (formerly webtv), the version supported is 4 (as of January 1, 2004).
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 4;  
  
  // DEBUGGING: uncomment next line to display flash version
  // alert("version detected: " + actualVersion);

  // 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.
    if (useRedirect) {
      goURL(flashPage);
    }
    
    // If we got here, we didn't redirect. So we make a note that we should write out the object/embed tags later.
    hasRightVersion = true;                
  } else {  
    // The user doesn't have a new enough version. If the redirection option is on, load the appropriate alternate page.
    if (useRedirect) {
      goURL((actualVersion >= 2) ? upgradePage : noFlashPage);
    }
  }
  
  // check for redirection
  return redirectCheck(pluginFound, redirectURL, redirectIfFound);
 }
 catch(e)
 {
   return redirectCheck(pluginFound, redirectURL, redirectIfFound);
 }
}

function detectDirector(redirectURL, redirectIfFound) { 
    pluginFound = detectPlugin('Shockwave','Director'); 
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	pluginFound = detectActiveXControl('SWCtl.SWCtl.1');
    }
    // check for redirection
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectQuickTime(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('QuickTime');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	pluginFound = detectQuickTimeActiveXControl();
    }
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectReal(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('RealPlayer');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	pluginFound = (detectActiveXControl('rmocx.RealPlayer G2 Control') ||
		       detectActiveXControl('RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)') ||
		       detectActiveXControl('RealVideo.RealVideo(tm) ActiveX Control (32-bit)'));
    }	
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectWindowsMedia(redirectURL, redirectIfFound) {
    pluginFound = detectPlugin('Windows Media');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	pluginFound = detectActiveXControl('MediaPlayer.MediaPlayer.1');
    }
    return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}

function detectPlugin() {
    // allow for multiple checks in a single pass
    var daPlugins = detectPlugin.arguments;
    // consider pluginFound to be false until proven true
    var pluginFound = false;
    // if plugins array is there and not fake
    if (navigator.plugins && navigator.plugins.length > 0) {
	var pluginsArrayLength = navigator.plugins.length;
	// for each plugin...
	for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
	    // loop through all desired names and check each against the current plugin name
	    var numFound = 0;
	    for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) {
		// if desired plugin name is found in either plugin name or description
		if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) || 
		    (navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
		    // this name was found
		    numFound++;
		}   
	    }
	    // now that we have checked all the required names against this one plugin,
	    // if the number we found matches the total number provided then we were successful
	    if(numFound == daPlugins.length) {
		pluginFound = true;
		// if we've found the plugin, we can stop looking through at the rest of the plugins
		break;
	    }
	}
    }
    return pluginFound;
} // detectPlugin

// Here we write out the VBScript block for MSIE Windows
if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
    document.writeln('<script language="VBscript">');

    document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
    document.writeln('detectableWithVB = False');
    document.writeln('If ScriptEngineMajorVersion >= 2 then');
    document.writeln('  detectableWithVB = True');
    document.writeln('End If');

    document.writeln('\'this next function will detect most plugins');
    document.writeln('Function detectActiveXControl(activeXControlName)');
    document.writeln('  on error resume next');
    document.writeln('  detectActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('\'and the following function handles QuickTime');
    document.writeln('Function detectQuickTimeActiveXControl()');
    document.writeln('  on error resume next');
    document.writeln('  detectQuickTimeActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('    detectQuickTimeActiveXControl = False');
    document.writeln('    hasQuickTimeChecker = false');
    document.writeln('    Set hasQuickTimeChecker = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")');
    document.writeln('    If IsObject(hasQuickTimeChecker) Then');
    document.writeln('      If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then ');
    document.writeln('        detectQuickTimeActiveXControl = True');
    document.writeln('      End If');
    document.writeln('    End If');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('If detectableWithVB Then');
    document.writeln('   flash2Installed = detectActiveXControl("ShockwaveFlash.ShockwaveFlash.2") ');
    document.writeln('   flash3Installed = detectActiveXControl("ShockwaveFlash.ShockwaveFlash.3") ');
    document.writeln('   flash4Installed = detectActiveXControl("ShockwaveFlash.ShockwaveFlash.4") ');
    document.writeln('   flash5Installed = detectActiveXControl("ShockwaveFlash.ShockwaveFlash.5") ');  
    document.writeln('   flash6Installed = detectActiveXControl("ShockwaveFlash.ShockwaveFlash.6") ');  
    document.writeln('   flash7Installed = detectActiveXControl("ShockwaveFlash.ShockwaveFlash.7") ');
    document.writeln('   flash8Installed = detectActiveXControl("ShockwaveFlash.ShockwaveFlash.8") ');
    document.writeln('   flash9Installed = detectActiveXControl("ShockwaveFlash.ShockwaveFlash.9") ');
    document.writeln('End If');

    document.writeln('</scr' + 'ipt>'); // break up end tag so it doesn't end our script
}

// ***********************************************
// ********    DETECT FOR PLUG-INS ENDS   ********
// ***********************************************


// ***********************************************
// *****  REDIRECT FOR UNSUPPORTED BROWSERS  *****
// ***********************************************
if((is_nav4)&&(window.location.href.indexOf("compatibility") == -1)) { goURL("/compatibility.aspx") };
if((is_ie4)&&(window.location.href.indexOf("compatibility") == -1)) { goURL("/compatibility.aspx") };
if((is_ie3)&&(window.location.href.indexOf("compatibility") == -1)) { goURL("/compatibility.aspx") };
if((is_nav2)&&(window.location.href.indexOf("compatibility") == -1)) { goURL("/compatibility.aspx") };
if((is_nav3)&&(window.location.href.indexOf("compatibility") == -1)) { goURL("/compatibility.aspx") };
//if(is_nav && is_mac){document.write('<META HTTP-EQUIV="cache-control" CONTENT="no-cache"><META HTTP-EQUIV="Pragma" CONTENT="no-cache"><META HTTP-EQUIV="Expires" CONTENT="0">');


// ***********************************************
// *******  DETECT FOR PLUG-INS REQUIRED  ********
// ***********************************************
if(canDetectPlugins()) {
	// Detect if Flash is even installed and get the result (use variable below in other scripts)
	hasFlashInstalled = detectFlash()
}

//-->