function del_space(s)
{
	for(i=0;i<s.length;++i)
	{
	 if(s.charAt(i)!=" ")
		break;
	}
	for(j=s.length-1;j>=0;--j)
	{
	 if(s.charAt(j)!=" ")
		break;
	}
	return s.substring(i,++j);
}
function VerifySubmit()
{
	//uid = del_space();
     if(document.regform.yhlb.value=="")
     {
        alert("请选择会员类型！");	
		return false;
     }
	
     if(document.regform.uid.value=="")
     {
        alert("您忘了填写登陆帐号!");	
		return false;
     }
	pwd = del_space(document.regform.pwd.value);
     if (pwd.length == 0)
     {
        alert("您忘了填写密码!");
	return false;
     }
	uname = del_space(document.regform.uname.value);
     if (uname.length == 0)
     {
        alert("您忘了填写姓名!");
        return false;
     }
	email = del_space(document.regform.email.value);
     if (email.length == 0)
     {
        alert("您忘了填手机号!");
	return false;
     }
	tel = del_space(document.regform.tel.value);
     if (tel.length < 8)
     {
        alert("电话最少8位阿!");
        return false;
     }
	
	yhlb=del_space(document.regform.yhlb.value);
	if(yhlb=='中介')
	{
		tishi=del_space(document.regform.tishi.value);
			 if (tishi.length == 0)
			{
			   alert("请填写店名");
				 return false;
			}
		tsda=del_space(document.regform.tsda.value);
			 if (tsda.length == 0)
			 {
				alert("请填写地址");
				return false;
			 }
		 xb=del_space(document.regform.xb.value);
			 if (xb.length == 0)
			{
				  alert("请选择区域");
				  return false;
			 }
	}

	return true;
}
 
function change_type()
{
	if(document.regform.yhlb.value=='')
	{
		document.getElementById('tab1').style.display='none';		
	}
	if(document.regform.yhlb.value=='个人')
	{
		document.getElementById('tab1').style.display='none';
	}
	if(document.regform.yhlb.value=='中介')
	{
		document.getElementById('tab1').style.display='block';		
	}
}

 function createxmlhttp()
    {
        var xmlhttp=false;
        try    {xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}
        catch (e) {
            try{xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
            catch (e) {xmlhttp = false;}
                 }if (!xmlhttp && typeof XMLHttpRequest!='undefined')
                    {xmlhttp = new XMLHttpRequest();
                 if (xmlhttp.overrideMimeType)
                    {xmlhttp.overrideMimeType('text/xml');}}//设置MiME类别
        return xmlhttp;   
    }

function RegUserCheck()
{
var xml = createxmlhttp();
    username2=document.getElementById("uid").value; 
    xml.open("get","jc.asp?UserNameQ="+username2+"",false);
xml.send();

   if (xml.responseText == 0)
   {  document.getElementById('chekRegName').style.color='green'; 
      document.getElementById('chekRegName').innerHTML="√可以注册";
   }
 else if (xml.responseText == 1)
   {
	  document.getElementById('chekRegName').style.color='red';
      document.getElementById('chekRegName').innerHTML="×已被占用";
   }
   else
   {  document.getElementById('chekRegName').style.color='blue';
      document.getElementById('chekRegName').innerHTML="！发生错误";
   }
}
