// Heinle's function for retrieving a cookie.
function getCookie(name){
 var cname = name + "=";
 var dc = document.cookie;
 if (dc.length > 0) {
  begin = dc.indexOf(cname);
  if (begin != -1) {
   begin += cname.length;
   end = dc.indexOf(";", begin);
   if (end == -1) end = dc.length;
    return unescape(dc.substring(begin, end));
  }
 }
 return null;
}

// An adaptation of Dorcht's function for setting a cookie.
function setCookie(name, value, expires, path, domain, secure) {
 document.cookie = name + "=" + escape(value) +
 ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
 ((path == null) ? "" : "; path=" + path) +
 ((domain == null) ? "" : "; domain=" + domain) +
 ((secure == null) ? "" : "; secure");
}

// An adaptation of Dorcht's function for deleting a cookie.
function delCookie (name,path,domain) {
 if (getCookie(name)) {
  document.cookie = name + "=" +
  ((path == null) ? "" : "; path=" + path) +
  ((domain == null) ? "" : "; domain=" + domain) +
  "; expires=Thu, 01-Jan-70 00:00:01 GMT";
 }
}

var currentSize = 100;

function setFontSize(ev, percentage, prevent)
{
 if (document.getElementsByTagName) {
  currentSize = percentage;
  document.getElementsByTagName("body")[0].style.fontSize = currentSize + '%';
  setCookie('fontSize', currentSize);
 }
}

function decreaseFontSize(ev)
{
 setFontSize(ev, currentSize / 1.08, true);
}

function defaultFontSize(ev)
{
 setFontSize(ev, 100, true);
}

function increaseFontSize(ev)
{
 setFontSize(ev, currentSize * 1.08, true);
}

function setDefaultFont() {
 if (size=getCookie('fontSize')) {
 setFontSize(null, size, true);
 }
}

function toggleMap(mapfile){
 if (document.getElementById) {
 obj=document.getElementById('mapbg');
 if (obj) {
  if (obj.style.display == 'none')
  obj.style.display = 'block';
  else {
  obj.style.display = 'none';
  obj2=document.getElementById('simplemap');
  if (obj2)
   obj2.src = mapfile;
  }
 }
}
 return false;
}

var OnLoad = "setDefaultFont();";
window.onload = function() { eval(OnLoad); }

