var xmlHttp;
var str, str1;

function showHint(str)
{	
	if (str.length==0)
	{ 
		document.getElementById("valid-name-response").innerHTML=""
		return
	}
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="check_user.php?sid=" + Math.random() + "&q=" + str
	xmlHttp.onreadystatechange=stateChanged 
	
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function showHintEmail(str1)
{
	if (str1.length==0)
	{ 
		document.getElementById("valid-email-response").innerHTML=""
		return
	}
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="check_user_email.php?sid=" + Math.random() + "&q=" + str1
	xmlHttp.onreadystatechange=stateChanged1
	
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function stateChanged1() 
{ 
	if (xmlHttp.readyState==1 || xmlHttp.readyState=="loading")
	{ 
		document.getElementById("valid-email-response").innerHTML="Validating..."
	} 
	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("valid-email-response").innerHTML=xmlHttp.responseText 
	} 
} 
function stateChanged() 
{ 
	if (xmlHttp.readyState==1 || xmlHttp.readyState=="loading")
	{ 
		document.getElementById("valid-name-response").innerHTML="Checking..."
	} 
	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("valid-name-response").innerHTML=xmlHttp.responseText 
	} 
} 
/////////////////////////////////////////////


function GetXmlHttpObject(handler)
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}