function loadUsersettings(){
    changeFontsize(0); 
}

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;
}

// setting a cookie
function setCookie(name, value, expires, path, domain, secure) {
  document.cookie = name + "=" + escape(value) +
  ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
  ((path == null) ? "" : "; path=" + path) +
  ((domain == null) ? "" : "; domain=" + domain) +
  ((secure == null) ? "" : "; secure");
}

var firstCall = true;
var fontUnit = "%";
var fontStartSize = 90;

function changeFontsize(increment) {
	if (firstCall) {
		firstCall = false;
		var oldFontSize = getCookie('fontSize');
		
		if(oldFontSize){
			document.body.style.fontSize = oldFontSize + fontUnit;
		}else{
			document.body.style.fontSize = fontStartSize + fontUnit;
		}
	}
 
	if (document.getElementsByTagName) {
		var newFontSize;
		
		currentFontSize = Number(document.body.style.fontSize.substring(0,document.body.style.fontSize.length - fontUnit.length));
		newFontSize = currentFontSize + increment;
		document.body.style.fontSize = newFontSize + fontUnit;
		setCookie('fontSize', newFontSize);
  	}
}
