

// convert all characters to lowercase to simplify testing
var agt=navigator.userAgent.toLowerCase();

// *** BROWSER VERSION ***
// 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);
var is_getElementById   = (document.getElementById) ? "true" : "false";
var is_getElementsByTagName = (document.getElementsByTagName) ? "true" : "false";
var is_documentElement = (document.documentElement) ? "true" : "false";

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_major >= 4));
var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                      (agt.indexOf("; nav") != -1)) );
    var is_nav6 = (is_nav && (agt.indexOf('netscape6') != -1)); // new 001120 - abk
    var is_nav6up = (is_nav && is_getElementById);              // new 001121 - abk
var is_nav5 = (is_nav && (is_major == 5) && !(is_nav6)); // checked for ns6
var is_nav5up = (is_nav && (is_major >= 5));
    
    // how to check for ns7+? is_major is still 5 in ns6 - abk
    
var is_ie   = (agt.indexOf("msie") != -1);
var is_ie3  = (is_ie && (is_major < 4));

// allow for v6+ ie
 
var msie_vers_start = agt.indexOf("msie")+5;
var msie_real_vers = parseFloat(agt.substring(msie_vers_start, msie_vers_start+3));

//    var is_ie4  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.")==-1));

var is_ie4  = (is_ie && (is_major == 4) && (msie_real_vers < 5));

var is_ie4up  = (is_ie  && (is_major >= 4));
//    var is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.")!=-1));

var is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.")!=-1));

var is_ie5up  = (is_ie  && !is_ie3 && !is_ie4);

// 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  = (is_aol && is_ie5);
var is_aol6  = (is_aol && is_ie5up);

var is_opera = (agt.indexOf("opera") != -1);
var is_webtv = (agt.indexOf("webtv") != -1);


// *** PLATFORM ***
var is_win   = ( (agt.indexOf("win")!=-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));


// 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_mac    = (agt.indexOf("mac")!=-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);


 
<!-- 
//IF YOU WANT TO SEE WHAT THE JS IS SEEING, TAKE THE // BARS OUT. //

//document.write('navigator.appName: ' + navigator.appName + "<BR>");
//document.write('navigator.appVersion: ' + navigator.appVersion + "<BR>");
//document.write("navigator.userAgent: " + navigator.userAgent + "<BR>");

//document.write("navigator.platform: " + navigator.platform + "<BR>");
//-->

 
<!-- 
//IF YOU WANT TO SEE WHAT THE JS IS SEEING, TAKE THE // BARS OUT. //

//        document.write("nav4up:" + is_nav4up + "<BR>");
//        document.write("nav6up:" + is_nav6up + "<BR>");
//        document.write("ie4up:" + is_ie4up + "<BR>");
//        document.write("ie5up:" + is_ie5up + "<BR>");
//        document.write("aol:" + is_aol + "<BR>");
//        document.write("aol3:" + is_aol3 + "<BR>");
//        document.write("aol4:" + is_aol4 + "<BR>");
//        document.write("aol5:" + is_aol5 + "<BR>");
//        document.write("aol6:" + is_aol6 + "<BR>");
//        document.write("opera:" + is_opera + "<BR>");
//        document.write("webtv:" + is_webtv + "<BR>");
//-->


 
<!-- 
//IF YOU WANT TO SEE WHAT THE JS IS SEEING, TAKE THE // BARS OUT. //

//      document.write("win:" + is_win + "<BR>");
//      document.write("win32:" + is_win32 + "<BR>");
//      document.write("win95:" + is_win95 + "<BR>");
//      document.write("win98:" + is_win98 + "<BR>");
//      document.write("winnt:" + is_winnt + "<BR>");


//        document.write("mac:" + is_mac + "<BR>");

//        document.write("unix:" + is_unix + "<BR>");
//        document.write("sun:" + is_sun + "<BR>");
//        document.write("irix:" + is_irix + "<BR>");
//        document.write("hpux:" + is_hpux + "<BR>");
//        document.write("aix:" + is_aix + "<BR>");
//        document.write("linux:" + is_linux + "<BR>");
//        document.write("sco:" + is_sco + "<BR>");
//        document.write("unixware:" + is_unixware + "<BR>");
//        document.write("mpras:" + is_mpras + "<BR>");
//        document.write("reliant:" + is_reliant + "<BR>");
//        document.write("dec:" + is_dec + "<BR>");
//        document.write("sinix:" + is_sinix + "<BR>");
//        document.write("bsd:" + is_bsd + "<BR>");
//        document.write("freebsd:" + is_freebsd + "<BR>");
//-->


/////////////////////// PLATFORM CHECKS ///////////////////////////////////

///////--WINDOWS--////////

// if (is_win == true) { alert('Windows')}

//////--MAC--////////

// else if (is_mac == true) { alert('Mac')}

//////--UNIX AND LINUX AND RELATED--///////

/*	else if ((is_unix == true) || (is_sun == true) || (is_irix == true) || (is_hpux == true) || (is_aix == true) || (is_linux == true) || (is_sco == true) || (is_unixware == true) || (is_mpras == true) || (is_reliant == true) || (is_dec == true) || (is_sinix == true) || (is_bsd == true) || (is_freebsd == true))
{ alert('Unix')}

else {alert('You Must Be Using A HAL 9000')}

*/
////////////////////// BROWSER CHECKS ///////////////////////////////////////


//////--TESTING FOR IE 4 AND UP --///////

/*
if ((is_ie4up) || (is_ie5up))
	{alert ('Internet Explorer')}

//////--TESTING FOR NS 4 AND UP --///////

else if (is_nav4up)
	{alert ('Netscape 4 Or Greater')}


//////--TESTING FOR AOL --///////

else if ((is_aol4) || (is_aol5) || (is_aol6))
	{alert ('AOL')}

//////--TESTING FOR OPERA--///////
else if (is_opera)
	{alert ('Opera')}

/////-- NO KNOWN BROWSER--///////
else {alert('Your Browser Is Unknown')}

*/

//////////////////////////////////////////////////////////////////////
//////////////  APPLY THE APPROPRIATE STYLE SHEETS  //////////////////
//////////////////////////////////////////////////////////////////////

//////////////  Windows with IE, Or AOL   ////////////////////////////

if (((is_win == true) && (is_ie4up)) || ((is_win == true) && (is_ie5up)) || ((is_win == true) && (is_aol4)) || ((is_win == true) && (is_aol5)) || ((is_win == true) && (is_aol6))) {document.write("\<link rel\=\"stylesheet\" type\=\"text\/css\" href\=\"css\/ieaol_win.css\"\>")}

/////////////   Windows with NS   ////////////////////////////////////

else if (((is_win == true) && (is_nav4up)) || ((is_win == true) && (is_nav6up))) {document.write("\<link rel\=\"stylesheet\" type\=\"text\/css\" href\=\"css\/ns_win.css\"\>")}

//////////////  Mac With Netscape  /////////////////////////////

else if ((is_mac == true) && (!(is_ie4up))) {document.write("\<link rel\=\"stylesheet\" type\=\"text\/css\" href\=\"css\/mac_ns.css\"\>")}

//////////////  Mac With IE  /////////////////////////////

else if ((is_mac == true) && (is_ie4up)) {document.write("\<link rel\=\"stylesheet\" type\=\"text\/css\" href\=\"css\/mac_ie.css\"\>")}

//////////////  UNIX, Linux, Opera, Etc. /////////////////////////////

else {document.write("\<link rel\=\"stylesheet\" type\=\"text\/css\" href\=\"css\/generic.css\"\>")}




