var xmlHttp
function chk_valid(form)
{ 
	var email=document.getElementById('chk_email').value;
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="ajax_query.php?email="+email;
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
			if(xmlHttp.responseText=="unavailable")
			{
				document.getElementById("chk").innerHTML="*Email ID not available. Please enter a different Email ID...<br>*If already registered click the link below to retrieve password<br><a href='login.php?action=forgot_password' class='tableblue'>Retrieve Password </a>";
				document.form1.email.focus();
			}
			else if(xmlHttp.responseText == "available")
			{
				document.getElementById("chk").innerHTML = "Email ID is available";
			}
			else if(xmlHttp.responseText == "invalid")
			{
				document.getElementById("chk").innerHTML = "Invalid Email ID";
			}
			else if(xmlHttp.responseText == "")
			{
				document.getElementById("chk").innerHTML = "Please enter Email ID";
			}
	 } 
}
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	 {
	 // Firefox, Opera 8.0+, Safari
	 xmlHttp=new XMLHttpRequest();
	 }
catch (e)
 {
 //Internet Explorer
 try
  {
	  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}








