var w3c = (document.getElementById);
var ms = (document.all);
var userAgent = navigator.userAgent.toLowerCase();
var isMacIE = ((this.userAgent.indexOf('msie') != -1) && (this.userAgent.indexOf('mac') != -1) && (this.userAgent.indexOf('opera') == -1));
var isOldOp = ((this.userAgent.indexOf('opera') != -1)&&(parseFloat(this.userAgent.substr(this.userAgent.indexOf('opera')+5)) <= 7));
var FontBase=11;
var FontIncrement=1;

function initFontSize(){
	var cookieFontBase = GetCookie('audifFontBase');
	if(cookieFontBase){
		FontBase=parseFloat(cookieFontBase);
	}
	SetCookie('audifFontBase',parseFloat(FontBase));
	setFontSize('init');	
}

function setFontSize(style){
	body = (w3c)?document.getElementsByTagName('body')[0].style:document.all.tags('body')[0].style;
	if(style=="bigger")	FontBase=parseFloat(FontBase) + parseInt(FontIncrement);
	else if(style=="smaller") FontBase=parseFloat(FontBase) - parseInt(FontIncrement);
	else FontBase=parseFloat(FontBase);
	// FontBase = Math.round(FontBase);
	body.fontSize = FontBase + 'px';
	SetCookie('audifFontBase',FontBase);
	//alert(ReadCookie('audifFontBase'));
}


//for (i = 0; i < body.length; i++) {
//  body[i].fontSize = FontBase + 'px';
//}


function SetCookie(name, value, expires, path, domain, secure) {
	var expires = new Date();
	expires.setTime(expires.getTime()+(100*24*60*60*1000))
	var curCookie = name + "=" + escape(value) +
    	((expires) ? "; expires=" + expires.toGMTString() : "") +
      	"; path=" +  ((path) ? path : "/") +
      	((domain) ? "; domain=" +  domain : "") +
      	((secure) ? "; secure" : "");
     	//alert(curCookie);
	document.cookie = curCookie;
}

function GetCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else {
		begin += 2;
	}
	var end = document.cookie.indexOf(";", begin);
	if (end == -1){
		end = dc.length;
	}
	return unescape(dc.substring(begin + prefix.length, end));
}