// JavaScript Document
<!-- hide JavaScript from non-JavaScript browsers

// Everything you always wanted to know about your JavaScript client
// but were afraid to ask. Creates "is_" variables indicating:
// (1) browser vendor:
//     is_nav, is_ie, is_opera
// (2) browser version number:
//     is_major (integer indicating major version number: 2, 3, 4 ...)
//     is_minor (float   indicating full  version number: 2.02, 3.01, 4.04 ...)
// (3) browser vendor AND major version number
//     is_nav2, is_nav3, is_nav4, is_nav4up, is_nav5, is_nav5up, is_ie3, is_ie4, is_ie4up, is_ie5, is_ie5up, is_ie6, is_ie6up
// (4) JavaScript version number:
//     is_js (float indicating full JavaScript version number: 1, 1.1, 1.2 ...)
// (5) OS platform and version:
//     is_win, is_win16, is_win32, is_win31, is_win95, is_winnt, is_win98
//     is_os2
//     is_mac, is_mac68k, is_macppc
//     is_unix
//        is_sun, is_sun4, is_sun5, is_suni86
//        is_irix, is_irix5, is_irix6
//        is_hpux, is_hpux9, is_hpux10
//        is_aix, is_aix1, is_aix2, is_aix3, is_aix4
//        is_linux, is_sco, is_unixware, is_mpras, is_reliant
//        is_dec, is_sinix, is_freebsd, is_bsd
//     is_vms
//
// See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and
// http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html
// for detailed lists of userAgent strings.

//
// Note: you don't want your Nav4 or IE4 code to "turn off" or
// stop working when Nav5 and IE5 (or later) are released, so
// in conditional code forks, use is_nav4up ("Nav4 or greater")
// and is_ie4up ("IE4 or greater") instead of is_nav4 or is_ie4
// to check version in code which you want to work on future
// versions.
//

    // convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase();
    var appVer = navigator.appVersion.toLowerCase();

    // *** BROWSER VERSION ***

    var is_minor = parseFloat(appVer);
    var is_major = parseInt(is_minor);

    // Note: On IE, start of appVersion return 3 or 4
    // which supposedly is the version of Netscape it is compatible with.
    // So we look for the real version further on in the string

    var iePos  = appVer.indexOf('msie');
    if (iePos !=-1) {
       is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)))
       is_major = parseInt(is_minor);
    }

    // Netscape6 is mozilla/5 + Netscape6/6.0!!!
    // Mozilla/5.0 (Windows; U; Win98; en-US; m18) Gecko/20001108 Netscape6/6.0
    var nav6Pos = agt.indexOf('netscape6');
    if (nav6Pos !=-1) {
       is_minor = parseFloat(agt.substring(nav6Pos+10))
       is_major = parseInt(is_minor)
    }

    // Netscape7 is mozilla/5 + Netscape/7.0!!!
    // Mozilla/5.0 (Windows; U; Win98; en-US; m18) Gecko/20020823 Netscape/7.0
    var nav7Pos = agt.indexOf('netscape/7');
    if (nav7Pos !=-1) {
       is_minor = parseFloat(agt.substring(nav7Pos+9))
       is_major = parseInt(is_minor)
    }
    
    // Non-Netscape Mozilla 1.0 or higher
    // Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130
    var check_Moz5 = agt.indexOf('mozilla/5');
    var mozPos = agt.indexOf('rv:');
    if (nav7Pos == -1 && check_Moz5 !=-1 && mozPos !=-1) {
       is_minor = parseFloat(agt.substring(mozPos+3))
       is_major = parseInt(is_minor)
    }

    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

   var is_safari = (agt.indexOf('safari')!=-1 && agt.indexOf('applewebkit')!=-1 );  // new 030616 - aw
   var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                && (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_minor > 4.1));
    var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                          (agt.indexOf("; nav") != -1)) );

    var is_nav7   = (is_nav && is_major==7);    // new 030110 - aw
    var is_nav7up = (is_nav && is_minor >= 7.1) // new 030110 - aw

    /*  var is_nav6 = (is_nav && (agt.indexOf('netscape6') != -1)); // new 001120 - abk
        var is_nav6up = (is_nav && is_getElementById);              // new 001121 - abk
    */
    var is_nav6   = (is_nav && is_major==6);    // new 010118 mhp
    var is_nav6up = (is_nav && is_minor > 6.1) // new 010118 mhp

    var is_nav5   = (is_nav && is_major == 5 && !is_nav6); // checked for ns6
    var is_nav5up = (is_nav && is_minor > 5.1);
    
    var is_moz1  =  (agt.indexOf('mozilla') != -1 && is_major == 1);    // new 030110 - aw
    var is_moz1up = (agt.indexOf('mozilla') != -1 && is_minor > 1.1);  // new 030110 - aw

    var is_ie   = (iePos!=-1);
    var is_ie3  = (is_ie && (is_major < 4));

    var is_ie4   = (is_ie && (is_major == 4));
    var is_ie4up = (is_ie && (is_minor > 4.1));
    
    var is_ie5   = (is_ie && (is_major == 5));
    var is_ie5up = (is_ie && (is_minor > 5.1));
    
    var is_ie6   = (is_ie && (is_major == 6));
    var is_ie6up = (is_ie && (is_minor > 6.1));


    // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
    // or if this is the first browser window opened.  Thus the
    // variables is_aol, is_aol3, and is_aol4 aren't 100% reliable.

    var is_aol   = (agt.indexOf("aol") != -1);
    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_opera = (agt.indexOf("opera") != -1);
    var is_webtv = (agt.indexOf("webtv") != -1);

    // *** JAVASCRIPT VERSION CHECK ***
    // Useful to workaround Nav3 bug in which Nav3
    // loads <SCRIPT LANGUAGE="JavaScript1.2">.
    var is_js;
    if (is_nav2 || is_ie3) is_js = 1.0
    else if (is_nav3 || is_opera) is_js = 1.1
    else if ((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2
    else if ((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3
    else if (is_nav5 && !(is_nav6)) is_js = 1.4
    else if (is_nav6) is_js = 1.5
    else if (is_nav7) is_js = 1.5

    // NOTE: In the future, update this code when newer versions of JS
    // are released. For now, we try to provide some upward compatibility
    // so that future versions of Nav and IE will show they are at
    // *least* JS 1.x capable. Always check for JS version compatibility
    // with > or >=.

    else if (is_nav && (is_major > 5)) is_js = 1.4
    else if (is_ie && (is_major > 5)) is_js = 1.3
    // HACK: no idea for other browsers; always check for JS version with > or >=
    else is_js = 0.0;

    // *** 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());



/*-- HOW TO DEBUG ---------------------------------------------------------------------------------------
   To debug the script, erase the two slashes before the alert, beneath the browser you're debugging for.
   Example: To see if the script is working for Internet Explorer 5.x
            change: // alert("Internet Explorer 5.x...")
            to:     alert("Internet Explorer 5.x...")
   That way, the next time the script is run, a system alert should show.
   If an alert does not show, erase the slashes before the alerts for other types of browsers, until
   you find the one that does show you a system alert when the script is run.
-------------------------------------------------------------------------------------------------------*/

/* --- PLATFORM SNIFFER -------------------------------------------------------------------------------
   Date: April 30, 2003
   Variables: screen_height - A DOM property to determine the client's screen height.

   Output: PLATFORM - *Optional* Can be added to a CSS filename for CLASSifying styles by platform.
           FILENAME - Stores a portion of the CSS filename to be assigned to the client.
-------------------------------------------------------------------------------------------------------*/


if (is_win) {        // WINDOWS

   PLATFORM = "win"
     
   if (is_ie6up) {    // MS Internet Explorer 6.x+ for Windows
    FILENAME = "netscape";
    // alert("Internet Explorer 6.x+ for Windows");
    
  } else if (is_ie6) {    // MS Internet Explorer 6.x for Windows
    FILENAME = "netscape";
    // alert("Internet Explorer 6.x for Windows");
       
  } else if (is_ie5up) {    // MS Internet Explorer 5.x+ for Windows
    FILENAME = "netscape";
    // alert("Internet Explorer 5.x+ for Windows");

  } else if (is_ie5) {    // MS Internet Explorer 5.x for Windows
    FILENAME = "netscape";
    // alert("Internet Explorer 5.x for Windows");

  } else if (is_ie4up) {    // MS Internet Explorer 4.x+ for Windows
    FILENAME = "ie";
    // alert("Internet Explorer 4.x+ for Windows");

  } else if (is_ie4) {    // MS Internet Explorer 4.x for Windows
    FILENAME = "ie";
    // alert("Internet Explorer 4.x for Windows");

  } else if (is_ie3) {    // MS Internet Explorer 3.x for Windows
    FILENAME = "ie";
    // alert("Internet Explorer 3.x for Windows");

  } else if (is_nav7up) {   // Netscape Navigator 7.x+ for Windows
    FILENAME = "netscape";
    // alert("Netscape 7.x+ for Windows");

  } else if (is_nav7) {   // Netscape Navigator 7.x for Windows
    FILENAME = "netscape";
    // alert("Netscape 7.x for Windows");

  } else if (is_nav6up) {    // Netscape Navigator 6.x+ for Windows
    FILENAME = "ie";
    // alert("Netscape 6.x+ for Windows");

  } else if (is_nav6) {    // Netscape Navigator 6.x for Windows
    FILENAME = "ie";
    // alert("Netscape 6.x for Windows");

  } else if (is_nav5up) {    // Netscape Navigator 5.x+ for Windows
    FILENAME = "ie";
    // alert("Netscape 5.x+ for Windows");

  } else if (is_nav5) {    // Netscape Navigator 5.x for Windows
    FILENAME = "ie";
    // alert("Netscape 5.x for Windows");

  } else if (is_nav4up) {    // Netscape Navigator 4.x+ for Windows
    FILENAME = "ie";
    // alert("Netscape 4.x+ for Windows");

  } else if (is_nav4) {    // Netscape Navigator 4.x for Windows
    FILENAME = "ie";
    // alert("Netscape 4.x for Windows");

  } else if (is_nav3) {      // Netscape Navigator 3.x for Windows
    FILENAME = "netscape";
    // alert("Netscape 3.x for Windows");

  } else if (is_moz1up) {      // Mozilla 1.x+ for Windows
    FILENAME = "netscape";
    // alert("Mozilla 1.x+ for Windows");

  } else if (is_moz1) {      // Mozilla 1.0 for Windows
    FILENAME = "netscape";
    // alert("Mozilla 1.0 for Windows");
    
  } else {        // Undefined Windows browser
    FILENAME = "ie";
    // alert("Undefined Browser for Windows");
  }

} else if (is_mac) {      // MACINTOSH

  PLATFORM = "mac"
    
  if (is_ie5up) {    // MS Internet Explorer 5.x+ for Macintosh
    FILENAME = "ie";
    // alert("Internet Explorer 5.x+ for Macintosh");
    
  } else if (is_ie5) {    // MS Internet Explorer 5.x for Macintosh
    FILENAME = "ie";
    // alert("Internet Explorer 5.x for Macintosh");

  } else if (is_ie4up) {    // MS Internet Explorer 4.x+ for Macintosh
    FILENAME = "ie";
    // alert("Internet Explorer 4.x+ for Macintosh");
    
  } else if (is_ie4) {    // MS Internet Explorer 4.x for Macintosh
    FILENAME = "ie";
    // alert("Internet Explorer 4.x for Macintosh");

  } else if (is_ie3) {    // MS Internet Explorer 3.x for Macintosh
    FILENAME = "ie";
    // alert("Internet Explorer 3.x for Macintosh");
	
  } else if (is_safari) {   // Apple Safari for Macintosh OSX
    FILENAME = "ie";
    // alert("Apple Safari for Macintosh OSX");

  } else if (is_nav7up) {   // Netscape Navigator 7.x+ for Macintosh
    FILENAME = "netscape";
    // alert("Netscape 7.x+ for Macintosh");

  } else if (is_nav7) {   // Netscape Navigator 7.x for Macintosh
    FILENAME = "netscape";
    // alert("Netscape 7.x for Macintosh");

  } else if (is_nav6up) {    // Netscape Navigator 6.x+ for Macintosh
    FILENAME = "ie";
    // alert("Netscape 6.x+ for Macintosh");
        
  } else if (is_nav6) {    // Netscape Navigator 6.x for Macintosh
    FILENAME = "ie";
    // alert("Netscape 6.x for Macintosh");

  } else if (is_nav5up) {    // Netscape Navigator 5.x+ for Macintosh
    FILENAME = "netscape";
    // alert("Netscape 5.x+ for Macintosh");
    
  } else if (is_nav5) {    // Netscape Navigator 5.x for Macintosh
    FILENAME = "netscape";
    // alert("Netscape 5.x for Macintosh");

  } else if (is_nav4up) {    // Netscape Navigator 4.x+ for Macintosh
    FILENAME = "netscape";
    // alert("Netscape 4.x+ for Macintosh");
    
  } else if (is_nav4) {    // Netscape Navigator 4.x for Macintosh
    FILENAME = "netscape";
    // alert("Netscape 4.x for Macintosh");
                        
  } else if (is_nav3) {      // Netscape Navigator 3.x for Macintosh
    FILENAME = "netscape";
    // alert("Netscape 3.x for Macintosh");
   
    
  } else if (is_moz1up) {      // Mozilla 1.x+ for Macintosh
    FILENAME = "netscape";
    // alert("Mozilla 1.x+ for Macintosh");

  } else if (is_moz1) {      // Mozilla 1.0 for Macintosh
    FILENAME = "netscape";
    // alert("Mozilla 1.0 for Macintosh");

  } else {        // Undefined Macintosh browser
    FILENAME = "ie";
    // alert("Undefined Browser for Macintosh");
        
  }

} else {          // UNDEFINED PLATFORM
    FILENAME = "ie";
    // alert("Undefined Platform");
}




/* --- RESOLUTION SNIFFER -------------------------------------------------------------------------------
   Date: April 30, 2003
   Variables: screen_height - A DOM property to determine the client's screen height.

   Output: SCREENRES - Variable used in the construction of a CSS filename. (eg: "netscape_10x7.css")
                       Possible values include: "10x7" or "_8x6"
                       
   Note: Netscape Navigator 4.x PC doesn't work for testing if height >= 768. Using 700 instead.
-------------------------------------------------------------------------------------------------------*/

var screen_height = screen.height;

  if (screen_height >= 700) {
  // alert("The screen height is 700 pixels or larger");
  SCREENRES = "_10x7";

} else {
  // alert("The screen height is less than 700 pixels");
  SCREENRES = "_8x6";
}


/* --- ASSIGN APPROPRIATE STYLESHEET --------------------------------------------------------------------
   Date: April 30, 2003
   Variables: rootLevel - The relative or absolute path of the folder where CSS files are store.
                          rootLevel can either be set in each HTML document (eg: "var rootLevel = "../../")
                          or set as an absolute link in the script below
              FILENAME  - The first half of the CSS filename, stating the browser name to be used.
                          FILENAME is assigned by the browser/platform sniffer
              SCREENRES - The last half of the CSS filename, stating the Screen's resolution.
                          SCREENRES is assigned by the resolution sniffer
              PLATFORM  - *Optional* Can be added to a CSS filename for CLASSifying styles by platform.
                          PLATFORM is assigned by the browser/platform sniffer.

   Output: Writes the link for the appropriate stylesheet in the client's HTML document.
--------------------------------------------------------------------------------------------------------*/


var rootLevel = "http://www.questhavenpets.com/styles/";   // Absolute link to folder where CSS file are stored

// alert("The stylesheet for this browser is at "+ rootLevel + FILENAME + SCREENRES +".css");
document.write('<link rel="stylesheet" type="text/css" href="'+ rootLevel + FILENAME + SCREENRES +'.css">');

//--> end hide Javascript
