// JavaScript Document

function formValidator(){
	
	if(
	   checkBlank(document.getElementById('Name'), "กรุณากรอกชื่อ") &&
	   checkBlank(document.getElementById('LastName'), "กรุณากรอกนามสกุล") &&
	   checkBlank(document.getElementById('DepartureDate'), "กรุณากรอกวันที่เดินทางออกจาก USA") &&
	   checkBlank(document.getElementById('ArrivalDate'), "กรุณากรอกวันที่เดินทางถึงประเทศไทย")
	){
		return true;
	}
	return false;
}

function checkBlank(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		return false;
	}  else {
	return true;}
}
