/*  用户注册 */	
		function submitform()
		{	
			if(!checkUN())return false;
			//if(!checkname())return false;
			if(!checkPwd())return false;
			if(!checkConPwd())return false;
			if(!checkMail())return false;
			/*if(!checkname())return false;*/	
			if(!checkUN())return false;

            
			if(Form1.RadioButtonListSex[0].checked ==false && Form1.RadioButtonListSex[1].checked == false) 
			{
				window.alert("请正确选择性别！");
				return false;
			}
	


		}
			function ConfirmDel()
	{
	if(confirm("你确定要删除吗？"))
			return true;
		else
			return false;
	}
	/*	function checkStr(){ 
			var r, re;         
			var s = Form1.TextBoxUserName.value;
			re = /^\\w+$/;      
			r = s.test(re);   
			return(r); //Return array containing all four
		}*/
		function isEmail(theStr)
		{
			var unchar="/\\;:,";
			var atIndex = theStr.indexOf('@');
			var dotIndex = theStr.indexOf('.', atIndex);
			var flag = true;
			for (i=0;i<theStr.length;i++){	
				if (unchar.indexOf(theStr.substr(i,1)) > -1){
					return false;		
				}
			}
			theSub = theStr.substring(0, dotIndex+1)
			if ((atIndex < 1)||(atIndex != theStr.lastIndexOf('@'))||(dotIndex < atIndex + 2)||(theStr.length <= theSub.length)) 
			{	flag = false; }
			else { flag = true; }
			return(flag);
		}
		function cnLength(Str) {
			var escStr = escape(Str);
			var numI = 0;
			var escStrlen = escStr.length;
			for (i = 0;  i < escStrlen;  i++) 
			if(escStr.charAt(i) == '%') 
			if(escStr.charAt(++i) == 'u')  numI ++;
			return Str.length+numI;
		}
		function checkPwd()
		{
			if (Form1.TextBoxPassword.value == "")			
			{
				Password_div.innerHTML = "未填写密码！";
				//Form1.TextBoxPassword.focus();				
				return false;						
			}
			if (cnLength(Form1.TextBoxPassword.value) > 20)			
			{
				Password_div.innerHTML = "密码太长！";	
				//Form1.TextBoxPassword.focus();			
				return false;						
			}
			if (cnLength(Form1.TextBoxPassword.value) < 5)			
			{
				Password_div.innerHTML = "密码太短！";	
				//Form1.TextBoxPassword.focus();			
				return false;						
			}
			Password_div.innerHTML = "<font color='green'>√</font>";
			return true;
		}
	function checkname()
		{

         if (cnLength(Form1.sname.value) < 4)			
			{
				nicheng_div.innerHTML = "用户名太短！";	
				//Form1.TextBoxPassword.focus();			
				return false;						
			}
			if (cnLength(Form1.sname.value) > 10)			
			{
				nicheng_div.innerHTML = "用户名太长！";	
				//Form1.TextBoxPassword.focus();			
				return false;						
			}
			nicheng_div.innerHTML = "<font color='green'>√</font>";
			return true;
		}


		function checkConPwd()
		{
			if (Form1.TextBoxPasswordAff.value == "")			
			{
				ConPassword_div.innerHTML = "未填写密码确认！";	
				//Form1.TextBoxPasswordAff.focus();			
				return false;						
			}
			if (Form1.TextBoxPasswordAff.value != Form1.TextBoxPassword.value)			
			{
				ConPassword_div.innerHTML = "密码确认与密码不符！";
				//Form1.TextBoxPasswordAff.focus();				
				return false;						
			}
			if (Form1.TextBoxUserName.value == Form1.TextBoxPassword.value)			
			{
				ConPassword_div.innerHTML = "密码不能与用户名重复！";
				//Form1.TextBoxPasswordAff.focus();				
				return false;						
			}
			ConPassword_div.innerHTML = "<font color='green'>√</font>";
			return true;
		}
			function checkMail()
		{
			if (document.getElementById("email").value == "")			
			{
				//Mail_div.innerHTML = "未填写邮件地址！";
				alert("未填写邮件地址！");
				//Form1.TextBoxEMail.focus();				
				return false;						
			}
			if (!isEmail(document.getElementById("email").value))
			{
				//Mail_div.innerHTML = "邮件地址有误！";
				alert("邮件地址有误！");
				//Form1.TextBoxEMail.focus();					
				return false;
			}
			Mail_div.innerHTML = "<font color='green'>√</font>";
			return true;
			
		}


function checknum()
		{
			if (Form1.num.value == "")			
			{
				num_div.innerHTML = "正确填写验证码！";
				//Form1.TextBoxEMail.focus();				
				return false;						
			}

			num_div.innerHTML = "";
			return true;
			
		}

		 function checkUN()
		{	

			if (Form1.TextBoxUserName.value == "")			
			{
				UserName_div.innerHTML = "未填写用户名！";	
				//Form1.TextBoxUserName.focus();			
				return false;						
			}
			if (cnLength(Form1.TextBoxUserName.value) > 16)			
			{
				UserName_div.innerHTML = "用户名太长！";	
				//Form1.TextBoxUserName.focus();			
				return false;						
			}	
			if (cnLength(Form1.TextBoxUserName.value) < 4)			
			{
				UserName_div.innerHTML = "用户名太短！";
				//Form1.TextBoxUserName.focus();				
				return false;						
			}
			UserName_div.innerHTML = "<font color='green'>√</font>";
			return true;
		}


		//-->
	
/*  伯客注册 */	
function showadv(){
if (document.Form1.advshow.checked == true) {
        adv.style.display = "";
        advance.innerText="关闭申请博客选项:";
}else{
        adv.style.display = "none";
        advance.innerText="我要申请博客:";
}


}

/*  搜索控制 */	

 function isKeyword(s)

 {

 	var a, errorChar;

	var badChar = "><,[]{}?/+=|\\'\":;~!@#$%^&()`"; 

   	if ( isEmpty(s) )

	{

		a = confirm("如果您不输入任何查询关键字，您可能会得到太多的查询结果。\n\n您确定要进行查询吗？");	

		if (a == false)

			return false;

	}

	else

	{

		//is s contain invalid characters

		//Validate the user name

		errorChar = isCharsInBagEx( s, badChar)

	    	if (errorChar != "" )

		{

			alert("请不要在查询关键字中输入字符" + errorChar + "\n\n请重新输入！" );

			return false;

		} 	

	}

	return true;

 }

 

 function isItemNum(s)

 {

 	if (isEmpty(s))

	{

		alert("请输入物品编号进行查询！");

 		return false;

	}

	var validChar = "0123456789"; 

	if (!isCharsInBag(s, validChar))

	{

		alert("您输入的物品编号" + s +"是无效的物品编号，\n\n请输入合法的物品编号！");

 		return false;

	}

	return true;		

 }

 
 
 /*  用户登陆 */	

	function CheckForm()
	{
		if(document.UserLogin.username.value=="")
		{
			alert("请输入用户名");
			document.UserLogin.username.focus();
			return false;
		}
		if(document.UserLogin.password.value == "")
		{
			alert("请输入密码");
			document.UserLogin.password.focus();
			return false;
		}
	}
 /*  论坛发表主题 */		
	  function Checkbbsform()
{

	if (document.all.bbsform.title.value==""){
		alert("请输入发表主题");
		document.bbsform.title.focus(); 
		return false
	}
	if(document.all.bbsform.content.value==""){
		alert("你任何内容都不留下吗？");
		document.bbsform.content.focus(); 
		return false
	}
	
}	
 /*  BLOG评论 */	
	  function Checkblogreply()
{

	if (document.blogreply.title.value==""){
		alert("请输入评论标题");
		document.blogreply.title.focus(); 
		return false
	}
	if (document.blogreply.autor.value==""){
		alert("名称必须填写");
		document.blogreply.autor.focus(); 
		return false
	}	if(document.blogreply.content.value==""){
		alert("你任何内容都不留下吗？");
		document.blogreply.content.focus(); 
		return false
	}
	
}

 /*  BLOG评论 */	
	  function Checkblform()
{

	if (document.blform.producer_name.value==""){
		alert("请输入博客名称");
		document.blform.producer_name.focus(); 
		return false
	}
	if (document.blform.sname.value==""){
		alert("真实姓名必须填写");
		document.blform.sname.focus(); 
		return false
	}	if(document.blform.huangye.value==""){
		alert("请把行业填写完整");
		document.blform.huangye.focus(); 
		return false
	}
		if(document.blform.zhiye.value==""){
		alert("请填写职业");
		document.blform.zhiye.focus(); 
		return false
	}
}

	  function Checksendpw()
{

	if (document.sendpw.name.value==""){
		alert("请输入你的用户ID！");
		document.sendpw.name.focus(); 
		return false
	}
	if (document.sendpw.quesion.value==""){
		alert("请填写你的密码问题");
		document.sendpw.quesion.focus(); 
		return false
	}	if(document.sendpw.answer.value==""){
		alert("请正确填写你的问题答应");
		document.sendpw.answer.focus(); 
		return false
	}
}



/*  
**    ==================================================================================================  
**    类名：CLASS_LIANDONG_YAO  
**    功能：多级连动菜单  
**    
** 
**    ==================================================================================================  
**/  	
  function CLASS_LIANDONG_YAO(array)
  {
   //数组，联动的数据源
  	this.array=array; 
  	this.indexName='';
  	this.obj='';
  	//设置子SELECT
	// 参数：当前onchange的SELECT ID，要设置的SELECT ID
      this.subSelectChange=function(selectName1,selectName2)
  	{
  	//try
  	//{
    var obj1=document.getElementById(selectName1);
    var obj2=document.getElementById(selectName2);
    var objName=this.toString();
    var me=this;
  
    obj1.onchange=function()
    {
    	
    	me.optionChange(this.options[this.selectedIndex].value,obj2.id)
    }
  	}
  	//设置第一个SELECT
	// 参数：indexName指选中项,selectName指select的ID
  	this.firstSelectChange=function(indexName,selectName)  
  	{
  	this.obj=document.getElementById(selectName);
  	this.indexName=indexName;
  	this.optionChange(this.indexName,this.obj.id)
  	}
  
  // indexName指选中项,selectName指select的ID
  	this.optionChange=function (indexName,selectName)
  	{
    var obj1=document.getElementById(selectName);
    var me=this;
    obj1.length=0;
    obj1.options[0]=new Option("请选择",'');
    for(var i=0;i<this.array.length;i++)
    {	
    
    	if(this.array[i][1]==indexName)
    	{
    	//alert(this.array[i][1]+" "+indexName);
      obj1.options[obj1.length]=new Option(this.array[i][2],this.array[i][0]);
    	}
    }
  	}
  	
  }
  
	function CLASS_LIANDONG_YAO2(array){
	   //数组，联动的数据源
		this.array=array; 
		this.indexName='';
		this.obj='';
		
		//设置子SELECT
		// 参数：当前onchange的SELECT ID，要设置的SELECT ID
		this.subSelectChange=function(selectName1,selectName2){
			var obj1=document.getElementById(selectName1);
			var obj2=document.getElementById(selectName2);
			var objName=this.toString();
			var me=this;
			obj1.onchange=function(){
				me.optionChange(this.options[this.selectedIndex].value,obj2.id)
			}
		}
		
		//设置第一个SELECT
		// 参数：indexName指选中项,selectName指select的ID
		this.firstSelectChange=function(indexName,selectName)  
		{
			this.obj=document.getElementById(selectName);
			this.indexName=indexName;
			//this.indexName="根目录"、this.obj.id="s1"
			this.optionChange(this.indexName,this.obj.id)
		}
	  
	  // indexName指选中项,selectName指select的ID
		this.optionChange=function (indexName,selectName)
		{
			//第一次：indexName="根目录"、selectName="s1"
			//选择区时：indexName="南山区"、selectName="address"
			var obj1=document.getElementById(selectName);
			var me=this;
			obj1.length=0;
			
			if(indexName == "根目录" || indexName == "宝安区" || indexName == "龙岗区"){
				obj1.style.display="block";
				if(indexName == "根目录"){
					obj1.options[0]=new Option("请选择",'');
				}
				for(var i=0;i<this.array.length;i++){	
					if(this.array[i][1]==indexName){
						obj1.options[obj1.length]=new Option(this.array[i][2],this.array[i][0]);
					}
				}
			}else{
				obj1.style.display="none";
			}
		}
  }

  function reg_info1(){
	  var username=$('#username');
	  //var user_lc=$('#user_lc');
	  var newpassword=$('#newpassword');
	  var new2password=$('#new2password');
	  var identily=$('#identily');
	  var email=$('#email');
	  var mobile=$('#mobile');
	   var validate=$('#validate');
	  var answer=$('#answer');
	  var quesion=$('#quesion');
	  if(username.val()==""){
	  username.focus();
	  alert("用户名不可以为空");
	  checkUsername();
	  return false;
	  //}else if(user_lc.val()==""){
	  //user_lc.focus();
	 // alert("姓名不可以为空");
	 // checkUser_lc()
	 // return false;
	  }else if(newpassword.val()==""){
	  newpassword.focus();
	  alert("密码不可以为空");
	  checkNPassword();
		  return false;
	  }else if(new2password.val()==""){
	  new2password.focus();
	  alert("确认密码不可以为空");
	  checkN2Password();
		  return false;
	  }else if(new2password.val()!=newpassword.val()){
	  new2password.focus();
		new2password.value="";
		newpassword.value="";
		alert("两次密码输入不同，请重新填写");
		  return false;
	  }else if(identily.val()==""){
		  alert("请输入您的身份证号!");
		  identily.focus();
		  checkIdentily();
			return false;
	  }else if(email.val()==''){
		alert("请输入您的邮箱地址!");
		email.focus();
		checkEmail();
		return false;
	  }else if(mobile.val()==''){
		alert("请输入您的手机号码!");
		mobile.focus();
		checkMobile();
		return false
	}else if(validate.val()==''){
		alert("请输入手机验证码!");
		checkValidate();
		validate.focus();
		return false	
	  }else if(quesion.val()==""){
	  quesion.focus();
	  alert("提示问题不可以为空");
	  checkQuesion();
	  return false;
	  }else if(answer.val()==""){
	  answer.focus();
	  alert("答案不可以为空");
	  checkAnswer();
		  return false;
	  }else if(document.getElementById('agree').checked == false){
		alert("请阅读深圳行租车网服务条款!");
		return false;
	  }

		return true;
  }
  
  function reg_join(){
	  if(document.joinReg.name.value=="")
		{
			alert("请输入公司名称");
			document.joinReg.cname.focus();
			return false;
		} 
	 if(document.joinReg.address.value=="")
		{
			alert("请输入公司地址");
			document.joinReg.address.focus();
			return false;
		} 
	 if(document.joinReg.cname.value=="")
		{
			alert("请输入联系人");
			document.joinReg.cname.focus();
			return false;
		} 
	 if(document.joinReg.phone.value=="")
		{
			alert("请输入联系电话");
			document.joinReg.phone.focus();
			return false;
		} 
	 if(document.joinReg.email.value=="")
		{
			alert("请输入电子邮箱");
			document.joinReg.email.focus();
			return false;
		} 	
  }