// retrieve cookie.
function ReadCookie(cookieName) {
	var theCookie=""+document.cookie;
	var ind=theCookie.indexOf(cookieName);
	if (ind==-1 || cookieName=="") return ""; 
	var ind1=theCookie.indexOf(';',ind);
	if (ind1==-1) ind1=theCookie.length; 

	changeFontsize(unescape(theCookie.substring(ind+cookieName.length+1,ind1)),0);
	
	return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}
// set cookie.
function SetCookie(cookieName,cookieValue) {
	var today = new Date();
	var expire = new Date();
	var domain = "152.160.212.200";
	var path = "/";
	expire.setTime(today.getTime() + 3600000*24*365);
	document.cookie = cookieName+"="+escape(cookieValue)
		+ ";domain=" + domain
		+ ";path=" + path
		+ ";expires="+expire.toGMTString();
}

// 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('12', '');
  }
  if (document.getElementsByTagName) {
    tags = new Array ( "p","ol","ul" );
    for (j=0; j<tags .length; j++) {
      var getElement = document.getElementsByTagName(tags[j]);
      var eachElement, currentFontSize, fontIncrease, newFontSize;
      for (i=0; i<getElement.length; i++) {
        eachElement = getElement[i];
        if (increment != "") {
          currentFontSize = parseInt(eachElement.style.fontSize);
          fontIncrease = parseInt(increment);
          newFontSize = currentFontSize + fontIncrease;
          }
        else if (fSize != "")
          newFontSize = parseInt(fSize);
        if (tags[j] == "li")
          eachElement.style.lineHeight = Math.round(newFontSize*1.2) + "px";
        else
          eachElement.style.lineHeight = Math.round(newFontSize*1.5) + "px";
        if (fSize != "") {
          switch(tags[j]) {
          case "h2": newFontSize += 0; break;
          case "h3": newFontSize += 0; break;
          case "h4": newFontSize += 0; break;
          case "h5": newFontSize += 0; break;
          case "h6": newFontSize += 0;
          }
        }
        eachElement.style.fontSize = newFontSize + "px";
      }
    }
  }
        SetCookie('fontSize', newFontSize);
}