

/* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */
function friend() 
{
	var nocache = Math.random();
	var http = create_http(); 
	var email = document.getElementById('friend').value;
	http.onreadystatechange = function() 
	{
		if(http.readyState == 4){
			var response = http.responseText;
			if(response == 'success'){ //success
				alert('An email was sent to '+email);			
			} else if (response == 'bad_format'){
				alert(email+' doesn\'t appear to be a valid email address.');
			} else {
				alert('Email could not be sent at this time.');	
			}
		}
	}
	http.open('GET', '/friend.php?email='+email+'&nocache='+nocache, true);
	http.send(null);
}