var Log = new Login();

function Login(){
	this.check = function(){
		if(!this.checkname()){
			alert("登录名填写不正确");
			return false;
		}
		if(!this.checkpass()){
			alert("登录密码填写不正确");
			return false;
		}
	}
	this.checkname = function(){
		var el = $("username").value;
		var patrn = /^([a-zA-Z0-9]|[._]){4,16}$/;

		if(patrn.exec(el)){
			return true;
		}else{
			return false;
		}
	}
	this.checkpass = function(){
		var el = $("password").value;
		var patrn = /^([a-zA-Z0-9]|[_]){6,16}$/;

		if(patrn.exec(el)){
			return true;
		}else{
			return false;
		}
	}
}