﻿// JavaScript Document
$(document).ready(function(){
  $("#username").blur(function(){
    if($("#username").val()==""){
		$("#usererr").html(" * 用户名不能为空！");
		return false;
	}
  });
  $("#username").focus(function(){
  	$("#usererr").html("");
  });
  
  $("#email").blur(function(){
	var   reg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
	var tel=/^(([0\+]\d{2,3}-)?(0\d{2,3})-)?(\d{7,8})(-(\d{3,}))?$/;
  	if(!reg.test($("#email").val())){
		$("#emailerr").html(" * 邮箱地址有误！");
		return false;
	}
  });
  $("#email").focus(function(){
  	$("#emailerr").html("");
  });
  
  
  $("#userpwd").blur(function(){
  	if($("#userpwd").val().length<6){
		$("#upwderr").html(" * 密码大于等于六位！");
		return false;
	}
  });
  $("#userpwd").focus(function(){
  	$("#upwderr").html("");
  });
  
  
  $("#repass").blur(function(){
  	if($("#repass").val()!=$("#userpwd").val()){
		$("#repwderr").html(" * 两次密码输入不一样！");
		return false;
	}
  });
  $("#repass").focus(function(){
  	$("#repwderr").html("");
  });
}); 

function CheckReg(){
	var reg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
    if($("#username").val()==""){
		$("#usererr").html(" * 用户名不能为空！");
		return false;
	}else if(!reg.test($("#email").val())){
		$("#emailerr").html(" * 邮箱地址有误！");
		return false;
	}else if($("#userpwd").val().length<6){
		$("#upwderr").html(" * 密码大于等于六位！");
		return false;
	}else if($("#repass").val()!=$("#userpwd").val()){
		$("#repwderr").html(" * 两次密码输入不一样！");
		return false;
	}
}