/* Email Recovery Script */

var results = null;

function get_cookie(cookie_name) {
	//Uses indexOf to find characters in cookie string
	var newResults = document.cookie.indexOf(cookie_name + "=");

	//-1 is considered to be false in JS vars
	if(newResults != -1) {
		//Determines where in the string to pull out the data
		newResults = newResults + cookie_name.length+1;
		endResults = document.cookie.indexOf(";", newResults);
		//Tests to be sure said data is there
		if (endResults == -1) endResults=document.cookie.length;
		//Implements the data
		//alert("endResults is: " + endResults);
		document.getElementById("email").value = unescape(document.cookie.substring(newResults,endResults));
	} else {
		document.getElementById("email").value = "Please enter email again";
		//return null;
	}
	
	//Delete the cookie, since only a handful of browsers don't treat session as something
	//that expires until the whole browser is closed, not just the tab/process
	//We do this by resetting the cookie to expire at exactly the same moment is is recreated
	/* var tmpCookie = cookie_name;
	if (tmpCookie) {
		//alert("Creating replacement cookie");
		tmpCookie = "jetPolyEmail=" + tmpCookie;
		tmpCookie = tmpCookie + "; expires=" + Date() + + ";"; 
		document.cookie = tmpCookie;
	}*/
}
