<!-- Copyright 2006 Jonas Borges -->
function ReadMail() {
	mail = GetCookie('email');
	document.form_login.email.value = mail;
	return true;
}
function SaveMail() {
	mail = document.form_login.email.value;
	return PutCookie('email',mail);
}


<!-- Copyright 2000 William Bontrager  -->
// This function looks for a cookie with a specific name on the visitor's hard drive.
function GetCookie(name) {
	// Start by assuming no cookie exists.
	var cookiecontent = '';
	// The browser's cookies can hold data we're not interested in, all in one 
	//     long string of characters. Thus, we need to find out where our specific
	//     cookie begins and ends (provided the one we want actually exists).
	//
	// If any cookies are available ...
	if(document.cookie.length > 0) {
		// Determine begin position of the cookie with the specified name.
		var cookiename = name + '=';
		var cookiebegin = document.cookie.indexOf(cookiename);
		// Initialize the end position at zero.
		var cookieend = 0;
		// If a cookie with the specified name is actually available ...
		if(cookiebegin > -1) {
			// Offset the begin position of the cookie by the lengh of the cookie name.
			cookiebegin += cookiename.length;
			// Determine the end position of the cookie.
			cookieend = document.cookie.indexOf(";",cookiebegin);
			if(cookieend < cookiebegin) {
				cookieend = document.cookie.length;
			}
			// Put the cookie into our own variable "cookiecontent".
			cookiecontent = document.cookie.substring(cookiebegin,cookieend);
		}
	}
	// Return the cookie content
	return cookiecontent;
}

// This function puts the cookie on the visitor's hard drive.
function PutCookie(name,value) {
	// How many days shall the cookie live on your user's computer?
	var DaysToLive = 200;

	// Begin by assuming no expiration date is applicable.
	var exp = '';
	// If an expiration date is applicable, determine the future date 
	//      and store the date in variable "exp" in the correct format.
	if(DaysToLive > 0) {
		var now = new Date();
		then = now.getTime() + (DaysToLive * 24 * 60 * 60 * 1000);
		now.setTime(then);
		exp = '; expires=' + now.toGMTString();
	}
	// Put the cookie on the user's hard drive with path set to root 
	//     and with any applicable expiration date.
	document.cookie = name + "=" + value + '; path=/' + exp;
	return true;
}
