var xmlHttp
var NeedAjax
function showQuery(str){
    xmlHttp=GetXmlHttpObject()
    if(str==""){
     document.getElementById("txtHint").innerHTML="<img src='images/error.gif'/>  Please enter the username"
	 
     return false
    }
	else{
　　　　　　var pattern = /^[a-zA-Z0-9_-]{1,100}$/;
  if (!pattern.test(str)){
            
　　　
             document.getElementById("txtHint").innerHTML="<img src='images/error.gif'/>  Only letters,number,and hyphens are allowed"
	
	 return(false);
      } 
    else{
    var url="selectusername.php"
    url=url+"?q="+str
    url=url+"&sid="+Math.random()
    xmlHttp.onreadystatechange=stateChanged
    xmlHttp.open("POST",url,true)
    xmlHttp.send(url)
    }}
}
function stateChanged(){
    if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){    
      document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
	 
    }
}
function showcheckcode(str){
	xmlHttp=GetXmlHttpObject()
  if(str==""){
     document.getElementById("code").innerHTML="<img src='images/error.gif'/>  Please enter the check code"}
	else{ var url="selectusername.php"
    url=url+"?code="+str
    url=url+"&sid="+Math.random()
    xmlHttp.onreadystatechange=stateCheck
    xmlHttp.open("POST",url,true)
    xmlHttp.send(url)}
 }
 function stateCheck(){
    if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){    
      document.getElementById("code").innerHTML=xmlHttp.responseText 
	 
    }
}
function showpwd1(str){
	if(str==""){
     document.getElementById("password1").innerHTML="<img src='images/error.gif'/>  Please enter the password"
	
     return false
    }

   if(str.length<6){ document.getElementById("password1").innerHTML="<img src='images/error.gif'/>   Your password strength  at least 6 characters"
                   
				    
				   }else{document.getElementById("password1").innerHTML="<img src='images/ok.gif'/> "}
   
                      }


function showpwd2(str){
  if(str==""){
     document.getElementById("password2").innerHTML="<img src='images/error.gif'/>  Please confirm the password"
	 
     return false
    }else{
	var str2=document.getElementById("pwd").value

   if(str!=str2){ document.getElementById("password2").innerHTML="<img src='images/error.gif'/>  Please verify your password again" }else{document.getElementById("password2").innerHTML="<img src='images/ok.gif'/>"}
      
                      }
                }
function showemail(str){
  if(str==""){
     document.getElementById("mail").innerHTML="<img src='images/error.gif'/>  Please enter the E-mail"
	
     return false
    }else{


   if(str.indexOf('@')<0){ document.getElementById("mail").innerHTML="<img src='images/error.gif'/>  Please verify your E-mail address" }else{document.getElementById("mail").innerHTML="<img src='images/ok.gif'/>"}
      
                      }
                }
				
function showaddress(str){
  if(str==""){
     document.getElementById("address").innerHTML="<img src='images/error.gif'/>  Please enter the address"}
	else{document.getElementById("address").innerHTML="<img src='images/ok.gif'/>"}
 }
 function showcountry(str){
	var str3=document.getElementById("countryName").value
		
  if(str3=="-1"){
    document.getElementById("country").innerHTML="<img src='images/error.gif'/>  Please  choose a country" }
	else{document.getElementById("country").innerHTML="<img src='images/ok.gif'/>"}
 } 

function showquestion(str){
	var str3=document.getElementById("ts1").value
		var str4=document.getElementById("ts2").value
  if((str3=="1")&&(str4=="")){
    document.getElementById("question").innerHTML="<img src='images/error.gif'/>  Please enter or choose a secret question" }
	else{document.getElementById("question").innerHTML="<img src='images/ok.gif'/>"}
 } 

function showanswer(str){
  if(str==""){
    document.getElementById("answer").innerHTML="<img src='images/error.gif'/>  Please enter the secret answer" }
	else{document.getElementById("answer").innerHTML="<img src='images/ok.gif'/>"}
 } 
 
 
 
 

function GetXmlHttpObject(){
    var xmlHttp=null;
    try{
        
        xmlHttp=new XMLHttpRequest();
        
        }
    catch(e){
        try{
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
        catch(e){
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
        }
    return xmlHttp;
    
}
