<!--
// -----------------------------------------------------------------------------
// THE FOLLOWING CODE CAME FROM THE MACROMEDIA DEVELOPER SITE SAMPLE CODE:
// -----------------------------------------------------------------------------

// Globals
// The version of ShockWave the user's machine has installed.
var shockwaveVer;
var MAX_VER_NUM = 10;
var hasRightDirectorVersion;

//***************************
// A few variables to help figure out what platform we're on

var ie  = (navigator.appName.toLowerCase().indexOf("microsoft") != -1);
var ns  = (navigator.appName.toLowerCase().indexOf("netscape") != -1);
var win = (navigator.platform.toLowerCase().indexOf("win") != -1);
var mac = (navigator.platform.toLowerCase().indexOf("mac") != -1);
var browserVer = parseFloat(ie ? navigator.appVersion.substring(navigator.appVersion.toLowerCase().indexOf("msie") + 4) : navigator.appVersion);

// -----------------------------------------------------------------------------
// THIS SECTION OF CODE CHECKS FOR THE ACTIVE-X CONTROL IN IE BROWSERS:
// -----------------------------------------------------------------------------
//***************************
// For detecting the ActiveX for ie win.
// Requires vbscript function VBGetShockwaveVer() to be included on
// the page to do the actual checking. (this func is in the eCOW_inc_dynamic_Director_Check.asp include file)
// Returns version found or 0.0.
// This function can return a boolean or a floating point value.
// If you supply a reqVer value (number) it will return true or false
// depending on if that version or higher was found.
// If you don't supply a parameter it will return the found version number.

function shockwaveDetectAxVer(reqVer) {
  // this function returns a floating point value which should be the version of the Shockwave control or 0.0
  // this function should only be called from Internet Explorer for Windows

  if (ie && win) {
    // loop backwards through the versions until we get a bite
    for (i=MAX_VER_NUM;i>0;i--) {
      versionString = VBGetShockwaveVer(i);
      if (versionString != "0.0") {
        // if we get 1.0 we assume it is actually 6.0
        versionNum = (versionString == "1.0" ? 6.0 : parseFloat(versionString))
        return (reqVer ? versionNum >= reqVer : versionNum);
      }
    }
  }
  return (reqVer ? false : 0.0);
}

// -----------------------------------------------------------------------------
// THIS SECTION OF CODE CHECKS FOR THE PLUGIN IN NETSCAPE BROWSERS:
// -----------------------------------------------------------------------------

//***************************
// For detecting the shockwave plugin for Netscape.
// This function can return a boolean or a floating point value.
// If you supply a reqVer value (number) it will return true or false
// depending on if that version or higher was found.
// If you don't supply a parameter it will return the found version number.

function shockwaveDetectNsVer(reqVer) {
  // This function returns a floating point value which should be the version of the Shockwave plugin or 0.0
  // This function only returns useful information if called from Netscape or IE Mac 5.0+

  if (!navigator.plugins) return (reqVer ? false : 0.0); // IE Mac 4.5 and lower don't have a plugins array.

  // Set these local variables to avoid the Netscape 4 crashing bug.
  thearray = navigator.plugins
  arraylen = thearray.length

  // Step through each plugin in the array.
  for (i=0; i < arraylen; i++) {
    // Set these local variables to avoid the Netscape 4 crashing bug.
    theplugin = thearray[i]
    thename   = theplugin.name
    thedesc   = theplugin.description

    // If the plugin is Shockwave...
    if (thename.indexOf("Shockwave") != -1 && thename.indexOf("Director") != -1) {
      // ...extract the version information
      versionString = thedesc.substring(thedesc.indexOf("version ") + 8);
      if (versionString.indexOf(".") > 0) {
        versionMajor = versionString.substring(0,versionString.indexOf("."));
        versionMinor = versionString.substring(versionString.indexOf(".") + 1);
        if (versionMinor.indexOf(".") > 0)
          versionMinor = versionMinor.substring(0,versionString.indexOf("."))
                         + versionMinor.substring(versionMinor.indexOf(".") + 1);   
        versionString = parseInt(versionMajor) + "." + versionMinor;
      }
      return (reqVer ? (parseFloat(versionString) >= reqVer) : parseFloat(versionString));
    } 
  }
  return (reqVer ? false : 0.0);
}

// -----------------------------------------------------------------------------
// THIS SECTION OF CODE SEES IF WE'RE ON AN OLDER BROWSER THAT CAN'T DETECT PLUGINS:
// -----------------------------------------------------------------------------

//***************************
// Simple browser checking, returns true if using a recommended browser
// REQUIRED browser is actually lower in most cases.

function shockwaveCheckBrowser() {
  // Recommended minimum browser versions for shockwave content
  // this can be skipped by setting the swDetect cookie to "ignore"
  // this will make the code react like you are using a supported browser 
  // no matter what the truth may be.
  
  if (ie && win) return (browserVer >= 4.0) // Works in lower versions, but detection difficult.
  if (ie && mac) return (browserVer >= 5.0) // Works in lower versions, but can't do detection.
  if (ns && win) return (browserVer >= 3.0)
  if (ns && mac) return (browserVer >= 3.0)
  
  return false;
}

// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
if (!shockwaveCheckBrowser()) {
	// can't detect Shockwave Director plugin with user's old browser
	//alert("can't detect Shockwave Director plugin with user's old browser");
	shockwaveVer = 0;
} else {
	if (ie && win) {
		// Windows IE, detect the ActiveX control:
		shockwaveVer = shockwaveDetectAxVer();
	} else if (ns) {
		// Detect the Netscape plugin
		shockwaveVer = shockwaveDetectNsVer();
	} else {
		// Couldn't detect it, so assume not there for now.
		shockwaveVer = 0;
	}
}
//alert("in MM_Director_Detect.js: shockwaveVer =" + shockwaveVer);

function showNeedPlugin()
{
	openNewWindow('/h1needPlug-in.htm','thewin','height=320,width=262,toolbar=no,scrollbars=no')
} 

function setShockwaveVerInASPSession(shockwaveVer)
{
	 var httpRequest; 
	 if (typeof XMLHttpRequest != 'undefined') { 
	 
	   httpRequest = new XMLHttpRequest(); 
	 } 
	 else if (typeof ActiveXObject != 'undefined') { 
	   try { 
		 httpRequest = new ActiveXObject('Microsoft.XMLHTTP'); 
	   } 
	   catch (e) { 
		 httpRequest = null; 
	   } 
	 } 
	 if (httpRequest) { 
	   httpRequest.open('GET', '/ecow_autoSetDirector.asp?shockwaveVer=' + shockwaveVer, true); 
	   httpRequest.send(null); 
	 } 
}
// -->
