function getCookie(thecookie){
	tempString= thecookie + "=";
	if(document.cookie.length>0){
		start = document.cookie.indexOf(tempString);
		if(start!=-1){
			end = document.cookie.indexOf(";",start);
			if(end==-1){end=document.cookie.length;}
			start += tempString.length;
			return unescape(document.cookie.substring(start,end))
		}
	}
}

function setCookie(thecookie,value){
	var mycookie = getCookie(thecookie);
	if (mycookie) {
		var checkForVal = mycookie.indexOf(value);
		if (checkForVal == -1) { document.cookie = thecookie + "=" + mycookie + ":" + escape(value) + ";path=/"; } // only setcookie if page hasn't been set already
	} else {
		// this is the first page and no previous cookie
		document.cookie = thecookie + "=" + escape(value) + ";path=/ ";
	}
	
}

function testCookie(thecookie){
	if(getCookie(thecookie)){
		//return(getCookie(thecookie));
		alert(getCookie(thecookie));
	}else{
		return false;
	}
}

function setContactForm() {
var myAgentInfo = navigator.userAgent;
document.contactform.user_agent.value = myAgentInfo;
document.contactform.page_list.value = getCookie('pagelist');
}

// set page in pagelist
var myPageInfo = window.location.pathname;
var runCookie = setCookie('pagelist',myPageInfo);