//set the font size according to the user's preference, called by setFontSize() or user click
function chgFontSz(i) {
	var bodyID = document.getElementsByTagName("body")[0];
	setCookie(i);
	switch(i) {
		case "1":
			bodyID.style.fontSize="100%";
			break;
		case "2":
			bodyID.style.fontSize="115%";
			break;
		case "3":
			bodyID.style.fontSize="130%";
			break;
	}
	return false
}

//saves the font size preference to a cookie, expires in one year
function setCookie(i) {
	var nextyear = new Date();
	nextyear.setFullYear(nextyear.getFullYear() + 1);
	document.cookie = "tescofontsize=" + i + "; expires=" + nextyear.toGMTString() + "; path=/";
}

//sets the font size according to the cookie value, called by onload
function setFontSize() {
	var allCookies = document.cookie;
	var pos = allCookies.indexOf("tescofontsize=");
	if (pos != -1) {
		var start = pos + 9;
		var end = allCookies.indexOf(";", start);
		if (end == -1) end = allCookies.length;
		var value = allCookies.substring(start, end);
		chgFontSz(value);
	}
}
