
var fonts="Arial,Times New Roman,Verdana,Courier".split(",");
var standardfont="Arial"
var standardsize="90%"
var nosave=false; 


function drawform(){
    if (!document.layers){
	document.write("<form action=\"/\" name=\"fontChangeForm\" class=\"fontChangeForm\">");
	document.write("<input type=\"button\" class=\"fontChangeBtn\" onclick=\"addSize(-10)\" value=\"smaller\" /><br />");
	document.write("<input type=\"button\" class=\"fontChangeBtn\" onclick=\"addSize(10)\" value=\"larger\" />");
	document.write("</form>");
	}
}

function init(){
    if (!document.layers){
	size=getCookie("customFontSize");
	if (size!=null){
		c=size.split(":");
		document.getElementsByTagName("body").item(0).style.fontSize=c[0];
		document.getElementsByTagName("body").item(0).style.fontFamily=c[1];
	}
	if (size==null || c[0]=="" || c[1]==""){
		document.getElementsByTagName("body").item(0).style.fontSize=standardsize;
		document.getElementsByTagName("body").item(0).style.fontFamily=standardfont;
		storeSize()
		}
	}

}		

function addSize(add){
    if (!document.layers){
	doc = document.getElementsByTagName("body").item(0)
	size=parseInt(doc.style.fontSize)+add;
	doc.style.fontSize=size+"%";
	if (nosave==false) storeSize()
	}
}

function setSize(add){
    if (!document.layers){
	document.getElementsByTagName("body").item(0).style.fontSize=add+"%";
	if (nosave==false) storeSize() 
	}
}

function setFont(add){
    if (!document.layers){
	doc = document.getElementsByTagName("body").item(0)
	doc.style.fontFamily=add;
	if (nosave==false) storeSize()
	}
}

function storeSize(){
	var exp = new Date();
	exp.setTime(exp.getTime() + 24*60*60*90*1000);
	size=document.getElementsByTagName("body").item(0).style.fontSize;
	font=document.getElementsByTagName("body").item(0).style.fontFamily;
	setCookie("customFontSize",size+":"+font,exp);
}

function setCookie(name, value, expires, path, domain, secure) { 
	var curCookie = name + "=" + escape(value) + 
	((expires) ? "; expires=" + expires.toGMTString() : "") + 
	((path) ? "; path=" + path : "") + 
	((domain) ? "; domain=" + domain : "") + 
	((secure) ? "; secure" : "") 
	document.cookie = curCookie 
} 

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)) 
} 


