// JavaScript Document

function readcookie(ckyname) {	
ckyval=''
	ckstr=document.cookie
	ck=ckstr.split(";")												// split into array
	if (ckstr.length >0) {
		for (i=0; i<ck.length; i++) {						// go through all cookies
			cv=trim(ck[i]).split("=")				
			if (trim(cv[0])==ckyname) {						// look for specific cookie
				ckyval=cv[1]												// and remember value
				i=999
			}
		}
	}
	return ckyval
}

function setcookie(ckyname,ckyval) {
	var expDays = 180;
	var exp = new Date(); 
	exp.setTime(exp.getTime() + (expDays*24*60*60*1000))
	if (ckyval=='') {exp="Tue, 01-Aug-1996 00:00:00 GMT"}
	document.cookie = trim(ckyname) + "=" + ckyval + "; expires=" + exp + "; path=/"
}


function trim(strText) { 										// remove leading and trailing blanks
	if (strText=="") {return}
	while (strText.substring(0,1) == ' ') {	strText = strText.substring(1, strText.length); }
	while (strText.substring(strText.length-1,strText.length) == ' ') {	strText = strText.substring(0, strText.length-1); }
	return strText;
}

