/*	
	
	Author: Daniel Bloecher
	Date: 	12/11/06

	Filename:		scripts.js
	Supporting files:	welcome.html, register.html, unregister.html
	Function List:

	setCookie()
		Make a cookie with the user's name in it.

	deleteCookies()
		Deletes the cookie with the user's name in it.

	FfindCookie()
		Find cookie and retrieve value.

*/

function setCookie() {
	document.cookie = "name = "+document.registerForm.cookieName.value;
	window.location = "welcome.php";
}


function deleteCookies(){
deldate = "Thu, 01-Jan-70 00:00:01 GMT";
document.cookie = "name = ; expires = "+deldate+";";
}


function findCookie(val){
	var cookie = null;
	var findVal = val + "=";
	var dc = document.cookie;
	if (dc.length > 0){
		var start = dc.indexOf(findVal);
		if (start >= 0){
			start += findVal.length;
			lastVal = dc.indexOf(";", start);
			if (lastVal == -1){
				lastVal = dc.length;
			}
			cookie = (dc.substring(start, lastVal));
		}else{
			return cookie;
		}
	}
		return cookie;
}



name = findCookie("name");

if(name == null)
	{
		name = "";
	}
