function CheckForm() {
    if(RegForm.UserName.value=="")
    {
        alert("用户名不能为空，请输入用户名！");
        document.RegForm.UserName.focus();
        return false;
    }
    if(RegForm.UserName.value.length < 2)
    {
        alert("您的用户名太短了，请不要少于2个字符（1个汉字算一个字符）！");
        document.RegForm.UserName.focus();
        return false;
    }
    if(RegForm.UserName.value.length > 8)
    {
        alert("您的用户名太长了，请不要多于8个字符（1个汉字算一个字符）！");
        document.RegForm.UserName.focus();
        return false;
    }
	//var ssn=RegForm.UserName.value.toLowerCase();
	//if (!isSsnString(ssn))
	//{
	//	alert("对不起，您选择的用户名格式不正确！\n用户名应该由不区分大小写“a-z 0-9 ._-”字符组成！")
	//	document.RegForm.UserName.focus();
	//return false;
	//}
    if(RegForm.PassWord1.value=="")
    {
        alert("密码不能为空，请重新输入密码！");
        document.RegForm.PassWord1.focus();
        return false;
    }
    if(document.RegForm.PassWord1.value.length < 6)
    {
        alert("您的密码小于6位，为了帐号安全，请重新设置密码！");
        document.RegForm.PassWord1.focus();
        return false;
    }
    if(document.RegForm.PassWord1.value.length > 16)
    {
        alert("老大，再安全也不用16个字符的密码吧，改个短点的去吧，谢谢啦！");
        document.RegForm.PassWord1.focus();
        return false;
    }
	if (document.RegForm.PassWord1.value != document.RegForm.PassWord2.value)
	{
		alert('两次输入的密码不一致，请重新输入！');
		document.RegForm.PassWord1.focus();
		return false;
	}
	if  (document.RegForm.UserName.value == document.RegForm.PassWord1.value ) {
		alert("用户名和密码不能相同！");
		document.RegForm.PassWord1.focus();
		return false;
	}
    if (document.RegForm.Question.value==""){
       alert ("请输入提示问题,当您忘记密码时可根据该问题提示密码！");
       document.RegForm.Question.focus();
       return(false);
    }
    if (document.RegForm.Answer.value==""){
       alert ("请输入提示答案,当您忘记密码时可根据该问题提示密码！");
       document.RegForm.Answer.focus();
       return(false);
    }
    if(document.RegForm.Answer.value.length < 6)
    {
        alert("提示答案不能小于6位，请重新设置！");
        document.RegForm.Answer.focus();
        return false;
    }
    if(document.RegForm.TouchMan.value=="")
    {
        alert("联系人不能为空，请重新输入！");
        document.RegForm.TouchMan.focus();
        return false;
    }
    if(document.RegForm.CertNum.value=="")
    {
        alert("身份证号码不能为空，请重新输入！");
        document.RegForm.CertNum.focus();
        return false;
    }
    if(document.RegForm.TelDomain.value=="")
    {
        alert("电话区号不能为空，请重新输入！");
        document.RegForm.TelDomain.focus();
        return false;
    }
    if(document.RegForm.tel.value=="")
    {
        alert("电话号码不能为空，请重新输入！");
        document.RegForm.tel.focus();
        return false;
    }
    if (document.RegForm.CheckCode.value==""){
       alert ("请输入您的验证码！");
       document.RegForm.CheckCode.focus();
       return(false);
    }
    if (document.RegForm.agree.value!=1){
       alert ("请选择同意用户协议，否则无法注册！");
       document.RegForm.agree.focus();
       return(false);
    }
}
function CheckUserName(check_username)
{
	if (check_username == "") {
		alert("请输入您的用户名！");
		document.RegForm.UserName.focus();
	}
	else {
		popwin("check_username.asp?username="+check_username,4,300,80);
	}

}
function isSsnString (ssn)
{
	var re=/^[0-9a-z][\w-.]*[0-9a-z]$/i;
	if(re.test(ssn))
		return true;
	else
		return false;
}
function popwin(url,popwin_type,popwin_width,popwin_height)

{
	switch(popwin_type)
	{
		case 1: //指定大小的window，toolbar，scrollbars
			fl="width=" + popwin_width + ",height=" + popwin_height + ",resizable=yes,scrollbars=yes,status=no,toolbar=yes,menubar=no,location=no"
			break;
		
		case 2: //指定大小的window，toolbar
			fl="width=" + popwin_width + ",height=" + popwin_height + ",resizable=yes,scrollbars=no,status=no,toolbar=yes,menubar=no,location=no"
			break;

		case 3: //指定大小的window，scrollbars
			fl="width=" + popwin_width + ",height=" + popwin_height + ",resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no"
			break;

		case 4: //指定大小的window，none
			fl="width=" + popwin_width + ",height=" + popwin_height + ",resizable=yes,scrollbars=no,status=no,toolbar=no,menubar=no,location=no"
			break;	
	}
	
	
	window.open(url,"",fl);

}


function CheckLogin()
{
    if(document.Login.UserName.value=="")
    {
        alert("请输入用户名！");
        document.Login.UserName.focus();
        return false;
    }
    if(document.Login.password.value == "")
    {
        alert("请输入密码！");
        document.Login.password.focus();
        return false;
    }
}