// JavaScript Document

sfHover = function() {
 var sfEls = document.getElementById("topnav").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);


/* ***********************************************************
 * FUNCTION: sfHover, listOver, listOut
 * PURPOSE: suckerfish rollover
 * ********************************************************* */

/* ***********************************************************
 * FUNCTION: showMe, hideMe
 * PURPOSE: footer tooltip rollover
 * ********************************************************* */
function showMe(divname) {
 document.getElementById(divname).style.display = "block";

}

function hideMe(divname) {
 document.getElementById(divname).style.display = "none";
}

function showInfo(o) {
 var show = function () {
 if(document.getElementById("WhatsThisInfo") == null) {
 var iB = document.createElement('span'); // Info Box
 var oP = o.parentNode; // object parent that came
 oP.insertBefore(iB,o);
 iB.id = "WhatsThisInfo";
 iB.innerHTML = o.getAttribute("info")+"<br /><br />";

 iB.style.marginTop= "-60px";
 iB.style.marginLeft= o.offsetWidth-10+"px";
 iB.style.display = "inline";
 }
 }
 setTimeout(show,200);
}


function hideInfo(o) {
 var hide = function () {
 var oP = o.parentNode; // object parent that came
 var oPS = o.previousSibling; // object previous sibling
 if(oPS.id == "WhatsThisInfo"){
 oP.removeChild(oPS);
 }
 }
 setTimeout(hide,200);
}


/* ***********************************************************
 * FUNCTION: clearField
 * PURPOSE: clear text field default value
 * ********************************************************* */
function clearField(field) {
 if (field.value == field.defaultValue)
 field.value = "";
}

function getDefaultValue(field) {
 if (field.value == "")
 field.value = field.defaultValue;
}

/* ***********************************************************
 * FUNCTION: turnme
 * PURPOSE: expand/collapse Ask InfoServ FAQ
 * ********************************************************* */
function turnme(elem) {
 if (elem.className == '') elem.className = "on";
 else if (elem.className == "on") elem.className = "";
}

/* ***********************************************************
 * FUNCTION: showAskNow/hideAskNow
 * PURPOSE: display Ask Now form on news story pages
 * ********************************************************* */
function toggleAskNow() {
 if (document.getElementById('askusnow_form').style.display == "block") {
 document.getElementById('askusnow_form').style.display = "none";
 } else {
 document.getElementById('askusnow_form').style.display = "block";
 }
}

function showAskNow() {
 document.getElementById('askusnow_form').style.display = "block";
}

function hideAskNow() {
 document.getElementById('askusnow_form').style.display = "none";
}

/* ***********************************************************
 * FUNCTION: showContactUsFooter/hideContactUsFooter
 * PURPOSE: display Contact Us form in footer
 * ********************************************************* */
function toggleContactUsFooter() {
 if (document.getElementById('contactus_form').style.display == "block") {
 document.getElementById('contactus_form').style.display = "none";
 } else {
 document.getElementById('contactus_form').style.display = "block";
 }
}

function showContactUsFooter() {
 document.getElementById('contactus_form').style.display = "block";
}

function hideContactUsFooter() {
 document.getElementById('contactus_form').style.display = "none";
}


/* ***********************************************************
 * FUNCTION: ldmHover, navOver, navOut
 * PURPOSE: rollover for homepage navigation bar
 * both IE & Mozilla
 * ********************************************************* */
function ldmHover() {
 if (document.getElementById('mainNav')) {
 var navItems = document.getElementById('mainNav').getElementsByTagName('li');
 for (var i=0; i<navItems.length; i++) {
 navItems[i].onmouseover=navOver;
 //navItems[i].onmouseout=navOut;
 }
 }
}

