function FontSizeChanger(def) {
	this.w3c = (document.getElementById);
	this.ms = (document.all);
	this.userAgent = navigator.userAgent.toLowerCase();
	this.isMacIE = ((this.userAgent.indexOf('msie') != -1) && (this.userAgent.indexOf('mac') != -1) && (this.userAgent.indexOf('opera') == -1));
	this.isOldOp = ((this.userAgent.indexOf('opera') != -1)&&(parseFloat(this.userAgent.substr(this.userAgent.indexOf('opera')+5)) <= 7));

	if ((this.w3c || this.ms) && !this.isOldOp && !this.isMacIE) {
		this.stylesArray = {};
		/*this.allRules=getAllCSSRules('fontSize', 'px');
		for (var r=0;r<this.allRules.length;r++) {
			this.stylesArray[r] = parseInt(this.allRules[r].style.fontSize);
		}*/
		this.stylesArray[0] = parseInt(getCSSRule('body,td,th', false, 'fontSize').style.fontSize);

		this.name = "fontSize";
		this.cookieName = 'fontSize';
		this.def = def;
		this.base = 1;
		this.pref = this.getPref();
		this.oldFactor = 1;
	} else {
		this.init = new Function('return true;');
	}
	this.init();
}

FontSizeChanger.prototype.init = function() {
	this.changetextSize((this.pref-1)/.2+1)
}

FontSizeChanger.prototype.getPref = function() {
	var pref = this.getCookie();
	if (pref) return parseFloat(pref);
	else return this.def;
}

FontSizeChanger.prototype.getCookie = function() {
	var cookie = cookieManager.getCookie('fontSize');
	return (cookie)?cookie:false;
}

FontSizeChanger.prototype.setCookie = function(cookieValue) {
	if (isNaN(cookieValue)) return;
	return cookieManager.setCookie('fontSize', cookieValue);
}

FontSizeChanger.prototype.changetextSize = function(num) {
	factor = 1+(num-1)*.2;
	/*
	for (var r=0;r<this.allRules.length;r++) {
		this.allRules[r].style.fontSize = Math.ceil(this.stylesArray[r]*factor)+"px";
	}
	*/
	getCSSRule('body,td,th', false, 'fontSize').style.fontSize = Math.ceil(this.stylesArray[0]*factor)+"px";	
	
	this.oldFactor = factor;
	this.pref = factor;
	this.setCookie(parseFloat(this.pref))
}

var fontSize = new FontSizeChanger(1);
