﻿var pwm_default=1;
var pwm_fontSizes = new Array(0.5,0.7,0.9,1.1,1.3);
function PWM_Fontsize() {
 // get the current font size from the cookie
 this.cookieName='pwmFontSize';
 this.curLevel=this.getLevelFromCookie(this.cookieName);
 if(!isNaN(this.curLevel)) {
  this.curLevel = parseInt(this.curLevel);
 }
};
PWM_Fontsize.prototype.init=function(){
 this.updateFontSizeLevel();
};
PWM_Fontsize.prototype.getLevelFromCookie=function(cookieName){
 var level=cookieManager.getCookie(cookieName);
 if(level==false||level==null)level = pwm_default;
 return(level);
};
PWM_Fontsize.prototype.setSizeInCookie=function(cookieName,cookieValue){
 return cookieManager.setCookie(cookieName,cookieValue);
};
PWM_Fontsize.prototype.updateFontSizeLevel=function() {
 document.body.style.fontSize = pwm_fontSizes[this.curLevel] + "em";
};
PWM_Fontsize.prototype.setDefaultFontSize=function() {
 this.curLevel = pwm_default;
 this.updateFontSizeLevel();
 // set the cookie
 this.setSizeInCookie(this.cookieName,pwm_default);
};
PWM_Fontsize.prototype.increaseFontSize=function() {
 if(this.curLevel+1<pwm_fontSizes.length) {
  this.curLevel++;
 }
 this.updateFontSizeLevel();
 // set the cookie
 this.setSizeInCookie(this.cookieName,this.curLevel);
};
PWM_Fontsize.prototype.decreaseFontSize=function() {
 if(this.curLevel-1>=0) {
  this.curLevel--;
 }
 this.updateFontSizeLevel();
 // set the cookie
 this.setSizeInCookie(this.cookieName,this.curLevel);
};
var pwm_fontSize=new PWM_Fontsize();