function setFontsize(size) {
  bodyStyle = document.getElementsByTagName('body')[0].style;
  switch(size) {
    case 'normal':
      bodyStyle.fontSize = "100%";
      setCookie('Fontsize', 'normal');
      break;
    case 'larger':
      bodyStyle.fontSize = "125%";
      setCookie('Fontsize', 'larger');
      break;
    case 'large':
      bodyStyle.fontSize = "150%";
      setCookie('Fontsize', 'large');
      break;
  }
}

function showFontsizelinks() {
  document.write('<span id="fontSize"><strong>Schriftgröße:</strong> ');
  document.write('<a href="javascript:setFontsize(\'normal\');"><img style="position:relative; top:3px;" src="img/btn-normal-font.gif" width="17" height="17" border="0" alt="" title="Standard-Schriftgröße"/></a> ');
  document.write('<a href="javascript:setFontsize(\'larger\');"><img style="position:relative; top:3px;" src="img/btn-larger-font.gif" width="17" height="17" border="0" alt="" title="große Schriftgröße"/></a> ');
  document.write('<a href="javascript:setFontsize(\'large\');"><img style="position:relative; top:3px;" src="img/btn-large-font.gif" width="17" height="17" border="0" alt="" title="sehr große Schriftgröße"/></a></span>');
}

function setCookie(name, value, expires, path, domain, secure) {
  document.cookie = name + "=" + escape(value) +
                    ((expires) ? "; expires=" + expires : "") +
                    ((path)    ? "; path="    + path    : "") +
                    ((domain)  ? "; domain="  + domain  : "") +
                    ((secure)  ? "; secure"             : "");
}

function getCookie(name) {
  theCookies = document.cookie.split(";");
  for(var i=0; i<theCookies.length; i++) {
    theCookieData = theCookies[i].split("=");
    if(theCookieData[0] == name) {
      theValue = theCookieData[1];
      return theValue;
    }
  }
}

function initFontsize() {
  if(document.cookie) {
    setFontsize(getCookie("Fontsize"));
  }
}