function regInput(obj, reg, inputStr)
	{
		var docSel	= document.selection.createRange()
		if (docSel.parentElement().tagName != "INPUT")	return false
		oSel = docSel.duplicate()
		oSel.text = ""
		var srcRange	= obj.createTextRange()
		oSel.setEndPoint("StartToStart", srcRange)
		var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
		return reg.test(str)
	}


function checkstr(str,digit){
	var n=0;
	for(i=0;i<str.length;i++){
		var leg=str.charCodeAt(i);
		if(leg>255){
		   	n+=2;
		}else {
			n+=1;
		}
	}
	if (n>digit){
		return true;
	}else {
		return false;
	}	 	 
}	
function checkhyzc(){
var name1=hyzcform.hyname.value;
	if(name1==""){
		alert("会员名称不能为空");
		hyzcform.hyname.focus();
		return;
	}else{
		if(checkstr(name1,20)){
			alert("会员名称长度不能超过20个字符，请重新输入！");
			hyzcform.hyname.focus();
			return;
		}
	}
var name22=hyzcform.hyxb.value;
	if(name22=="0"){
		alert("请选择会员性别");
		hyzcform.hyxb.focus();
		return;
	}

if(checkstr(document.hyzcform.hymima.value) || document.hyzcform.hymima.value.length < 6 || document.hyzcform.hymima.value.length >20) {
	document.hyzcform.hymima.focus();
    alert("密码长度不能这空，在6位到20位之间，请重新输入！");
	return false;
  }
    if(document.hyzcform.hymima.value != document.hyzcform.hymima1.value) {
	document.hyzcform.hymima.focus();
	document.hyzcform.hymima.value = '';
	document.hyzcform.hymima1.value = '';
    alert("两次输入的密码不同，请重新输入！");
	return false;
  }
var name3=hyzcform.quesion.value;
	if(name3==""){
		alert("请您填写找回密码的问题");
		hyzcform.quesion.focus();
		return;
	}else{
		if(checkstr(name3,30)){
			alert("问题不能超过30个字符，请重新输入！");
			hyzcform.quesion.focus();
			return;
		}
	}

var name6=hyzcform.answer.value;
	if(name6==""){
		alert("找回密码的问题答案不能为空");
		hyzcform.answer.focus();
		return;
	}else{
		if(checkstr(name6,30)){
			alert("答案的长度不能超过30个字符，请重新输入！");
			hyzcform.answer.focus();
			return;
		}
	}
	
var name7=hyzcform.userzhenshiname.value;
	if(name7==""){
		alert("真实姓名不能为空");
		hyzcform.userzhenshiname.focus();
		return;
	}else{
		if(checkstr(name7,30)){
			alert("真实姓名长度不能超过30个字符，请重新输入！");
			hyzcform.userzhenshiname.focus();
			return;
		}
	}

var name908=hyzcform.hydizhi.value;
	if(name908==""){
		alert("地址不能为空");
		hyzcform.hydizhi.focus();
		return;
	}else{
		if(checkstr(name908,50)){
			alert("地址长度不能超过50个字符，请重新输入！");
			hyzcform.hydizhi.focus();
			return;
		}
	}
var name9=hyzcform.hytel.value;
	if(name9==""){
		alert("电话号码不能为空");
		hyzcform.hytel.focus();
		return;
	}else{
		if(checkstr(name9,40)){
			alert("电话号码不能超过40个字符，请重新输入！");
			hyzcform.hytel.focus();
			return;
		}
	}
	
var name10=hyzcform.hyemail.value;
	if(name10==""){
		alert("电子邮箱不能为空");
		hyzcform.hyemail.focus();
		return;
	}else{
		if(checkstr(name10,40)){
			alert("电子邮箱不能超过40个字符，请重新输入！");
			hyzcform.hyemail.focus();
			return;
		}
	}

	       if (document.hyzcform.hyemail.value.charAt(0)=="." ||        
         document.hyzcform.hyemail.value.charAt(0)=="@"||       
         document.hyzcform.hyemail.value.indexOf('@', 0) == -1 || 
         document.hyzcform.hyemail.value.indexOf('.', 0) == -1 || 
         document.hyzcform.hyemail.value.lastIndexOf("@")==document.hyzcform.hyemail.value.length-1 || 
         document.hyzcform.hyemail.value.lastIndexOf(".")==document.hyzcform.hyemail.value.length-1)
     {
      alert("Email地址格式不正确！");
      document.hyzcform.hyemail.focus();
      return false;
      }

var name100=hyzcform.qq.value;
	if(name100==""){
		alert("qq不能为空");
		hyzcform.qq.focus();
		return;
	}else{
		if(checkstr(name100,30)){
			alert("qq不能超过30个字符，请重新输入！");
			hyzcform.qq.focus();
			return;
		}
	}

var name500=hyzcform.SafeCode.value;
	if(name500==""){
		alert("验证码不能为空");
		hyzcform.SafeCode.focus();
		return;
	}
	hyzcform.submit();
}				     

