function setFontsize(size) {
  bodyStyle = document.getElementById('mainBody').style;
  switch(size) {
    case 'normal':
      bodyStyle.fontSize = "100%";
      setCookie('Fontsize', 'normal', "", "/");
      break;
    case 'larger':
      bodyStyle.fontSize = "150%";
      setCookie('Fontsize', 'larger', "", "/");
      break;
    case 'large':
      bodyStyle.fontSize = "200%";
      setCookie('Fontsize', 'large', "", "/");
      break;
  }
  updateLinks();
}

function showFontsizelinks() {
  document.write('<p id="fontSizeLabel">Schriftgröße: ');
  document.write(showLinks());
  document.write('</p>');
}

function showLinks() {
  active = getCookie("Fontsize");
  links  = '<a class="fontSizeLink" href="javascript:setFontsize(\'normal\');"><img src="'+imgRoot+'img-cb/fontsize-a'+((active == 'normal' || typeof active == 'undefined') ? '-a' : '')+'.gif" width="17" height="17" border="0" alt="" /></a> ';
  links += '<a class="fontSizeLink" href="javascript:setFontsize(\'larger\');"><img src="'+imgRoot+'img-cb/fontsize-b'+((active == 'larger') ? '-a' : '')+'.gif" width="17" height="17" border="0" alt="" /></a> ';
  links += '<a class="fontSizeLink" href="javascript:setFontsize(\'large\');"><img src="'+imgRoot+'img-cb/fontsize-c'+((active == 'large') ? '-a' : '')+'.gif" width="17" height="17" border="0" alt="" /></a> ';
  return links;
}

function updateLinks() {
  bla = document.getElementById('fontSizeLabel');
  bla.innerHTML = 'Schriftgröße: '+showLinks();
}

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++) {
    while(theCookies[i].charAt(0) == ' ') theCookies[i] = theCookies[i].substring(1, theCookies[i].length);
    theCookieData = theCookies[i].split("=");
    if(theCookieData[0] == name) {
      theValue = theCookieData[1];
      return theValue;
    }
  }
}

function initFontsize() {
  if(document.cookie) {
    setFontsize(getCookie("Fontsize"));
  }
}

function clearPrefill(B,A) {
  if(B.value==A){
     B.value="";
  }
}

function addPrefill(B,A) {
  if(B.value=="") {
    B.value=A;
  }
}