/*********************************************************************************
FILE OVERVIEW - misc.js

This file provides a catch-all for general variables and functions used by the GNS
Extranet pages.  The script is called only on pages that require its functionality.

***********************************************************************************/

/////////////////////////////////////////////////////////////////////////////////////////
// IMG SWAP FUNCTIONS - These are defined for global header/footer nav items

// image swap variables 
if (document.images) {
	head1on = new Image();  head1on.src = "picture/nav/home_on.gif";
	head2on = new Image();  head2on.src = "picture/nav/cont_on.gif";
	head3on = new Image();  head3on.src = "picture/nav/care_on.gif";
	head1off = new Image(); head1off.src = "picture/nav/home_off.gif";
	head2off = new Image(); head2off.src = "picture/nav/cont_off.gif";
	head3off = new Image(); head3off.src = "picture/nav/care_off.gif";
	foot1on = new Image();  foot1on.src = "picture/nav/term_on.gif";
	foot2on = new Image();  foot2on.src = "picture/nav/priv_on.gif";
	foot3on = new Image();  foot3on.src = "picture/nav/site_on.gif";
	foot1off = new Image(); foot1off.src = "picture/nav/term_off.gif";
	foot2off = new Image(); foot2off.src = "picture/nav/priv_off.gif";
	foot3off = new Image(); foot3off.src = "picture/nav/site_off.gif";
}

// img swap functions
function imgOn(imgName, imgNum) {
 	if (document.images) {
		document[imgNum].src = eval(imgName + "on.src");
	}
}
function imgOff(imgName, imgNum) {
	if (document.images) {
		document[imgNum].src = eval(imgName + "off.src");
	}
}


/////////////////////////////////////////////////////////////////////////////////////////
// DHTML MENU SWAP FIX
// This script solves the no-psuedo classes for IE problem with the dhtml menu

// Detect IE
var isIE = (navigator.userAgent.toLowerCase().indexOf("msie") > 0) ? true : false;

sfHover = function() {
	if (isIE) {
		var sfEls = document.getElementById("primaryNav").getElementsByTagName("LI");
		for (var i = 0; i < sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

