/* Browser Detection Script begins here. */
var theDOM1 = (document.getElementById) ? true : false;
/* theApp will contain the browser name */
var theApp = navigator.appName.toLowerCase();
/* UA (user agent) contains detailed browser info. For example,
UA for Internet Explorer on Mac would be 'mozilla/4.0 (compatible;
msie 5.0; mac_powerpc)' */
var UA = navigator.userAgent.toLowerCase();
/* variables for the two major browsers in existence today. */
var isIE = (UA.indexOf('msie') >= 0) ? true : false;
var isNS = (UA.indexOf('mozilla') >= 0) ? true : false;
/* 'compatible' text string is only in non-Netscape browsers */
if (UA.indexOf('compatible')>0){
isNS = false;
}
/* platform */
var thePlatform = navigator.platform.toLowerCase();
var isMAC = (UA.indexOf('mac') >= 0) ? true : false;
var isWIN = (UA.indexOf('win') >= 0) ? true : false;
/* Most UNIX users use X-Windows so this detects UNIX most of
the time.*/
var isUNIX = (UA.indexOf('x11') >= 0) ? true : false;
/* browser version */
var version = navigator.appVersion;
var isMajor = parseInt( version );
/* Internet Explorer version 5 on the Mac reports itself as version
4. This code corrects the problem. */
if(isIE && isMAC) {
if(UA.indexOf("msie 5")) {
isMajor = 5;
var stringLoc = UA.indexOf("msie 5");
version = UA.substring(stringLoc + 5, stringLoc + 8);
}
}
/* Internet Explorer version 6 on Windows reports itself as version
4. This code corrects the problem. */
if(isIE && isWIN) {
if(UA.indexOf("msie 6")) {
isMajor = 6;
var stringLoc = UA.indexOf("msie 6");
version = UA.substring(stringLoc + 5, stringLoc + 8);
}

if(UA.indexOf("msie 5.5")) {
isMajor = 5;
var stringLoc = UA.indexOf("msie 5.5");
version = UA.substring(stringLoc + 5, stringLoc + 8);
}
}
/* Netscape 6 reports itself as version 5 on all platforms.
This code corrects the problem. */
if(isNS && isMajor>4) {
if(UA.indexOf("netscape6")) {
isMajor = 6;
var stringLoc = UA.indexOf("netscape6");
version = UA.substring(stringLoc + 10, stringLoc + 14);
}
}
var isMinor = parseFloat( version );
/* a function to report browser info */
function getBrowserInfo(){
var temp="<p>";
temp += "User Agent: " + UA + "<br>";
temp += "Platform: " + thePlatform + "<br>";
temp += "Macintosh: " + isMAC + "<br>";
temp += "Windows: " + isWIN + "<br>";
temp += "Application: " + theApp + "<br>";
temp += "Version: " + version + "<br>";
temp += "Netscape: " + isNS + "<br>";
temp += "Internet Explorer: " + isIE + "<br>";
temp += "Major Version: " + isMajor + "<br>";
temp += "Full Version: " + isMinor + "<br>";
temp += "<br>";
if (theDOM1){
temp += "You appear to have a modern browser.<br>";
temp += "Netscape 6, IE 6, or IE5Mac are recommended.";
}else{
temp += "Alert! Your browser is obsolete.<br>";
temp += "You may enjoy the Web more if you upgrade.";
}
temp +="<\/p>";
return temp;
}
/* End of browser detection code */


/* Convert object name string or object reference
into a valid object reference */
function getObj(elementID){
if (typeof elementID == "string") {
return document.getElementById(elementID);
}else{
return elementID;
}
}

function setCursor(cursortype,thisobj){
	// this is commented out because the computer gets an hour glass with this extra if statement
	//if (UA.indexOf("msie 5")>=0){
		if (cursortype == 'pointer') { 
			cursortype='hand';
		}
	//}
	if (thisobj==null){
		document.body.style.cursor = cursortype;
	}
	else{
		getObj(thisobj).style.cursor = cursortype;
	}
}

/*Set the background color of an object*/
function setBackground(thisobj, color){
getObj(thisobj).style.background = color;
}

/*Set the text color of an object*/
function setColor(thisobj, color){
getObj(thisobj).style.color = color;
}

/*Setting the visibility of an object*/
function setVisibility(obj,vis){
var theObj = getObj(obj);
if (vis == true || vis=='visible' || vis=='y'){
theObj.style.visibility = "visible";
}else{
theObj.style.visibility = "hidden";
}
}
/*Getting the visibility of an object*/
function isVisible(obj) {
var theObj = getObj(obj);
return theObj.style.visibility;
}


/*Setting the display of an object*/
function setDisplay(obj,dis){
var theObj = getObj(obj);
if (dis==true || dis=='block' || dis=='y'){
theObj.style.display = "block";
}else{
if (dis==false || dis=='n'){
theObj.style.display = "none";
}else{
theObj.style.display = dis;
}
}
}
/*Getting the display of an object*/
function isDisplayed(obj) {
var theObj = getObj(obj);
return theObj.style.display;
}

// called on mouse over
	function dropMenu(menuId){
		//takes the passed variable, concatenates with the string 'dropdown' and sets menuID to visible
		setVisibility('dropDown' + menuId, "visible");
		// takes the passed variable, concatenates with the string, 'menuTitle' and swaps the color for the roll over effect
		menuEffects(getObj('menuTitle' + menuId), 'over');
		//changes the cursor to a hand on roll over.
		//setCursor("hand");
	}
// called on mouse out
	function hideMenu(menuId){
		//takes the passed variable, concatenates with the string 'dropdown' and sets menuID to hidden
		setVisibility('dropDown' + menuId, "hidden");
		// takes the passed variable, concatenates with the string, 'menuTitle' and swaps the color for the roll out effect
		menuEffects(getObj('menuTitle' + menuId), 'out');
		//changes the cursor back to a pointer on roll out.
		//setCursor("pointer");
	}
//swaps the color of the menu item
	function menuEffects(thisObj, theEvent){
		//if the mouse is over the menu item
		if (theEvent == 'over'){
			//change the bgnd color of the current object to the proper color that is defined in the htm document
			setBackground(thisObj, menuBackgroundOver);
			//change the menu item font color of the current object to the proper color that is defined in the htm document
			setColor(thisObj, menuNameColorOver);
			//setCursor("hand");
		}else{
			setBackground(thisObj, menuBackground);
			setColor(thisObj, menuNameColor);
			//setCursor("pointer");
		}
	}
	
	
// This is the script for changing the background color of a table row
//Specify highlight behavior. "TD" to highlight table cells, "TR" to highlight the entire row:
var highlightbehavior="TD";
var ns6=document.getElementById&&!document.all;
var ie=document.all;

function changeto(e,highlightcolor){
	source=ie? event.srcElement : e.target;
	if (source.tagName=="TABLE")
		return true;
	while(source.tagName!=highlightbehavior && source.tagName!="HTML")
		source=ns6? source.parentNode : source.parentElement;
	if (source.style.backgroundColor!=highlightcolor&&source.id!="ignore"){
		source.style.backgroundColor=highlightcolor;
	}
}

function contains_ns6(master, slave) { 
	//check if slave is contained by master
		while (slave.parentNode)
		if ((slave = slave.parentNode) == master){
			return true;
		}
		else{
			return false;
		}
}

function changeback(e,originalcolor){
	if (ie&&(event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="ignore")||source.tagName=="TABLE"){
		return true;
	}
	else if (ns6&&(contains_ns6(source, e.relatedTarget)||source.id=="ignore")){
		return true;
	}
	if (ie&&event.toElement!=source||ns6&&e.relatedTarget!=source){
		source.style.backgroundColor=originalcolor;
	}
}

