function selectAll(t) {
  for (i=0; i<t.length; i++) t[i].checked = true;
}
function clearAll(t) {
  for (i=0; i<t.length; i++) t[i].checked = false;
}
// For more explicit on and off switching
function turnDisplay(id, onOrOff)  {
    if (onOrOff == 'off') {
         document.getElementById(id).style.display = 'none'
    } else if (onOrOff == 'on') {
         document.getElementById(id).style.display = 'block'
    }
    return false;
}
function toggleDisplay(id1,id2) {
    // if id1 is hidden, then show it and hide id2. else do the opposite.
    if (document.getElementById(id1).style.display == 'none') {
        document.getElementById(id1).style.display = 'block'
        document.getElementById(id2).style.display = 'none'
    } else {
        document.getElementById(id1).style.display = 'none'
        document.getElementById(id2).style.display = 'block'
    }
    return false;
}

function status(node) {
  if (!node) return false;
  node = document.getElementById(node);
  if (node) node.innerHTML = 'Removing ..' + node.innerHTML
}

function printPage(msg) { 
 if (!window.print) { 
   alert(msg); 
  return; 
  } 
  window.print(); 
  return; 
} 

if (!document.layers&&!document.all&&!document.getElementById)
event="test"
function showtip(current,e,text){
if (document.all||document.getElementById){
thetitle=text.split('<br>')
if (thetitle.length>1){
thetitles=''
for (i=0;i<thetitle.length;i++)
thetitles+=thetitle[i]
current.title=thetitles
}
else
current.title=text
}

else if (document.layers){
document.tooltip.document.write('<layer bgColor="white" style="border:1px solid black;font-size:12px;">'+text+'</layer>')
document.tooltip.document.close()
document.tooltip.left=e.pageX+5
document.tooltip.top=e.pageY+5
document.tooltip.visibility="show"
}
}
function hidetip(){
if (document.layers)
document.tooltip.visibility="hidden"
}

function status(node) {
  if (!node) return false;
  node = document.getElementById(node);
  if (node) node.innerHTML = node.innerHTML + 'Getting data...'
}

sfHover = function() {
    var sfEls = document.getElementById("nav").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 popUp(URL) {
    eval("page = window.open(URL, 'page', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=300,left=312,top=234');");
}
