// v1.1.2
// 5/27/01 cro - Factored out GetCSS()
// 7/11/01 cro - Dropped Mac IE5 from the IE custom stylesheet because it was flaky. These users now get the generic stylesheet.

var isNav = navigator.appName.indexOf("Netscape") != -1;
var isIE  = navigator.appName.indexOf("Microsoft") != -1;
var isMac = (navigator.appVersion.indexOf("Macintosh") >= 0);
var isPC = (navigator.appVersion.indexOf("Win") >= 0);

var gVersion = GetVersion();

//
//	Returns the URL to the custom stylesheet for the client.  For IE, if the
//	client is not a Mac, they get a custom stylesheet.  For Netscape, if the
//	client is a Mac with Mozilla they get the same custom stylesheet other
//	Netscape users get.  Other Macs and (and other platforms and browsers)
//	will get the generic stylesheet, on the offhand hope that they will 
//	respect it.
//
function GetCSS() 
{
	var sCSS;
	if (isIE) {
		if (!isMac)
			sCSS = "style_ie.css";	
		else
			sCSS = "style_ie.css";
	}
	else if (isNav) {
		if (isPC)
			if (gVersion >= 5)
				sCSS = "style_ie.css";
			else
				sCSS = "style_nn.css";
		else if (isMac) 
			sCSS = "style_nn_mac.css";
		else
			sCSS = "style.css";
	}
	else sCSS = "style.css";
	// Use this for testing which script version loads
	// return ("http://localhost/autobot/" + "includes/" + sCSS);
	return ("/ELAB/includes/" + sCSS);
}

//
//	Includes the current stylesheet in the HTML
//
function WriteCSS() 
{
	var sCSS = GetCSS();
	if (sCSS.length > 0) document.write("<link rel=\"stylesheet\" href=\"" + sCSS + "\">");
}

//	Includes text of current stylesheet, for debug purposes
function DebugWriteCSS() 
{
	var sCSS = GetCSS();
	if (sCSS.length > 0) {
		document.write("browsers.js writes: &lt;link rel=\"stylesheet\" href=\"" + sCSS + "\"&gt;");
		document.write("navigator.appversion = " + navigator.appVersion);
	}
}
// Get the browser version.  Digs into appVersion for IE, since MS doesn't 
// understand what version numbers are for. Otherwise just parses the appVersion.
function GetVersion() {
	var s = navigator.appVersion;
	var n = s.indexOf("MSIE");
	var v = 0;
	// Grab the first number appearing after "MSIE"
	if (n != -1) {
		v = parseFloat(s.substr(n + 4));
	}
	else {
		v = parseFloat(s);
	}
	return v;
}