/**
 * Global navigation drop down code
 **/
sfHover = function() {
	var sfEls = document.getElementById("globalNav").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);

/**
 * Alternate style sheet swap code
 **/
function setActiveStyleSheet(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}

/**
 * Image functions for swapping, preloading, etc
 **/
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
    var newWindow = window.open(theURL,winName,features);
    newWindow.focus();
}

function GoUrl(s)
{	var d = s.options[s.selectedIndex].value;
	window.top.location.href = d;
	s.selectedIndex = 0;
}

if(document.images) {
	contactOn = new Image;
	contactOn.src = "/images/nav_head/sparky/contact_text.gif";

	emailOn = new Image;
	emailOn.src = "/images/nav_head/sparky/email_text.gif";

	printOn = new Image;
	printOn.src = "/images/nav_head/sparky/print_text.gif";

	ptcexpressOn = new Image;
	ptcexpressOn.src = "/images/nav_head/sparky/ptcexpress_text.gif";

	toolsOn = new Image;
	toolsOn.src = "/images/nav_head/sparky/tools_text.gif";
}

function img_on(imgName) {
        if (document.images) {
                imgOn = eval(imgName + "On.src");
                document[imgName].src = imgOn;
                return true;
        } else {
                return true;
        }
}

function img_off(imgName) {
        if (document.images) {
                imgOff = eval(imgName + "Off.src");
                document[imgName].src = imgOff;
                return true;
        } else {
                return true;
        }
}

function img_on_tools(docName,imgName) {
	if (document.images) {
                imgOn = eval(imgName + "On.src");
                document[docName].src = imgOn;
                return true;
        } else {
                return true;
        }
}
