/*		with thanks to www.fernando-graphics.com	*/
/*		fontReset() is in DRMC.js and is			*/
/*		copyright 2007 Andrew Batterham 			*/
/*		along with original script modification 	*/


// retrieve 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;
}

// set 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");
}

// delete 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 firstCall = true;

function changeFontsize(fSize, increment) {
  if (firstCall) {
    firstCall = false;
    if (increment != "")
      changeFontsize('14', '');
  }
  
// original script modified from here

  if (document.getElementById) {
    var mainDiv = document.getElementById( "main" );
      var currentFontSize, fontIncrease, newFontSize;
        if (increment != "") {
          currentFontSize = parseInt(mainDiv.style.fontSize);
          fontIncrease = parseInt(increment);
          newFontSize = currentFontSize + fontIncrease;
          }
        else if (fSize != "")
          newFontSize = parseInt(fSize);
          mainDiv.style.lineHeight = Math.round(newFontSize*1.5) + "px";
          mainDiv.style.fontSize = newFontSize + "px";
          setCookie('fontSize', newFontSize);
  }
}