﻿// JavaScript Document
var xmlhttp
try{
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(E)
{
try{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(E)
{
xmlhttp=new XMLHttpRequest();
}
}

function checkUser(username){
	
         if(username!=""){
          var oDoc = new ActiveXObject("MSXML2.DOMDocument"); 
          xmlhttp.open("POST", "checkreguser.asp?username="+username, true); 
          xmlhttp.onreadystatechange=checking;
          xmlhttp.send(""); 
         }
    
}

function checking()
{

if(xmlhttp.readystate<4){
 document.getElementById("showArea").innerHTML ="&nbsp;searching……";

}
if(xmlhttp.readyState==4){
 
  if(xmlhttp.status == 200)
      {
            result = xmlhttp.responseText; 
            if(parseInt(result)==0){
           //  document.getElementById("showArea").style.display='';
		   
            document.getElementById("showArea").innerHTML ="<span class=green>this username can be register!</span>";
            //document.getElementById("chk").value="0";
            }
            else if(parseInt(result)>0){
           //  document.getElementById("showArea").style.display='';
            document.getElementById("showArea").innerHTML ="<span class=red>the username has been registered,please change it,thank you!</span>";
            //document.getElementById("chk").value="1";
            }
           }
       else
       {
        
          document.getElementById("showArea").innerHTML = "searching……";   
        }
}
}
