var min=10;
var max=18;
var fontInt=2;
function increaseFontSize(){
	var currentFontSize  = $('body').css('font-size').replace(/[^0-9]+/g, '');
	if(currentFontSize < max){
		var newFontSize = parseInt(currentFontSize) + fontInt;
		$('body').css('font-size', newFontSize+'px');
		createCookie('lakeeye-fontsize',newFontSize);
	}
}
function decreaseFontSize(){
	var currentFontSize  = $('body').css('font-size').replace(/[^0-9]+/g, '');
	if(currentFontSize > min){
		var newFontSize = parseInt(currentFontSize) - fontInt;
		$('body').css('font-size', newFontSize+'px');
		createCookie('lakeeye-fontsize',newFontSize);
	}
}
function setFontSize(newSize){
	$('body').css('font-size', newSize+'px');
}

/* Cookie scripts from http://www.quirksmode.org/js/cookies.html#ex */
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=/";
}

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

function eraseCookie(name) {
	createCookie(name,"",-1);
}

$(function(){
	cookieFont = readCookie('lakeeye-fontsize');
	if(cookieFont != null){
		setFontSize(cookieFont);
	} else {
		// alert('no cookie!');
	}
});

