
function LoadActualFontSize() {
	tempArray = document.cookie.split(";");
	var ACTUAL_FONTSIZE = 0
	for (tA = 0; tA < tempArray.length; tA++){
		if (tempArray[tA].indexOf('fontSize') > -1){
			fontSizeValue = tempArray[tA].split("=");
			ACTUAL_FONTSIZE = parseInt(fontSizeValue[1]);
		}
	}
	return ACTUAL_FONTSIZE;
}

function SaveActualFontSize(o) {
	var expire = new Date ();
	expire.setTime (expire.getTime() + (6000 * 24 * 3600000));
	expire = expire.toGMTString();
	document.cookie="fontSize="+o.actualFontSize+"; path=/; expires="+expire;
}

var initFontSizeValue = LoadActualFontSize();
var minFontSize = 8;
var defaultFontSize = initFontSizeValue==0 ? 10 : initFontSizeValue;
var maxFontSize = 12;
var fontSizeUnit = 'pt';

function checkObject(obj){
	if (typeof(obj)!='object') obj = document.getElementById(obj);	
	return obj;
}
function initFontSize(obj){
	var o = checkObject(obj);
	o.style.fontSize = defaultFontSize + fontSizeUnit;
}
function changeFontSize(obj,fontSize){
	if (obj.actualFontSize == undefined) obj.actualFontSize = defaultFontSize ;
	var i = obj.actualFontSize + fontSize;
	if (i<=maxFontSize && i>=minFontSize) {
		obj.actualFontSize = i;
		obj.style.fontSize = obj.actualFontSize + fontSizeUnit;
	}
}
function bigger(obj){
	var o = checkObject(obj)
	changeFontSize(o,+1);
	SaveActualFontSize(o);
}
function smaller(obj){
	var o = checkObject(obj)
	changeFontSize(o,-1);
	SaveActualFontSize(o);
}
