function setFontsize(size) {
  bodyStyle = document.getElementsByTagName('body')[0].style;
  switch(size) {
    case 'normal':
      bodyStyle.fontSize = "75%";
      setCookie('Fontsize', 'normal');
      break;
    case 'larger':
      bodyStyle.fontSize = "100%";
      setCookie('Fontsize', 'larger');
      break;
    case 'large':
      bodyStyle.fontSize = "125%";
      setCookie('Fontsize', 'large');
      break;
  }
}

function showFontsizelinks() {
  document.write('<div id="fontSizeLabel">Schriftgr&ouml;&szlig;e: </div>');
  document.write('<a class="fontSizeLink" href="javascript:setFontsize(\'normal\');"><img src="'+imgRoot+'img-spojubo/btn-schrift-normal.gif" width="20" height="20" alt="" /></a> ');
  document.write('<a class="fontSizeLink" href="javascript:setFontsize(\'larger\');"><img src="'+imgRoot+'img-spojubo/btn-schrift-groesser.gif" width="20" height="20" alt="" /></a> ');
  document.write('<a class="fontSizeLink" href="javascript:setFontsize(\'large\');"><img src="'+imgRoot+'img-spojubo/btn-schrift-gross.gif" width="20" height="20" alt="" /></a> ');
}

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"));
  }
}
