// JavaScript Document<
function chkDangky(frm){
	if(frm.user.value==''){
		alert("Mời bạn nhập tên đăng nhập.") ;
		frm.user.focus() ;
		return false ;
	}
	if(frm.pass.value==''){
		alert("Mời bạn nhập mật khẩu.") ;
		frm.pass.focus() ;
		return false ;
	}
	if(frm.pass.value!=frm.cfpass.value){
		alert("Xác nhận mật khẫu sai.") ;
		frm.cfpass.focus() ;
		return false ;
	}
	if((!chkemail(frm.email.value))||(frm.email.value=='')){
		alert("Mời bạn nhập đúng Email.") ;
		frm.email.focus() ;
		return false ;
	}
	/*if(frm.memkind.option.value==0){
		alert("Mời bạn chọn loại thành viên.") ;
		frm.cfpass.focus() ;
		return false ;
	}*/
	if(!frm.agree.checked){
		alert("Bạn chưa đồng ý điều lệ diễn đàn.") ;
		//frm.email.focus() ;
		return false ;
	}
	return true ;
}
function chkemail(email) {
	var re = /^(\w|[^_]\.[^_]|[\-])+(([^_])(\@){1}([^_]))(([a-z]|[\d]|[_]|[\-])+|([^_]\.[^_])*)+\.[a-z]{2,3}$/i 
	return re.test(email);
}
function chkLogin(frm){
	if(frm.username.value==''){
		alert("Mời bạn nhập tên đăng nhập.") ;
		frm.username.focus() ;
		return false ;
	}
	if(frm.password.value==''){
		alert("Mời bạn nhập mật khẩu.") ;
		frm.password.focus() ;
		return false ;
	}
	return true ;
}
function chkdangtin(frm){
	if(frm.txtsubject.value==''){
		alert("Mời bạn nhập tiêu đề.") ;
		frm.txtsubject.focus() ;
		return false ;
	}
	if(frm.txtclassid.value==0){
		alert("Mời bạn chọn ngành nghề.") ;
		frm.txtclassid.focus() ;
		return false ;
	}
	return true ;
}
function chkMatkhau(frm){
	if((!chkemail(frm.email.value))||(frm.email.value=='')){
		alert("Mời bạn nhập đúng Email.") ;
		frm.email.focus() ;
		return false ;
	}
	return true ;
}
function chkLienhe(frm){
	
	if((!chkemail(frm.email.value))||(frm.email.value=='')){
		alert("Mời bạn nhập đúng Email.") ;
		frm.email.focus() ;
		return false ;
	}
	if(frm.hoten.value==''){
		alert("Mời bạn cho biết họ và tên.") ;
		frm.hoten.focus() ;
		return false ;
	}	
	if(frm.phone.value==''){
		alert("Mời bạn cho điện thoại liên lạc.") ;
		frm.phone.focus() ;
		return false ;
	}
	if(frm.subject.value==''){
		alert("Mời bạn nhập vào chủ đề.") ;
		frm.subject.focus() ;
		return false ;
	}
	if(frm.content.value==''){
		alert("Mời bạn nhập vào nội dung.") ;
		frm.content.focus() ;
		return false ;
	}
	return true ;
}
function chkDattour(frm){
	if(frm.hoten.value==''){
		alert("Mời bạn cho biết họ và tên.") ;
		frm.hoten.focus() ;
		return false ;
	}	
	if((!chkemail(frm.email.value))||(frm.email.value=='')){
		alert("Mời bạn nhập đúng Email.") ;
		frm.email.focus() ;
		return false ;
	}
	if(frm.phone.value==''){
		alert("Mời bạn cho điện thoại liên lạc.") ;
		frm.phone.focus() ;
		return false ;
	}	
	if(frm.content.value==''){
		alert("Mời bạn nhập vào nội dung.") ;
		frm.content.focus() ;
		return false ;
	}
	return true ;
}
