/* Font-size */

//cookie functies
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

//einde cookie functies

window.fontSize = 13;
window.fontSizeTimeout = 250;
window.fontStep = 3;
window.fontMin = 13;
window.fontMax = 18;

//cookie
if(getCookie("fontsize"))	{
	window.fontSize = parseInt(getCookie("fontsize"));
}

function SetFramesFontSize(timeout)	{

    var fs = window.fontSize;
	
    SetFontSize(document.getElementById("content"), fs);
    
	if (typeof content != "undefined")	{
		SetFontSize(content.document.getElementById("content"), fs);
	}
	
    if (timeout) {
        window.setTimeout("SetFramesFontSize(true)", window.fontSizeTimeout);
    }
}
function SetFontSize(obj, size)	{
    size = Math.round(100 * size) / 100;
    var fs = size + "px";
    if (obj && obj.style)  {
        if (obj.style.fontSize != fs)
        {
            obj.style.fontSize = fs;
			//opslaan in cookie
			setCookie("fontsize", size);
        }
    }
}

function IncreaseFontSize()  {
    if (window.fontSize < window.fontMax)   {
        window.fontSize += window.fontStep;
    }
	else	{	//resetten boven de fontMax (1 juni 2005 - jdk)
		 window.fontSize = window.fontMin;
	}
    SetFramesFontSize();
}

function DecreaseFontSize()  {
    if (window.fontSize > window.fontMin)
    {
        window.fontSize -= window.fontStep;
    }
    SetFramesFontSize();
}

function ResetFontSize()  {
  	window.fontSize = 13;
    SetFramesFontSize();
	deleteCookie("fontsize");
}
