// JavaScript Document

// ----- START Text Resizer -----
// 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 = "fontsize=" + 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("fontsize=");
	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);
	}
}

window.onload=function(){
    setFontSize();
}


// ----- END Text Resizer -----


// ----- START Search box focus/blur clear + refill -----
function clearBox(objID) {
	if (objID.value == 'Search') {
		objID.value = '';
	}
}

function fillBox(objID) {
	if (objID.value == '') {
		objID.value = 'Search';
	}
}
// ----- END Search box focus/blur clear + refill -----


