var standardfont="unikurd web"
var standardsize="100%"
var nosave=false;
function fontinit(){
    try
    {
    if(document.getElementById("styler")){
    if (!document.layers){
	size=getCookie("dynfontsize");
	if (size!=null){
		c=size.split(":");
		document.getElementById("styler").style.fontSize=c[0];
		document.getElementById("styler").style.fontFamily=c[1];
	}
	if (size==null || c[0]=="" || c[1]==""){
		document.getElementById("styler").style.fontSize=standardsize;
		document.getElementById("styler").style.fontFamily=standardfont;
		storeSize()
		}
	}
	nosave=document.dynform.nosave.checked
    }
    }catch(e){}
}

function setDefault(){
		document.getElementById("styler").style.fontSize=standardsize;
		document.getElementById("styler").style.fontFamily=standardfont;
		storeSize()
	}
function addSize(add){
    if (!document.layers){
	doc = document.getElementById("styler")
        if(!doc.style.fontSize){
            doc.style.fontSize=standardsize;            
        }
           

   
    size=parseInt(doc.style.fontSize)+add;
	doc.style.fontSize=size+"%";
	storeSize()
	}
}
function setSize(add){
    if (!document.layers){
	document.getElementById("styler").style.fontSize=add+"%";
	storeSize()
	}
}
function setFont(add){
    if (!document.layers){
	doc = document.getElementById("styler")
	doc.style.fontFamily=add;
	 storeSize()
	}
}
function storeSize(){
	var exp = new Date();
	exp.setTime(exp.getTime() + 1000*60*60*90*365); // refer to:http://codepunk.hardwar.org.uk/ajs32.htm
	size=document.getElementById("styler").style.fontSize;
	font=document.getElementById("styler").style.fontFamily;
	setCookie("dynfontsize",size+":"+font,exp);
}
function setCookie(name, value, expires, path, domain, secure) {
    //path=$('_SECTION_').value
	var curCookie = name + "=" + escape(value) +
	((expires) ? "; expires=" + expires.toGMTString() : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "")
	document.cookie = curCookie
}
/*
	function getCookie()
	reads the cookie
*/
function getCookie(name) {
	var prefix = name + "="
	var cookieStartIndex = document.cookie.indexOf(prefix)
	if (cookieStartIndex == -1)
	return null
	var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex +
	prefix.length)
	if (cookieEndIndex == -1)
	cookieEndIndex = document.cookie.length
	return unescape(document.cookie.substring(cookieStartIndex +
	prefix.length,
	cookieEndIndex))
}

