﻿  function CheckSendmail(){
        var t=document.getElementById("ctl00_c1_txtname").value;
        if (t==""){
            document.getElementById("ctl00_c1_txtname").focus();
            alert("Vui lòng nhập họ tên");
            return false;
        }
         t=document.getElementById("ctl00_c1_txtemail").value;
        if (t==""){
            document.getElementById("ctl00_c1_txtemail").focus();
            alert("Vui lòng nhập email");
            return false;
        }
         var textValue=t;
            var err='';
             if(textValue!="")
                {
	                if (textValue.indexOf('@') <= 0 || textValue.indexOf('@') == textValue.length -1){
		                err += "Địa chỉ email không hợp lệ";		
	                } else {
		                var substr = textValue.substring(textValue.indexOf('@'),textValue.length);
		                if (textValue.indexOf('.') <= 0) {
			                err += "Địa chỉ email không hợp lệ\n";
		                }
	                }
    	            
	                if (err != '') { 
		                alert(err); 
		                 document.getElementById("ctl00_c1_txtemail").focus();
		                return false;
	                }
	         }
        
          t=document.getElementById("ctl00_c1_txtaddress").value;
        if (t==""){
            document.getElementById("ctl00_c1_txtaddress").focus();
            alert("Vui lòng nhập địa chỉ");
            return false;
        }
         t=document.getElementById("ctl00_c1_txttitle").value;
        if (t==""){
            document.getElementById("ctl00_c1_txttitle").focus();
            alert("Vui lòng nhập tiêu đề");
            return false;
        }
        return true;
    }
    
  function CheckRegister(){
        var t=document.getElementById("ctl00_c1_txtusername").value;
        if (t==""){
            document.getElementById("ctl00_c1_txtusername").focus();
            alert("Vui lòng nhập tên đăng nhập");
            return false;
        }
          t=document.getElementById("ctl00_c1_txtusername").value;
        if (t==""){
            document.getElementById("ctl00_c1_txtusername").focus();
            alert("Vui lòng nhập tên đăng nhập");
            return false;
        }
         t=document.getElementById("ctl00_c1_txtpassword").value;
        if (t==""){
            document.getElementById("ctl00_c1_txtpassword").focus();
            alert("Vui lòng nhập mật khẩu");
            return false;
        }
        var t1=document.getElementById("ctl00_c1_txtconfirmpassword").value;
        if (t1==""){
            document.getElementById("ctl00_c1_txtconfirmpassword").focus();
            alert("Vui lòng nhập lại mật khẩu");
            return false;
        }
        if(t!=t1){
            document.getElementById("ctl00_c1_txtconfirmpassword").focus();
            alert("Mật khẩu không đúng");
            return false;
        }
         t=document.getElementById("ctl00_c1_txtemail").value;
        if (t==""){
            document.getElementById("ctl00_c1_txtemail").focus();
            alert("Vui lòng nhập email");
            return false;
        }
         var textValue=t;
            var err='';
             if(textValue!="")
                {
	                if (textValue.indexOf('@') <= 0 || textValue.indexOf('@') == textValue.length -1){
		                err += "Địa chỉ email không hợp lệ";		
	                } else {
		                var substr = textValue.substring(textValue.indexOf('@'),textValue.length);
		                if (textValue.indexOf('.') <= 0) {
			                err += "Địa chỉ email không hợp lệ\n";
		                }
	                }
    	            
	                if (err != '') { 
		                alert(err); 
		                 document.getElementById("ctl00_c1_txtemail").focus();
		                return false;
	                }
	         }
        
         
        return true;
    }
     function Checklogin(){
        var t=document.getElementById("ctl00_c1_txtusername").value;
        if (t==""){
            document.getElementById("ctl00_c1_txtusername").focus();
            alert("Vui lòng nhập tên đăng nhập");
            return false;
        }
          t=document.getElementById("ctl00_c1_txtpassword").value;
        if (t==""){
            document.getElementById("ctl00_c1_txtpassword").focus();
            alert("Vui lòng nhập mật khẩu");
            return false;
        }
        return true;
   }
   function Checkforgotpass(){
        var t=document.getElementById("ctl00_c1_txtusername").value;
        if (t==""){
            document.getElementById("ctl00_c1_txtusername").focus();
            alert("Vui lòng nhập tên đăng nhập");
            return false;
        }
          t=document.getElementById("ctl00_c1_txtemail").value;
        if (t==""){
            document.getElementById("ctl00_c1_txtemail").focus();
            alert("Vui lòng nhập email");
            return false;
        }
          var textValue=t;
            var err='';
             if(textValue!="")
                {
	                if (textValue.indexOf('@') <= 0 || textValue.indexOf('@') == textValue.length -1){
		                err += "Địa chỉ email không hợp lệ";		
	                } else {
		                var substr = textValue.substring(textValue.indexOf('@'),textValue.length);
		                if (textValue.indexOf('.') <= 0) {
			                err += "Địa chỉ email không hợp lệ\n";
		                }
	                }
    	            
	                if (err != '') { 
		                alert(err); 
		                 document.getElementById("ctl00_c1_txtemail").focus();
		                return false;
	                }
	         }
        
   }
