var iCount=0;
var _reBack=function(ret){
	$(".checkDomain li:eq("+iCount+") span").html(ret);
	var max=$(".checkDomain li").size();
	if(iCount<max){
		iCount++;
		var doMain=$(".checkDomain li:eq("+iCount+")").attr("id");
		getPost("/api/llsapi.asp?apiAction=checkDomainComplete","doMain="+doMain,"_reBack");		
		}
	}
var _callBack=function(ret){
	$(".checkDomain").html(ret);
	iCount=0;
	var doMain=$(".checkDomain li:eq("+iCount+")").attr("id");
	getPost("/api/llsapi.asp?apiAction=checkDomainComplete","doMain="+doMain,"_reBack");	
	}	
$(function(){

	$("form[name=searchDomain]").submit(function(){
		var Doc=$(this);
		var doMain=Doc.find("input[name=domain]").val();
		if(doMain.replace(/[(a-zA-Z0-9)+|\-]/ig,"")!=""||doMain=="") {Doc.find("input[name=domain]").focus();alert("请输入要查询的域名或者查询的域名不合法");return false;}
		var PostStr="";
		Doc.find("input[type=checkbox]:checked").each(function(){
			PostStr+="&"+$(this).attr("name")+"=yes"
			})
	
		if(PostStr=="") {alert("请选择要查询的域名后缀");return false;}
		PostStr="domain="+doMain+PostStr;
		$(".checkDomain").html("查询中...");
		getPost("/api/llsapi.asp?apiAction=checkDomain",PostStr,"_callBack");
		return false;										 
		})
	Parm=location.search.substr(1);
    if(Parm.length > 0) 
    {
      ar = Parm.split(/[&=]/);
	  $("input:checked").prop("checked",false);
      for(i=0;i<ar.length;i+=2) 
      {
        if(ar[i]=="domain"){
			$("#domain").val(ar[i+1]);
			}
		if(ar[i+1]=="yes"){
			$("input[name='"+ar[i]+"']").prop("checked",true);
			}	
		//alert("参数:"+ar[i]+":"+ar[i+1]+"<br>");
      }
	  $("form[name=searchDomain]").trigger("submit");
    }    

	});