var defaultFontSize = 100;
var savedFontSize = getFontSizeCookie();

var fontSize = defaultFontSize;

if (savedFontSize > 0) {
	fontSize = savedFontSize;
} 

function resetFontSize() {
	fontSize = defaultFontSize;
	initFontSize();
}

function initFontSize() {
	changeFontSize(100);
}

function changeFontSize(val) {
	var resize;
	if (resize = document.getElementById('resize')) {
		fontSize = parseInt(val);
		if (fontSize < 70) { fontSize = 70; }
		if (fontSize > 200) { fontSize = 200; }
		resize.style.fontSize = fontSize + '%';
	  document.cookie = "fontSize=" + fontSize + "; path=/";
	}
}

function getFontSizeCookie() {
  var dc = document.cookie;
  var prefix = "fontSize=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}




