﻿function dwhois(domain,ext,id,domainid){	
	var postStr="domain="+escape(domain)+"&ext="+escape(ext)+"&domainid="+domainid;
	var xmlhttp;
	try{
		xmlhttp= new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(e){
			try{
				xmlhttp= new XMLHttpRequest();
			}catch(e){}
		}
	}
	xmlhttp.onreadystatechange= function(){DomainResult(id,domain,ext)}
	xmlhttp.open("post","domaininfo.aspx", true);
	xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	xmlhttp.send(postStr);
	/**/
	function DomainResult(id,domain,ext)
    {
      if(xmlhttp.readyState==4)
      {
		if(xmlhttp.status==200)
		{		  
		    var resluta;
            resluta = xmlhttp.responseText;
            if (resluta.indexOf("1000")>0 )
		    {
			   document.getElementById ("d"+id).innerHTML ="可以注册 <a href=\"domainreg.aspx?domain="+escape(domain)+"&ext="+escape(ext)+"\" class=\"a_001\">点击注册</a>";
			}
			else if (resluta.indexOf("1001")>0)
			{
			  document.getElementById ("d"+id).innerHTML ="不能注册";
			}
			else if (resluta.indexOf("1002")>0)
			{
			  document.getElementById ("d"+id).innerHTML ="查询失败 <a href=\"#\" onclick=\"dwhois("+domain+","+ext+","+id+",\"1\")\" class=\"a_001\">重查</a>";
			}
			else if (resluta.indexOf("1003")>0)
			{
			  document.getElementById ("d"+id).innerHTML ="错误的域名";
			}
			else if (resluta.indexOf("1004")>0)
			{
			  document.getElementById ("d"+id).innerHTML ="查询超时 <a href=\"#\" onclick=\"dwhois("+domain+","+ext+","+id+",\"1\")\" class=\"a_001\">重查</a>";
			}
			else 
			{
			  document.getElementById ("d"+id).innerHTML ="未知结果";
			}
		}
		else
		{
			document.getElementById ("d"+id).innerHTML ="接口繁忙";
		}
       }

     }
}


