/* GLOBAL VARIABLES ***********************/

var fontSize = 0;
var myOL = window.onload;

/* WINDOW.ONLOAD **************************/
if(myOL != null)
  window.onload = function(){myOL();myInit()}
else window.onload = myInit;
function myInit()
{// Initialize page here
    // read font size from cookie
 var size = readCookie("currentSize");
 if(size != null){ fontSize = size; }
// DROP-DOWN HELPERS ***********
 var dd = document.getElementById("navigation").getElementsByTagName("ul");
 for(var a = 0; a < dd.length; a++)
 {   // catch all clicks
   var li = dd[a].getElementsByTagName("LI");
   for(b = 0; b < li.length; b++){
     li[b].onclick = function(){ window.location = this.firstChild.getAttribute("href"); }
     li[b].className += " allclick"; }
    // just for IE 6
   dd[a].parentNode.onmouseover = function(){ this.getElementsByTagName("ul")[0].style.visibility = "visible"; }
   dd[a].parentNode.onmouseout = function(){ this.getElementsByTagName("ul")[0].style.visibility = "hidden"; }
 }
}

/* UTILITIES *****************************/
function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features); }
function printPage() {
  document.getElementById("printpage").style.visibility = "hidden";
  setTimeout(function(){
    window.print();
    document.getElementById("printpage").style.visibility = "visible"}
    ); }
function downSize()
{
 if(fontSize > -2)
 {
   document.getElementsByTagName("body")[0].className
    = document.getElementsByTagName("body")[0].className.replace(" size" + fontSize, " size"+ (--fontSize));
   createCookie("currentSize",fontSize,1);
 }  
}
function upSize()
{
 if(fontSize < 8)
 {
   document.getElementsByTagName("body")[0].className
    = document.getElementsByTagName("body")[0].className.replace(" size" + fontSize, " size"+ (++fontSize));
   createCookie("currentSize",fontSize,1);
 }
}
function resetSize()
{
   document.getElementsByTagName("body")[0].className
    = document.getElementsByTagName("body")[0].className.replace(" size" + fontSize, " size0");
   fontSize = 0;
   createCookie("currentSize",fontSize,1);
}

/* COOKIE HANDLERS ************************/

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}
function eraseCookie(name) { createCookie(name,"",-1); }