//checkCurrentFontSize();

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

function setCookie (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 getCookie (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;
}


//var min=8;
//var max=18;

var min=8;
var standard=10;
var max=15;


function resetFontSize() {
var p = document.getElementsByTagName('font');
for(i=0;i<p.length;i++) {
if(p[i].style.fontSize) {
var s = parseInt(p[i].style.fontSize.replace("px",""));
} else {
var s = 10;
}
p[i].style.fontSize = standard+"px";
}
}


function increaseFontSize() {
   var p = document.getElementsByTagName('font');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=max) {
         s += 2;
      }
      p[i].style.fontSize = s+"px"
   }
   setCookie('fontsize', s, 365 * 25);
}




function decreaseFontSize() {
   var p = document.getElementsByTagName('font');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = 12;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
	  //eraseCookie("FontSizeValue");
      //createCookie("FontSizeValue","3","30");
   }  
   setCookie('fontsize', s, 365 * 25);
}

/*window.onload = function() {
    // if the cookie exists, restore the variable
    var fontsize = getCookie('fontsize');
    if (fontsize) {
        document.getElementsByTagName('font')[0].style.fontSize = fontsize + 'px'
    }
} */

window.onload = function(){
var s = getCookie('fontsize');
if(s == null)
return;
var p = document.getElementsByTagName('font');
for(i=0;i<p.length;i++) {
p[i].style.fontSize = s+"px";
}
};


/* function checkCurrentFontSize() // Checks the cookie to see if we need to resize.
{
 var iFontSize  = parseInt(readCookie("FontSizeValue"));
 if (iFontSize > 8 && iFontSize < 18)
 {
  ChangeFontSize(iFontSize);
 }
}
*/

