function refreshCc(){
	nowTime = new Date()
	$("codeimg").src = 'validate.aspx?d='+ nowTime.getTime();
}


function $(id){
	return document.getElementById(id);
}

function chq(selObj){
	if(selObj.options[selObj.selectedIndex].value=="0"){
		$("myQuestion").style.display = '';	
	}
}

function getlogin(){
	this.location.href = 'login.aspx';
}

function getpass(f){
	if(f.username.value==""){
		alert("用户名不能为空");
		f.username.focus();
		return false;
	}
	if(f.check_code.value==""){
		alert("验证码不能为空");
		f.check_code.focus();
		return false;
	}
}

function checkform(f){
	if(f.username.value==""){
		alert("用户名不能为空");
		f.username.focus();
		return false;
	}
	if(f.password.value==""){
		alert("密码不能为空");
		f.password.focus();
		return false;
	}
	if(f.confirm_password.value==""){
		alert("确认密码不能为空");
		f.password.focus();
		return false;
	}
	if(f.confirm_password.value!=f.password.value){
		alert("两次输入密码不一样");
		f.confirm_password.focus();
		return false;
	}
		if(f.question.value=="-1"){
		alert("密码提示问题不能为空");
		f.question.focus();
		return false;
	}
	
	if(f.question.value=="0"){
		if(f.myQuestion.value==""){
			alert("密码提示问题不能为空");
			f.myQuestion.focus();
			return false;
		}
	}
	
	if(f.answer.value==""){
		alert("密码提示答案不能为空");
		f.answer.focus();
		return false;
	}
	if(f.RealName.value==""){
		alert("真实姓名不能为空");
		f.RealName.focus();
		return false;
	}
	if(f.email.value==""){
		alert("邮件地址不能为空");
		f.email.focus();
		return false;
	}
	
	if(!IsMail(f.email.value)){
		alert("邮件格式不对");
		f.email.focus();
		return false;
	}
	

	
	if(f.Mobile.value!=""){
		if(!ismobile(f.Mobile.value)){
			alert("手机格式不正确");
			f.Mobile.focus();
			return false;
		}
	}
	if(f.QQ.value!=""){
		if(!isqq(f.QQ.value)){
			alert("QQ号码不正确");
			f.QQ.focus();
			return false;
		}
	}
	if(f.ZipCode.value!=""){
		if(isNaN(f.ZipCode.value)){
			alert("邮政编码不正确");
			f.ZipCode.focus();
			return false;
		}
	}
	if(f.check_code.value==""){
		alert("验证码不能为空");
		f.check_code.focus();
		return false;
	}
	
	
}

function checkuser(){
	var name=$("username");;
	
	if(name.value==""){
		alert("请输入用户名");
		return;
	}
	
	//增加用户名格式判断，只能是字母、数字、下划线
	
	window.open ("UserNameCheck.aspx?UserName="+name.value, "newwindow", "height=150, width=150, top=100, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no");
}

function chk() 
{ 
var s=$("username").value; 
re=/[A-Za-z0-9]/g 
r=s.match(re); 
if(r!=null){ 
r = r.join(""); 
$("username").value=r 
} 
else{ 
$("username").value="" 
} 
} 

function IsMail(mail)
{
var patrn = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if (!patrn.test(mail))
return false;
else
return true;
}

function ismobile(mobile){
if(/^13[4,5,6,7,8,9]\d{8}$/g.test(mobile)||(/^15[8,9]\d{8}$/g.test(mobile)))
{
return true;
}
else
{
return false
}
}

function isqq(qq){
if(/^[1-9]\d{4,8}$/g.test(qq))
{
return true;
}
else
{
return false
}
}
