// <fontsize.js>
// Javascript to change font size for accessibility
// by Sijack Software ltd. (c) 2010 - All rights reserved.


// Function to change font size
function fontresize(multiplier) {
	if (document.body.style.fontSize == "") {
		document.body.style.fontSize = "1.0em";
	}
	document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (multiplier*0.1) + "em";
	createCookie('pgszcook',document.body.style.fontSize,1);
    window.location = "#footerFrame";
}
// Function to force the size of font to X
function fontreset() {
	fontset("1em");
	eraseCookie('pgszcook');
    window.location = "#footerFrame";
}
// Function
function fontset(fontsz) {
	document.body.style.fontSize = fontsz;
}
// Function to create a cookie
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 to read a cookie
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 to delete cookie
function eraseCookie(name) {
	createCookie(name,"",-1);
}
// Function to check if a cookie is set for font size (and use if it is!)
function checkFontSizeFromCookie() {
	if (readCookie('pgszcook') != null) {
		fontset(readCookie('pgszcook'));
	}
}

