
  // Browser detection code.
  var startTime=new Date();
  
  var strNetscapeVersion = "0.0";
  var strMsieVersion     = "0.0";
  
  var agt=navigator.userAgent.toLowerCase();
  
  var is_major=parseInt(navigator.appVersion);
  var is_minor=parseFloat(navigator.appVersion);
  var is_nav     = ((agt.indexOf('mozilla')    != -1) && 
                    (agt.indexOf('spoofer')    == -1) && 
                    (agt.indexOf('compatible') == -1) && 
                    (agt.indexOf('opera')      == -1) && 
                    (agt.indexOf('netscape')   == -1) &&              
                    (agt.indexOf('webtv')      == -1)
                   );
  var is_ie      = (agt.indexOf("msie")        != -1);
  var is_NS6     = (agt.indexOf("netscape")    != -1);
  var is_aol     = (agt.indexOf("aol")         != -1);
  var is_opera   = (agt.indexOf("opera")       != -1);
  var is_webtv   = (agt.indexOf("webtv")       != -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_nav5    = (is_nav && (is_major==5));
  var is_nav5up  = (is_nav && (is_major>=5));

  var is_nav6    = (is_nav && (is_major == 5) && (agt.indexOf('rv:0') > -1));
  var is_nav6up  = (is_nav && (is_major >= 5));
  var is_gecko   = (agt.indexOf('gecko') != -1);

  var is_opera6   = false;
  var is_opera7   = false;
  var is_opera6up = false;
  var is_opera7up = false;

  var is_firefox  = (is_nav && (agt.indexOf("firefox") != -1));

  if(is_opera)
  { iIndex = agt.indexOf("opera");
    if(iIndex != -1)
    { strOperaVersion = agt.substring(iIndex + 6, 9+iIndex);
	  if(strOperaVersion >= 6.0) { is_opera6 = true; is_opera6up = true; };
      if(strOperaVersion >= 7.0) { is_opera7 = true; is_opera6up = is_opera7up = true;};
    };
  };
  
  if(is_NS6)
  { iIndex = agt.indexOf("netscape");
    strNetscapeVersion = agt.substring(iIndex + 8, agt.length);
    iIndex = strNetscapeVersion.indexOf("/");
    strNetscapeVersion = strNetscapeVersion.substring(iIndex + 1, strNetscapeVersion.length);
  };
  
  var is_ie3   = (is_ie && (is_major<4));
  var is_ie4   = false;
  var is_ie5   = false;
  var is_ie6   = false;
  var is_ie4up = false;
  var is_ie5up = false;
  var is_ie6up = false;
  var is_ie7up = false;
  
  if(is_ie)
  { iIndex = agt.indexOf("msie");
    if(iIndex != -1)
    { strMsieVersion = agt.substring(iIndex + 5, 8+iIndex);
      if(strMsieVersion >= 4.0) { is_ie4=true; is_ie4up=true; };
      if(strMsieVersion >= 5.0) { is_ie5=true; is_ie4up=is_ie5up=true; };
      if(strMsieVersion >= 6.0) { is_ie6=true; is_ie4up=is_ie5up=is_ie6up=true; };
      if(strMsieVersion >= 7.0) { is_ie7=true; is_ie4up=is_ie5up=is_ie6up=is_ie7up=true; };
    };
  };

  var is_aol3 = (is_aol && is_ie3);
  var is_aol4 = (is_aol && is_ie4);
  var is_aol5 = (agt.indexOf("aol 5") != -1);
  var is_aol6 = (agt.indexOf("aol 6") != -1);

  var is_getElementById       = (document.getElementById)       ? true : false; // 001121-abk
  var is_getElementsByTagName = (document.getElementsByTagName) ? true : false; // 001127-abk
  var is_documentElement      = (document.documentElement)      ? true : false; // 001121-abk

  // *** PLATFORM ***
  var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );

  // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4" on all Win32, 
  //       so you can't distinguish between Win95 and WinNT.
  var is_win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));

  // is this a 16 bit compiled version?  
  var is_win16 = ((agt.indexOf("win16")!=-1) || (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("windows 16-bit")!=-1) );
  var is_win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) || (agt.indexOf("windows 16-bit")!=-1));

  // NOTE: Reliable detection of Win98 may not be possible. It appears that:
  //       - On Nav 4.x and before you'll get plain "Windows" in userAgent.
  //       - On Mercury client, the 32-bit version will return "Win98", but
  //         the 16-bit version running on Win98 will still return "Win95".
  var is_win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
  var is_winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
  var is_win32 = (is_win95 || is_winnt || is_win98 || ((is_major >= 4) && (navigator.platform == "Win32")) || (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));
  var is_os2   = ((agt.indexOf("os/2")!=-1) ||(navigator.appVersion.indexOf("OS/2")!=-1) || (agt.indexOf("ibm-webexplorer")!=-1));
  var is_mac    = (agt.indexOf("mac")!=-1);
  var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) || (agt.indexOf("68000")!=-1)));
  var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) || (agt.indexOf("powerpc")!=-1)));
  var is_sun   = (agt.indexOf("sunos")!=-1);
  var is_sun4  = (agt.indexOf("sunos 4")!=-1);
  var is_sun5  = (agt.indexOf("sunos 5")!=-1);
  var is_suni86= (is_sun && (agt.indexOf("i86")!=-1));
  var is_irix  = (agt.indexOf("irix") !=-1);    // SGI
  var is_irix5 = (agt.indexOf("irix 5") !=-1);
  var is_irix6 = ((agt.indexOf("irix 6") !=-1) || (agt.indexOf("irix6") !=-1));
  var is_hpux  = (agt.indexOf("hp-ux")!=-1);
  var is_hpux9 = (is_hpux && (agt.indexOf("09.")!=-1));
  var is_hpux10= (is_hpux && (agt.indexOf("10.")!=-1));
  var is_aix   = (agt.indexOf("aix") !=-1);      // IBM
  var is_aix1  = (agt.indexOf("aix 1") !=-1);
  var is_aix2  = (agt.indexOf("aix 2") !=-1);
  var is_aix3  = (agt.indexOf("aix 3") !=-1);
  var is_aix4  = (agt.indexOf("aix 4") !=-1);
  var is_linux = (agt.indexOf("inux")!=-1);
  var is_sco   = (agt.indexOf("sco")!=-1) || (agt.indexOf("unix_sv")!=-1);
  var is_unixware = (agt.indexOf("unix_system_v")!=-1);
  var is_mpras    = (agt.indexOf("ncr")!=-1);
  var is_reliant  = (agt.indexOf("reliantunix")!=-1);
  var is_dec   = ((agt.indexOf("dec")!=-1) || (agt.indexOf("osf1")!=-1) || (agt.indexOf("dec_alpha")!=-1) || (agt.indexOf("alphaserver")!=-1) || (agt.indexOf("ultrix")!=-1) || (agt.indexOf("alphastation")!=-1));
  var is_sinix = (agt.indexOf("sinix")!=-1);
  var is_freebsd = (agt.indexOf("freebsd")!=-1);
  var is_bsd = (agt.indexOf("bsd")!=-1);
  var is_unix  = ((agt.indexOf("x11")!=-1) || is_sun || is_irix || is_hpux || is_sco ||is_unixware || is_mpras || is_reliant || is_dec || is_sinix || is_aix || is_linux || is_bsd || is_freebsd);
  var is_vms   = ((agt.indexOf("vax")!=-1) || (agt.indexOf("openvms")!=-1));

  // additional checks, abk
  var is_anchors = (document.anchors) ? "true":"false";
  var is_regexp  = (window.RegExp) ? "true":"false";
  var is_option  = (window.Option) ? "true":"false";
  var is_all = (document.all) ? "true":"false";
  
  // cookies - 990624 - abk
  document.cookie = "cookies=true";
  var is_cookie = (document.cookie) ? "true" : "false";
  var is_images = (document.images) ? "true":"false";
  var is_layers = (document.layers) ? "true":"false"; // gecko m7 bug?

  // new doc obj tests 990624-abk
  var is_forms = (document.forms) ? "true" : "false";
  var is_links = (document.links) ? "true" : "false";
  var is_frames = (window.frames) ? "true" : "false";
  var is_screen = (window.screen) ? "true" : "false";

  // java
  var is_java = (navigator.javaEnabled());

  if(! is_nav && !is_ie && !is_NS6 && !is_opera)
  { alert("This html page requires that you use Netscape Navigator version >= 4.05,\nMicrosoft Internet Explorer version >= 4\n, or Opera >=6.0\n"+agt+"!"); };

  varDate = new Date();
  varDateString = (varDate.getMonth()+1) + "/" + varDate.getDate() + "/" + varDate.getYear();


  // Frame Navigation Functions.
  function GetFrameDocument(objFrame)
  { if(is_ie) { return(objFrame.document); };
    if(is_nav) { return(objFrame.contentDocument); };
    return(null);
  };

  function GetFrameCount(objDoc)
  { if(is_ie) { return(objDoc.frames.length); };
    if(is_nav) { return(objDoc.getElementsByTagName("frame").length); };
    return(null);
  };
   
  function GetFramesArray(objDoc)
  { if(is_ie)  { return(objDoc.frames); };
    if(is_nav) 
    { if(objDoc.document)
      { return(objDoc.document.getElementsByTagName("frame")); }
      else { return(objDoc.getElementsByTagName("frame")); };
    };
    return(null);
  };

  function RecurseFrames(strFrameName, objDocument)
  { if(objDocument == null)                 { alert("objDocument is NULL");          return; };
 // if(objDocument.document == null)        { alert("objDocument.document is NULL"); return; };

    objFrames = GetFramesArray(objDocument);
    // alert("1-Frames Array: " + objFrames);
    if(objFrames == null) 
    { // alert("objDocument.document.frames is NULL."); 
      return(null); 
    };
    iFrameCount = objFrames.length;
    for(x = 0 ; x < iFrameCount ; x++)
    { // alert("Found Frame: " + objFrames[x].name);
      if(objFrames[x].name == strFrameName)              // Is name the same?
      { // alert("Success");
        return(GetFrameDocument(objFrames[x]));          // Return if proper frame was found.
      };

      objOneDoc = GetFrameDocument(objFrames[x]);     
      iLength   = GetFrameCount(objOneDoc);              // Get the number of child frames in the document.
      if(iLength > 0)                                    // Were there any child frames?
      { // alert("2-FrameCount: " + iLength + "\n" + objFrames[x]);
        objFound = null;
        if(is_ie)  { objFound = RecurseFrames(strFrameName, objFrames[x]); };
        if(is_nav) { objFound = RecurseFrames(strFrameName, GetFrameDocument(objFrames[x])); };
        if(objFound != null) 
        { if(is_ie)  { return(objFound); };
          if(is_nav) { return(GetFrameDocument(objFrames[x])); };
        };
      };
    };
    return(null);
  };

  function GetTopmostDocument()
  { objLast = self;
    obj = null;
    iLoops = 0;

    if(is_ie || is_firefox)
    { while((objLast != null)  && iLoops < 10)
      { iLoops++;
        try
        { // alert(objLast.location.href);
          obj = objLast.parent; 
          strURL = obj.location.href;
          if(obj == objLast) { break; };
          objLast = obj;
        }
        catch(e)
        { break; }; // alert("Error");
      };
      return(objLast);
    }
    else
    { return(top); };
  };




