gPage = new Object();
gPage.fontsize = 12;
function initPage() {
  InitCookie();
}

function InitCookie() {
  
  if (ReadCookie("hospizdienstbadhomburgde_fontsize")) {
    gPage.fontsize = (ReadCookie("hospizdienstbadhomburgde_fontsize"));
    $("body").css("font-size",gPage.fontsize+"px");
    } else {
    CreateCookie("hospizdienstbadhomburgde_fontsize",gPage.fontsize,1)
  }
  return;
}

function SetSize(value) {
  newVal = (gPage.fontsize*1)+(value*1);
  if (newVal >= 8 && newVal <= 30) {
    gPage.fontsize = (gPage.fontsize*1)+(value*1);
  }
  $("body").css("font-size",gPage.fontsize+"px");
  CreateCookie("hospizdienstbadhomburgde_fontsize",gPage.fontsize,1);
  
  return;
}
function ReadCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

/**
* erase a cookie by name
*
* @param  string    name of cookie
*/
function EraseCookie(name) {
  createCookie(name,"",-1);
}
function CreateCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else var expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

