// Browser detection.

var detect = navigator.userAgent.toLowerCase();

var OS,browser,version,total,thestring;



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;

}



// We have to adjust the x and y values for IE and Netscape.

if (browser == "Internet Explorer" || (browser == "Netscape Navigator" && version >= 5)) {

  	// This is an IE browser.

  	topPosOffset = 8;

	leftPosOffset = 0;

} else if (browser = "Netscape Navigator" && version <= 4) {

  	topPosOffset = 2;

	leftPosOffset = 0;
} else {
	
	// This is some other browser.

	topPosOffset = 0;

	leftPosOffset = 0;

}



// Now write stylesheet info.

document.write('<style type="text/css">.subMenu { border: none; background: #FFFFFF; position: absolute; top: ' + (156 + topPosOffset) + 'px; left: ' + (142 + leftPosOffset) + 'px; height: 32px; width: 662px; visibility: hidden; z-index: 10;}</style>');



function newImage(arg) {

	if (document.images) {

		rslt = new Image();

		rslt.src = arg;

		return rslt;

	}

}



// Change images on rollover.

function changeImages(id, from, to) {

	if (document.images) {

		if(document.layers && id != "none") {

			// For some reason this isn't working. For now do nothing.

			// document.layers[id].document.images[from].src = to;

		} else if(document.getElementById || document.all || id == "none") {

			document.images[from].src = to;

		}

	}

}



// This variable determines whether this is a DHTML compatible browser.

var DHTML = (document.getElementById || document.all || document.layers);



// This function returns dom objects and their style attributes given an ID.

function getObj(name) {

	if (document.getElementById) {

		this.obj = document.getElementById(name);

		this.style = document.getElementById(name).style;

	} else if (document.all) {

		this.obj = document.all[name];

		this.style = document.all[name].style;

	} else if (document.layers) {

		this.obj = getObjNN4(document,name);

		this.style = this.obj;

	}

}



function getObjNN4(obj,name) {

	var x = obj.layers;

	var thereturn;

	for (var i=0;i<x.length;i++) {

		if (x[i].id == name) thereturn = x[i];

		else if (x[i].layers.length) var tmp = getObjNN4(x[i],name);

		if (tmp) thereturn = tmp;

	}

	return thereturn;

}
