/* Added by Dave:
First, a little browser and OS detection: */

var detect = navigator.userAgent.toLowerCase();
var OS,browser,total,thestring;
var version = 0;

if (checkIt('konqueror'))
{
        browser = "Konqueror";
        OS = "Linux";
}
else if (checkIt('omniweb')) browser = "OmniWeb";
else if (checkIt('opera')) browser = "Opera";
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab";
else if (checkIt('msie')) browser = "Internet Explorer";
else if (!checkIt('compatible'))
{
        browser = "Netscape Navigator";
        version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac";
	else if (checkIt('win')) OS = "Windows";
	else OS = "an unknown operating system";
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

/* Select the appropriate stylesheet */
ChooseStyleSheet();

/* 
Function to choose the style sheet for use based on the platform and 
browser version.
*/

function ChooseStyleSheet() {
	
	var winNSCSS = "styles_pc_net.css";
	var winIECSS = "styles_pc_ie.css";
	var macNSCSS = "styles_mac_net.css";
	var cssDir   = "/include/";
	var styles;
	
	if (OS=="Mac") {
		if (browser=="Internet Explorer") {
			/* Use WinIE for MacIE browsers */
			styles = cssDir + winIECSS;
		} else {
			styles = cssDir + macNSCSS;
		}
	}
	else if (OS=="Windows") {
		if (browser=="Internet Explorer") {
			styles = cssDir + winIECSS;
		} else {
			styles = cssDir+winNSCSS;
		}
	}
	else if (OS=="Linux" || OS=="Unix") {
		styles = cssDir + winNSCSS;
	}
	else {
		/* Just to be safe, use WinNS since it has the largest font */
		styles = cssDir + winNSCSS;
	}
	document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"" + styles + "\">");
	return true;
}


/*
NOT USING DHTML:
Check the browser for DHTML compatibility. If not compatible, refresh the page
with a query string attached. This query string is recognized in the .asp/.php 
code at the top of the page, which sets variables to use for the display or
non-display of items on the page.


var DHTML    = ((document.getElementById || document.all || document.layers) || (document.getElementById && document.createElement));
var FilePath = location.href;
var CheckURLfor

if (location.search.indexOf("navType=2")>0) {
	CheckURLfor = "navType=2 exists in the URL.";

} else {
	CheckURLfor = "navType=2 does not exist in the URL.";
	
	if ((!DHTML) || (OS=="Mac" && browser=="Internet Explorer" && version<5)) {
		if (location.search) {
			FilePath = (FilePath + "&navType=2");
			location.replace (FilePath);
		} else {
			FilePath = (FilePath + "?navType=2");
			location.replace (FilePath);
		}
	}
	
}
*/

/* General Open Window Function... 
Arguments: url, name, width (int), height (int), scrollbars (boolean 0 or 1)--
width, height, and scrollbars values are optional.*/
function openWin(url, name, w, h, s) {
	if (w) { w = "width=" + w; } else { w = "width=300" }
	if (h) { h = "height=" + h; } else { h = "height=400"}
	if (s) { s = "scrollbars=" + s } else { s = "scrollbars=0" }
	messagewindow = window.open(url, name, ""+w+","+h+","+s+",menubar=no,top=50,left=50,resizable=yes");
	messagewindow.focus();
}
