function chkForm()
{
   //得到选定的区域
   if($('hidIsDistV')&&$('hidIsDistV').value=='1')
   {
            $('hidDist').value='';
            var dist=document.getElementsByName ("areaDistrictList");
            var hiddendist=$('hidDist').value;
            for(var i=0;i<dist.length;i++)
            {
                if(dist[i].checked==true)
                {
                    hiddendist+=dist[i].value+",";
                }
            }
            if(hiddendist.length>0)
            {
                    $('hidDist').value=hiddendist.substr(0,hiddendist.length-1);
            }
            else
            {
                   alert('购房区域是必选项');
                   return false;
            }
   }
   //得到楼盘列表
   if($('hidIsSelBuilding')&&$('hidIsSelBuilding').value=='1')
   {
      var proj='';
            var length = $("SelectFloorItem").options.length - 1;   
            for(var i = length; i >= 0; i--)
            {    
                if($("SelectFloorItem").options[i].text)
                {   
                    proj+=$("SelectFloorItem").options[i].text+"-"+$("SelectFloorItem").options[i].value+',';
                } 
            }
      if(proj.length>0)
      {

         //alert(proj);
         proj=proj.substr(0,proj.length-1);
         //alert(proj);
         $('hidBuilding').value='';
         $('hidBuilding').value=proj;
      }
      else
      {
         alert('意向楼盘是必填项');
         return false;
      }
   }

   
		//得到楼盘类型选项
		//debugger;
       var chkvals='';
       chkvals=GetChkValeByName("BType");
       if(chkvals=="0")
       {
          $('hidBType').value="";
       }
       else
       {
           if(chkvals.length<=0)
           {
              alert('物业类别为必选项');
              return false;
           }
           else
           {
               $('hidBType').value=chkvals;
               //alert($('hidBType').value);
           }
       }
       if(checkText('Budget','购房预算')==false)
       {
          return false;
       }
       chkvals=GetChkValeByName("BFor");
       if(chkvals=="0")
       {
          $('hidBFor').value="";
       }
       else
       {
           if(chkvals.length<=0)
           {
              alert('购房用途为必选项');
              return false;
           }
           else
           {
               $('hidBFor').value=chkvals;
               //alert($('hidBFor').value);
           }
       }
	   chkvals=GetChkValeByName("BuyTime");
	   if(chkvals=="0")
       {
          $('hidBuyTime').value="";
       }
       else
       {
           if(chkvals.length<=0)
           {
              alert('购房时间为必选项');
              return false;
           }
           else
           {
               $('hidBuyTime').value=chkvals;
               //alert($('hidBuyTime').value);
           }
       }
   
   if($('hidProince').value=='全国'){
   if($('select_city2'))
   {
     var index=$('select_city2').selectedIndex;
     if($('select_city2').options[index].value!="")
     {
       $('hidCity').value=$('select_city2').options[index].value;
       //alert($('hidCity').value);
       fillPro($('hidCity').value,'hidProince');
       //alert($('hidProince').value);
       
     }
   }
   }
       
   if($('hidCity').value=='')
   {
      alert('城市参数错误');
      return false;
   }
   
   if(checkText('Number','报名人数')==false)
       {
          return false;
       }    
       
   if($('Name').value=='')
   {
      alert('姓名不能为空');
      $('Name').focus();
      return false;
   }

   if($('Phone').value=='')
   {
      alert('手机不能为空');
      $('Phone').focus();
      return false;
   }
   if(!validatemobile($('Phone').value))
   {
      alert("手机号格式不正确！");
      $('Phone').focus();
      return false;
   }
   if($('Email').value=='')
   {
      alert('邮箱不能为空');
      $('Email').focus();
      return false;
   }
      var pat = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
		if (!pat.test($('Email').value))
		{
		     alert('邮箱格式不正确');
             $('Email').focus();
			return false
		}

       if(checkText('Address','地址')==false)
       {
          return false;
       }
       if(checkText('PCode','邮编')==false)
       {
          return false;
       }
       if(checkText('Salary','年收入')==false)
       {
          return false;
       }
       
       if(checkText('CName','公司名称')==false)
       {
          return false;
       }
       if(checkText('Position','职位')==false)
       {
          return false;
       }
       //alert($('hidCity').value);
     //$('FormSignUp').submit();
     document.all.submit.click();
}
//验证输入项
function checkText(id,msg)
{
    if(id&&id.length>0)
    {
        var eles = document.getElementById(id);
	    if(eles)
	    {
           if(eles.value=="")
           {
              alert(msg+"是必填项");
              eles.focus();
              return false;
           }
        }
    }
}
//得到checkbox的值
function GetChkValeByName(n)
{ 
    var val='';
    if(n&&n.length>0)
    {
        var eles = document.getElementsByName(n);
	    if(eles&&eles.length>0)
	    {
            var eleLen = eles?eles.length:0;
            var ele;

            for(var i=0;i<eleLen;i++)
            {
                ele = eles[i];
                if(ele &&ele.checked==true)
                {
                    val+=ele.value+',';
                }
             }
             if(val.length>0)
             {
                val=val.substr(0,val.length-1);
             }
        }
        else
        {
           val='0';
        }
    }
    return val;
}
 
 function  fillPro(val,obj)
 {
    var pv = $(obj);
		    if(pv){
		        var cv=val;
		        for(i=0;i<CP.length;i++){
		            var cityArray=new Array;
		            cityArray=CP[i].split(",");
		            if(cityArray.length==2){
		               if(cityArray[0]==cv){
		                  pv.value=cityArray[1]; 
		               }
		             }
		        }
		    }
 }
 
 function validatemobile(mobile)
     {    
         if(mobile.length!=11)
         {
             return false;
         }
        if(mobile.length==11)
        {
             
             var myreg = /^13[0-9]{1}[0-9]{8}$|^15[0,1,2,3,4,5,6,7,8,9]{1}[0-9]{8}$|^18[0,1,2,3,4,5,6,7,8,9]{1}[0-9]{8}$/;
             if(!myreg.test(mobile))
             {
                 return false;
             }
        }
        return true;
     }
   var curCity = $("hidCity").value;
   SF_Select.__init("td_select_city","td_select_dist","select_city",curCity);