﻿// JavaScript Document
<!-- hide me

function validateContact_En(){
var testresults;
var strEmail = document.EnContact.Email.value;
var strFirstName = document.EnContact.Fname.value;
var strLastName = document.EnContact.Lname.value;
var strsecuritycode = document.EnContact.securitycode.value;
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
//var dhfygiennum=/(^\d+$)|(^\d+\.\d+$)/;
var telnum=/[\d\D]+$/;
if(strEmail != "" && strFirstName != "" && strLastName != "" && strsecuritycode != "" )
{
	testresults=true;
	
	if (!telnum.test(strsecuritycode))
	{
		alert("Security Code does not match!");
		testresults=false;
	}
	if (!filter.test(strEmail))
	{
		alert("Invalid Email Address. Please try again!");
		testresults=false;
	}	
}
else
{
	var strAlert = "Please fill infomation in the blank field";
	if(strFirstName == "")
	{
		strAlert = strAlert + " - First Nmae";
	}
	
	if(strLastName == "")
	{
		strAlert = strAlert + " - Last Name";
	}
	
	if(strEmail == "")
	{
		strAlert = strAlert + " - Email Address";
	}
	
	if(strsecuritycode == "")
	{
		strAlert = strAlert + " - Security Code";
	}
	alert(strAlert);
	testresults=false;
}
return (testresults);
}

function validateContact_Th(){
var testresults;
var strEmail = document.ThContact.Email.value;
var strFirstName = document.ThContact.Fname.value;
var strLastName = document.ThContact.Lname.value;
var strsecuritycode = document.ThContact.securitycode.value;
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
//var dhfygiennum=/(^\d+$)|(^\d+\.\d+$)/;
var telnum=/[\d\D]+$/;
if(strEmail != "" && strFirstName != "" && strLastName != "" && strsecuritycode != "" )
{
	testresults=true;
	
	if (!telnum.test(strsecuritycode))
	{
		alert("กรุณากรอกรหัสป้องกันให้ถูกต้องด้วยค่ะ!");
		testresults=false;
	}
	if (!filter.test(strEmail))
	{
		alert("กรุณากรอกอีเมล์ของคุณให้ถูกต้องด้วยค่ะ!");
		testresults=false;
	}	
}
else
{
	var strAlert = "กรุณากรอกข้อมูลในช่อง";
	if(strFirstName == "")
	{
		strAlert = strAlert + " - ชื่อของคุณ";
	}
	
	if(strLastName == "")
	{
		strAlert = strAlert + " - นามสกุลของคุณ";
	}
	
	if(strEmail == "")
	{
		strAlert = strAlert + " - อีเมล์ของคุณ";
	}
	
	if(strsecuritycode == "")
	{
		strAlert = strAlert + " - รหัสป้องกัน";
	}
	alert(strAlert);
	testresults=false;
}
return (testresults);
}
// show me-->