// Ajax

var xmlHttpSendPassword;

function SendPasswordEmail(email)
{

	var xmlHttpSendPassword=null;
	
	try
	 {
		 // Firefox, Opera 8.0+, Safari
		 xmlHttpSendPassword=new XMLHttpRequest();
	 }
	 
	catch (e)
	 {
		 //Internet Explorer
		 try
		  {
			xmlHttpSendPassword=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		 catch (e)
		  {
			xmlHttpSendPassword=new ActiveXObject("Microsoft.XMLHTTP");
		  }
	 }
	
	if (xmlHttpSendPassword==null)
	{
		 alert ("Browser does not support HTTP Request");
		 return
	}

	var url = '/ask/includes/php/sendpasswordemail.php?email=' + email; 
	
	xmlHttpSendPassword.onreadystatechange=function()
	{
		if (xmlHttpSendPassword.readyState==4 || xmlHttpSendPassword.readyState=="complete")	
		{
			if(document.getElementById('ajax_send_password_email'))
			{						
				if(xmlHttpSendPassword.responseText == 'user email not found') 
					document.getElementById('ajax_send_password_email').innerHTML = '<span style="color:#FF0000;">That email does not exist. Please enter your email carefully.</span>';
				else
				{
					document.getElementById('ajax_send_password_email').innerHTML = '<span style="color:#FF0000;">Your user and password have been sent to you.</span>';
				}
			}	
		}	
		else 
		{
			document.getElementById('ajax_send_password_email').innerHTML = '<img src="/graphics/loadingAnimation.gif" />';
		}
	}
	
	xmlHttpSendPassword.open("GET",url,true);
	xmlHttpSendPassword.send(null);
}