// ###########################
// created by: Ben Weeks
// Created Date: 24th March 2008
// Company: webtechy.co.uk
//
// Modified By:
// Modified Date:
// Modified Comment:
//
// Modified By:
// Modified Date:
// Modified Comment:
//
// Modified By:
// Modified Date:
// Modified Comment:
//
// Version: 1.0
// ###########################
checkCurrentFontSize();
function ChangeFontSize(iFontSize)
{
 try{
  if (iFontSize == 1)
  {
   document.body.style.fontSize = "0.75em";
   document.body.style.lineHeight = "1.25em";
   eraseCookie("FontSizeValue");
   createCookie("FontSizeValue","1","30");
  }
  if (iFontSize == 2)
  {
   document.body.style.fontSize = "1em";
   document.body.style.lineHeight = "1em";
   eraseCookie("FontSizeValue");
   createCookie("FontSizeValue","2","30");
  }
  if (iFontSize == 3)
  {
   document.body.style.fontSize = "1.25em";
   document.body.style.lineHeight = "1em";
   eraseCookie("FontSizeValue");
   createCookie("FontSizeValue","3","30");
  }
 }
 catch(er)
 {
  // Oh well, it didn't work out - better luck next time.
 }
}
function checkCurrentFontSize() // Checks the cookie to see if we need to resize.
{
 var iFontSize  = parseInt(readCookie("FontSizeValue"));
 if (iFontSize > 0 && iFontSize < 4)
 {
  ChangeFontSize(iFontSize);
 }
}
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 var 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);
}
