﻿<!-- 
function handleHttpResponse(){
 if(http.readyState == 4){
	  if(http.status == 200){
	   var xmlDocument = http.responseXML;
		   if(http.responseText=="invalidation"){   
		   	document.getElementById("showStr").style.display = "block";
		    document.getElementById("showStr").innerHTML = "会员名格式有误";
		   }else{
				   if(http.responseText=="yes"){
						document.getElementById("showStr").style.display = "block";
						document.getElementById("showStr").innerHTML = "此会员名可以使用";
				   }else if(http.responseText=="no"){
						document.getElementById("showStr").style.display= "block";
						document.getElementById("showStr").innerHTML = "此会员名已被注册,请使用其它用户名";
				   }else{	
				   		document.getElementById("showStr").style.display = "none";
				   }
		    }
	   }
  }
}

var http = getHTTPObject();

function chkUser(frm){
  var name = document.frm.loginName.value;
  
  if(name.length>5&&name.length<21){
   var url = "checkMemberName.action?userName="+name;
   
   http.open("GET",url,true);
   http.onreadystatechange = handleHttpResponse;
   http.send(null);
 }
 else{
 	document.getElementById("showStr").style.display= "block";
    document.getElementById("showStr").innerHTML = "会员名应在2-20个字符之间!";
 }
 return;
}

  
  function _id(id) {
        return document.getElementById(id);
  }
  function   validate(frm){   
  	  var count = 0;
      for(i=0;i<frm.voteType.length;i++){   
	      if(frm.voteType[i].checked){ 
	      	  count++;     
	      }     
      }
      if(count==0){
      	alert('必须阅读并接受《中国互联网协会网络营销工作委员会章程》才能注册会员！');
      	return false;
      } 
       
      var obj = _id("memberName");
	   if (obj.value == "")
	   {
	        alert("请填写您的用户名！");
	        obj.focus();
	        obj.select();
	        return false;
	   }
	   if (obj.value.length < 1 || obj.value.length > 20)
        {
            alert("您输入的用户名不符合长度必须为2-20位！");
            obj.focus();
            obj.select();
            return false;
        }
        if ((obj.value).indexOf(" ") >= 0)
        {
            alert("您输入的用户名有空格！");
            obj.focus();
            obj.value = "";
            obj.select();
            return false;
        }
        obj = _id("loginPass");
        if (obj.value == "")
        {
            alert("请填写您的密码！");
            obj.focus();
            obj.select();
            return false;
        }
         if (obj.value.length < 6 || obj.value.length > 20)
        {
            alert("您输入的密码不符合长度必须为6-20位！");
            obj.focus();
            obj.select();
            return false;
        }
        if (obj.value != _id("repeatPass").value) {
            alert("两次填写的密码不一致，请重新填写！");
            _id("repeatPass").focus();
            obj.select();
            return false;
        }
        obj = _id("question");
        if (obj.value == "")
        {
            alert("找回密码问题不能为空！");
            obj.focus();
            obj.select();
            return false;
        }
        obj = _id("answer");
        if (obj.value == "")
        {
            alert("找回密码问题答案不能为空！");
            obj.focus();
            obj.select();
            return false;
        }
        
        obj = _id("trueName");
        if (obj.value == "")
        {
            alert("姓名不能为空！");
            obj.focus();
            obj.select();
            return false;
        }
        
         if (obj.value.length < 2 || obj.value.length > 20)
        {
            alert("您输入的真实姓名不符合长度必须为2-20位！");
            obj.focus();
            obj.select();
            return false;
        }
        
        obj = _id("contactWay");
        if (obj.value == "")
        {
            alert("联系方式不能为空！");
            obj.focus();
            obj.select();
            return false;
        }
        
        obj = _id("email");
        if (obj.value == "")
        {
            alert("请输入您的电子邮件地址！");
            obj.focus();
            obj.select();
            return false;
        }

        var filter = /^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
        if (!filter.test(obj.value)) {
            alert("邮件地址不正确,请重新填写！");
            obj.focus();
            obj.select();
            return false;
        }
        
        obj = _id("contactWay");
        if (obj.value == "")
        {
            alert("联系方式不能为空！");
            obj.focus();
            obj.select();
            return false;
        }
        
         obj = _id("corpAllName");
        if (obj.value == "")
        {
            alert("企业全称不能为空！");
            obj.focus();
            obj.select();
            return false;
        }
        
         obj = _id("corpShortName");
        if (obj.value == "")
        {
            alert("企业简称不能为空！");
            obj.focus();
            obj.select();
            return false;
        }
        
          obj = _id("address");
        if (obj.value == "")
        {
            alert("联系地址不能为空！");
            obj.focus();
            obj.select();
            return false;
        }
        
          obj = _id("postNumber");
        if (obj.value == "")
        {
            alert("邮编不能为空！");
            obj.focus();
            obj.select();
            return false;
        }
        
        if (obj.value.length < 6||obj.value.length >6){
        	alert("邮编必须为六位数字！");
            obj.focus();
            obj.select();
            return false;
        }
        
 
      for(i=0;i<frm.callIds.length;i++){   
	      if(frm.callIds[i].checked){ 
	      	  count++;     
	      }     
      }
      if(count==1){
      	alert('成员所属行业至少选择一项！');
      	return false;
      }  
      return true;
  }   
  //--> 