function setCookie(c_name,value,expiredays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie = c_name + "=" + escape(value) + ((expiredays==null) ? "" : ";expires=" + exdate.toGMTString() + ";path=/");
}


function getCookie(c_name){
	if(document.cookie.length>0){
		var c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1){ 
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1){
				c_end=document.cookie.length;
			}
			return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return null;
}


function Prefs(){
	this.textSize = .7;
	
	this.writeCookie = function(){
		setCookie("textsize", this.textSize, 1);
	}
	
	this.setTextSize = function(fSize){
		if(fSize <= this.textSize){
			if(document.getElementById("shrinkText") != null && document.getElementById("enlargeText") != null){
				document.getElementById("shrinkText").className = "active";
				document.getElementById("enlargeText").className = "";
			}
		}
		else{
			if(document.getElementById("shrinkText") != null && document.getElementById("enlargeText") != null){
				document.getElementById("shrinkText").className = "";
				document.getElementById("enlargeText").className = "active";
			}
		}
		
		document.getElementsByTagName('body')[0].style.fontSize = fSize + "em";
		
		this.textSize = fSize;
		this.writeCookie();
	}
	
	
	if(getCookie("textsize") != null){
		this.setTextSize(getCookie("textsize"));
	}
	else{
		this.setTextSize(this.textSize);
	}
}


var prefsObj;


function enlargeText(){
	prefsObj.setTextSize(1);
}

function shrinkText(){
	prefsObj.setTextSize(.7);
}

function getPrefs(){
	prefsObj = new Prefs();
}

$("input:visible:enabled:first").focus();



//<body id="standard" onload="initU4();<c:if test="${editmode == 0}">getPrefs();</c:if>">
