/* author: Archana */
/* creation date: 14/09/2001 */

var msg;

function isEmail(str) {

  // are regular expressions supported?

  var supported = 0;

  if (window.RegExp) {

    var tempStr = "a";

    var tempReg = new RegExp(tempStr);

    if (tempReg.test(tempStr)) supported = 1;

  }

  if (!supported) 

  return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);

  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");

  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");

  return (!r1.test(str) && r2.test(str));

}

function Check()
{
msg = "";
  if (document.Form1.f_fname.value == "")
  {
    msg += "Please enter First name!!!\n" ; 
    document.Form1.f_fname.focus();
  }	
  
   if (document.Form1.f_sname.value == "")
  {
    msg += "Please enter last name!!!\n" ; 
    document.Form1.f_sname.focus();
  }
  	
   if (document.Form1.f_addresse.value == "")
  {
    msg += "Please enter address!!!\n" ; 
    document.Form1.f_addresse.focus();
  }
//else  
  if (document.Form1.f_email.value == "")
  {
    msg += "Please enter the email in the Email field!!!\n" ;
    document.Form1.f_email.focus();
  }  

  //Email
  if (document.Form1.f_email.value != "")
    if (!isEmail(document.Form1.f_email.value))
    {
      msg += "The Email field is invalid!!!\n" ;
	 document.Form1.f_email.focus();
    } 

//else  
  if (document.Form1.f_hotels.selectedIndex == 0)
  {
    msg += "Please select a Room Type!!!\n" ; 
    document.Form1.f_hotels.focus();
  }
   
  //No. of Rooms Required
  if (isNaN(document.Form1.f_numRoom.value))
  {
    msg += "No. of Rooms required should be a numeric value!!!\n" ;
	document.Form1.f_numRoom.focus();
  }
  
  //Ages of children
  if (document.Form1.f_age3.value != "")
    if (isNaN(document.Form1.f_age3.value))
    {
      msg += "Age should be a numeric value!!!\n" ;
	  document.Form1.f_age3.focus();
    }
    else
      if (document.Form1.f_age2.value != "")
 	    if (isNaN(document.Form1.f_age2.value))
        {
          msg += "Age should be a numeric value!!!\n" ;
	      document.Form1.f_age2.focus();
        }
      else
        if (document.Form1.f_age1.value != "")
          if (isNaN(document.Form1.f_age1.value))
          {
            msg += "Age should be a numeric value!!!\n" ;
    	   document.Form1.f_age1.focus();
          }
  
  //No. of Children - 12 years & under
  if (isNaN(document.Form1.f_child12.value))
  {
    msg += "No. of Children - 12 years & under - should be a numeric value!!!\n" ;
	document.Form1.f_child12.focus();
  }
  
  //No. of Infants under 3 years
  if (isNaN(document.Form1.f_child3.value))
  {
    msg += "No. of Infants under 3 years should be a numeric value!!!\n" ;
	document.Form1.f_child3.focus();
  }

  //No. of adults per room
  if (isNaN(document.Form1.f_numAdlProom.value))
  {
    msg += "No. of Adults per room should be a numeric value!!!\n" ;
	document.Form1.f_numAdlProom.focus();
  }
  
  //No. of adults	
  if (isNaN(document.Form1.f_numAdl.value))
  {
    msg += "No. of Adults should be a numeric value!!!\n" ;
	document.Form1.f_numAdl.focus();
  }
  	
  //No. of nights	
  if (isNaN(document.Form1.f_numnight.value))
  {
    msg += "Length of stay should be a numeric value!!!\n";
	document.Form1.f_numnight.focus();
  }
//}




if (msg != "")
{
  alert (msg);
  return false;
}  
else
  document.Form1.submit();
 //return true;
}
