function FrontPage_Form1_Validator(theForm)
{
   if (theForm.ncontact.value == "")
  {
    alert("Please insert contact name  !");
    theForm.ncontact.focus();
    return (false);
  }
    if (theForm.tcontact.value == "")
  {
    alert("Please insert telephone number  !");
    theForm.tcontact.focus();
    return (false);
  }
   if (theForm.econtact.value == "")
  {
    alert("Please insert email !");
    theForm.econtact.focus();
    return (false);
  }
  if (theForm.med.value == "")
  {
    alert("Please select type of contact  !");
    theForm.med.focus();
    return (false);
  }
  if (theForm.way.value == "")
  {
    alert("Please insert destination !");
    theForm.way.focus();
    return (false);
  }
  if (theForm.fname1.value == "")
  {
    alert("Please insert Passenger name  !");
    theForm.fname1.focus();
    return (false);
  }
   if (theForm.refer.value == "")
  {
    alert("Please insert data , Where you know Thaitravelcenter.com  !");
    theForm.refer.focus();
    return (false);
  }
 return (true);
}

 function submitValid(iform) {
   var i = 0; msg="Please check and correct the following information in the form\n\n"; valid=true;
   	if (iform.firstname.value.length < 1) { 
		 i++; valid=false; msg=msg + " "+ i +". First Name : Please insert first name !.\n"; };
	if (iform.lastname.value.length < 1 ) { 
		 i++; valid=false; msg=msg + " "+ i +". Last Name : Please insert last name !.\n"; };
	if (iform.tel.value.length < 1 || isNaN(iform.tel.value)==true) { 
		 i++; valid=false; msg=msg + " "+ i +". Tel : Please insert telephone number !.\n"; };
	if (iform.email.value.length < 1 ) { 
		 i++; valid=false; msg=msg + " "+ i +". Email : Please insert Email !.\n"; };
	if (iform.comment.value.length < 1 ) { 
		 i++; valid=false; msg=msg + " "+ i +". Comment : Please insert comment !.\n"; };
	if (iform.formnum.value.length < 1 || iform.formnum.value.length > 5) { 
		 i++; valid=false; msg=msg + " "+ i +". Indentity Code : Please insert identity code !.\n"; };
    if (!valid) { alert(msg) ; return false;}
    return valid;	  
  }

 function submitValid2(iform) {
   var i = 0; msg="Please check and correct the following information in the form\n\n"; valid=true;
   if (iform.ncontact == "[object]"){
	if (iform.ncontact.value.length< 1) { 
		 i++; valid=false; msg=msg+ " "+ i +". Contact First name: Incompleted or Incorrect Information.\n"; };  
	}
   if (iform.fncontact == "[object]"){
	if (iform.fncontact.value.length< 1) { 
		 i++; valid=false; msg=msg+ " "+ i +". Contact Last name: Incompleted or Incorrect Information.\n"; };   
	}
   if (iform.countrycontact == "[object]"){	  
	if (iform.countrycontact.value.length< 1) { 
		 i++; valid=false; msg=msg+ " "+ i +". Country : Incompleted or Incorrect Information.\n"; }; 
	}
   if (iform.tcontact == "[object]"){	  
	if (iform.tcontact.value.length< 1) { 
		 i++; valid=false; msg=msg+ " "+ i +". Telephone: Incompleted or Incorrect Information.\n"; };  
	}
   if (iform.mtcontact == "[object]"){	  
	if (iform.mtcontact.value.length< 1) { 
		 i++; valid=false; msg=msg+ " "+ i +". Mobile phone: Incompleted or Incorrect Information.\n"; };  
	}
   if (iform.econtact == "[object]"){	  		  
	if (iform.econtact.value.length> 0) { 
		var tmpemail = EmailValid(iform.econtact.value, true); 
			if (tmpemail != "0") { i++; valid=false; msg=msg+ " "+ i +". Email: " + tmpemail +".\n"; };
	}else if (iform.econtact.value.length < 1){
		i++; valid=false; msg=msg+ " "+ i +". Email : Incompleted or Incorrect Information.\n"; };
	}
   if (iform.dateD == "[object]"){	  
	if (iform.dateD.value.length< 1) { 
		 i++; valid=false; msg=msg+ " "+ i +". Departure date : Incompleted or Incorrect Information.\n"; };  
	}
   if (iform.dateR == "[object]"){	  
	if (iform.dateR.value.length< 1) { 
		 i++; valid=false; msg=msg+ " "+ i +". Return date : Incompleted or Incorrect Information.\n"; };  
	}
   if (iform.refer == "[object]"){	  
	if (iform.refer.value.length< 1) { 
		 i++; valid=false; msg=msg+ " "+ i +". how you know : Incompleted or Incorrect Information.\n"; };   
	}
    if (!valid) { alert(msg) ; return false;}
    return valid;	  
  }	   

