var xmlHttp

function showHint(str)
{ 
	if (str.length > 0)
	{ 
		Customer.innerHTML="验证昵称....";
		var url="checkuser.asp?sid=" + Math.random() + "&CustomerID=" + str
		xmlHttp=GetXmlHttpObject(stateChanged)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
	} 
	else
	{ 
		document.getElementById("Customer").innerHTML=""
	} 
} 

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		if (xmlHttp.responseText =="true")
		{
			document.getElementById("Customer").innerHTML= "<img src='/images/pic_right.gif'>&nbsp;&nbsp;" +"恭喜，此帐号还未被占用，请尽快注册！";
			//document.getElementById("CustomerID1").value= "YES";
		}
		else if(xmlHttp.responseText =="false")
		{
			document.getElementById("Customer").innerHTML="<img src='/images/pic_error.gif'>&nbsp;&nbsp;" +"对不起，此帐号已被占用，请重新选择。";
			document.getElementById("Customer").className = "ss2"
			return false;
		}
		else
		{
			document.getElementById("Customer").innerHTML="<img src='/images/pic_error.gif'>&nbsp;&nbsp;" +"验证失败!!";
			document.getElementById("Customer").className = "ss2"
			return false;
		}
	} 
	else
		return false;

	return true;
} 

function GetXmlHttpObject(handler)
{ 
	var objXmlHttp=null

	if (navigator.userAgent.indexOf("Opera")>=0)
	{
		alert("This example doesn't work in Opera") 
		return; 
	}
	if (navigator.userAgent.indexOf("MSIE")>=0)
	{ 
		var strName="Msxml2.XMLHTTP"
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
		{
			strName="Microsoft.XMLHTTP"
		} 

		try
		{ 
			objXmlHttp=new ActiveXObject(strName)
			objXmlHttp.onreadystatechange=handler 
			return objXmlHttp
		} 
		catch(e)
		{ 
			alert("Error. Scripting for ActiveX might be disabled") 
			return 
		} 
	} 
	if (navigator.userAgent.indexOf("Mozilla")>=0)
	{
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler 
		return objXmlHttp
	}
} 