﻿// JScript File

var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;

function checkmail(em)
{	 var a=new general();
	var email=a.FIND("VTA_LoadContent1__ctl00_txtEmailTao");
	var returnval=emailfilter.test(email.value);
	if (returnval==false)
	{
		alert("Email không hợp lệ !")					
		return returnval;
	}	
	
				
	
	var pass=a.FIND("VTA_LoadContent1__ctl00_txtPassTao");
	var pass2=a.FIND("VTA_LoadContent1__ctl00_txtPassTao2");
	if(pass.value=="")
	{
		alert("Vui lòng nhập mật khẩu !");
		pass.focus();		
		return false;
	}
	if(pass2.value=="")
	{
		alert("Vui lòng nhập lại mật khẩu !");
		pass2.focus();		
		return false;
	}
	
	if(pass2.value != pass.value)
	{
		alert("Mật khẩu không hợp lệ !.");
		pass2.focus();		
		return false;
	}
	return true;
}

function checkmail1(em)
{	 var a=new general();
	var email=a.FIND("VTA_LoadContent1__ctl00_txtEmail");
	var returnval=emailfilter.test(email.value);
	if (returnval==false)
	{
		alert("Email không hợp lệ !")					
		return returnval;
	}	
	
				
	
	var pass=a.FIND("VTA_LoadContent1__ctl00_txtPass");

	if(pass.value=="")
	{
		alert("Vui lòng nhập mật khẩu !");
		pass.focus();		
		return false;
	}
	
	

	return true;
}
function CheckTBL_Customer(em)
{	


    var a=new general();
	var COUNTRYID=a.FIND("VTA_Content1_VTA_LoadContent1_ctl00_txtCOUNTRYID");
	var COUNTRYNAME=a.FIND("VTA_Content1_VTA_LoadContent1_ctl00_txtCOUNTRYNAME");
	if(COUNTRYID.value=="")
	{
		alert("Vui lòng nhập mã số quốc gia !");
		COUNTRYID.focus();		
		return false;
	}
	if(COUNTRYNAME.value=="")
	{
		alert("Vui lòng nhập tên quốc gia !");
		COUNTRYNAME.focus();		
		return false;
	}
	return true;
}

function Check_ThongTinDathang()
{	


    var a=new general();
    
	var txtTenND=a.FIND("VTA_LoadContent1_ctl00_txtTenND");
	if(txtTenND.value=="")
	{
		alert("Vui lòng nhập tên người đặt hàng !");
		txtTenND.focus();		
		return false;
	}
	
	var txtDiaChiND=a.FIND("VTA_LoadContent1_ctl00_txtDiaChiND");
	if(txtDiaChiND.value=="")
	{
		alert("Vui lòng nhập địa chỉ người đặt hàng !");
		txtDiaChiND.focus();		
		return false;
	}
	//VTA_LoadContent1_ctl00_cboTinhND
	var txtTinhND=a.FIND("VTA_LoadContent1_ctl00_cboTinhND");
	if(txtTinhND.value=="")
	{
		alert("Vui lòng Tỉnh/Thành Phố người đặt hàng !");
		txtTinhND.focus();		
		return false;
	}
	
	/*
	var txtNgaySinhND=a.FIND("VTA_LoadContent1_ctl00_txtNgaySinh");
	if(txtNgaySinhND.value=="")
	{
		alert("Vui lòng nhập ngày sinh người đặt hàng !");
		txtNgaySinhND.focus();		
		return false;
	}
	
		
	var txtDTND=a.FIND("VTA_LoadContent1_ctl00_txtDTND");
	if(txtDTND.value=="")
	{
		alert("Vui lòng nhập số điện thoại.");
		txtDTND.focus();		
		return false;
	}
	
	var txtDDND=a.FIND("VTA_LoadContent1_ctl00_txtDDND");
	if(txtDDND.value=="")
	{
		alert("Vui lòng nhập số điện thoại người đặt hàng !");
		txtDDND.focus();		
		return false;
	}
	*/
	  var txtEmailND=a.FIND("VTA_LoadContent1_ctl00_txtEmailND");
	if(txtEmailND.value=="")
	{
		alert("Vui lòng nhập email người đặt hàng !");
		txtEmailND.focus();		
		return false;
	}
	
	else
	{
	    var returnval=emailfilter.test(txtEmailND.value);
	    if (returnval==false)
	    {
		    alert("Email không hợp lệ !")					
		    return returnval;
	    }	
	}
	
	//VTA_LoadContent1_ctl00_txtCMND
	var txtCMNDND=a.FIND("VTA_LoadContent1_ctl00_txtCMND");
	if(txtCMNDND.value=="")
	{
		alert("Vui lòng nhập chứng minh nhân dân người đặt hàng !");
		txtCMNDND.focus();		
		return false;
	}
	//VTA_LoadContent1_ctl00_txtCMNDDate
	/*
	var txtCMNDNgayCapND=a.FIND("VTA_LoadContent1_ctl00_txtCMNDDate");
	if(txtCMNDNgayCapND.value=="")
	{
		alert("Vui lòng nhập ngày cấp chứng minh nhân dân người đặt hàng !");
		txtCMNDNgayCapND.focus();		
		return false;
	}
	*/
	//VTA_LoadContent1_ctl00_txtNoiCap
	/*
	var txtCMNDNgayCapND=a.FIND("VTA_LoadContent1_ctl00_txtNoiCap");
	if(txtCMNDNgayCapND.value=="")
	{
		alert("Vui lòng nhập ngày cấp chứng minh nhân dân người đặt hàng !");
		txtCMNDNgayCapND.focus();		
		return false;
	}
	*/

	
  
	/*
	var cboHTTTND=a.FIND("VTA_LoadContent1_ctl00_cboHTTTND");
	var cboHTVCND=a.FIND("VTA_LoadContent1_ctl00_cboHTVCND");
	
	if(cboHTTTND.selectedIndex == 0)
	{
		alert("Vui lòng chọn hình thức thanh toán !");
		cboHTTTND.focus();		
		return false;
	}
	if(cboHTVCND.selectedIndex == 0)
	{
		alert("Vui lòng chọn hình thức vận chuyển !");
		cboHTVCND.focus();		
		return false;
	}
	
	var txtNgayND=a.FIND("VTA_LoadContent1_ctl00_txtNgayND");
	if(txtNgayND.value=="")
	{
		alert("Vui lòng chọn thời gian nhận hàng !");
		txtNgayND.focus();		
		return false;
	}
	
	var txtNDYCNN=a.FIND("VTA_LoadContent1_ctl00_txtYeuCau");
	
	if(txtNDYCNN.value=="")
	{
		alert("Vui lòng nhập nội dung yêu cầu !");
		txtNDYCNN.focus();		
		return false;
	}
	*/
	
	return true;
}