function getCookie(name)
{
  var cname = name + "=";
  var dc = document.cookie;
  if (dc.length > 0) {
    begin = dc.indexOf(cname);
    if (begin != -1) {
      begin += cname.length;
      end = dc.indexOf(";", begin);
      if (end == -1) end = dc.length;
			 return unescape(dc.substring(begin, end));
    }
  }
  return null;
}

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 expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function delCookie (name,path,domain) 
{
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path == null) ? "" : "; path=" + path) +
    ((domain == null) ? "" : "; domain=" + domain) +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// default values
var firstCall = true;
var defaultFontSize = 75.00;
var currentFontSize = 0;
var maxFontSize = 105;
var minFontSize = 75.00;
var step = 15; 
var unit = "%";

function smaller() {
  if (firstCall) {
    firstCall = false;
    currentFontSize = defaultFontSize;
  }
  
  var tmp = currentFontSize - step;
  if (tmp < minFontSize) {
    alert('Sie haben die kleinste Schriftgröße erreicht!');
  }
  else {
    currentFontSize = tmp;
    document.body.style.fontSize = currentFontSize + unit;
    
    setCookie('fontSize', currentFontSize,'7');
  }
}

function bigger() {
  if (firstCall) {
    firstCall = false;
    currentFontSize = defaultFontSize;
  }
  
  var tmp = currentFontSize + step;
  if (tmp > maxFontSize) {
    alert('Sie haben die größte Schriftgröße erreicht!');
  }
  else {
    currentFontSize = tmp;
    document.body.style.fontSize = currentFontSize + unit;
    
    setCookie('fontSize', currentFontSize,'7');
  }
}

function normal() {
  currentFontSize = defaultFontSize;
  document.body.style.fontSize = defaultFontSize + unit;
  setCookie('fontSize', currentFontSize,'7');
}

function setFontsize(fs) {
  if (firstCall) {
    firstCall = false;
    currentFontSize = parseInt(fs);
  }
  document.body.style.fontSize = currentFontSize + unit;
}



