

/* commented out because an error occurs when the form is submitted due to the objects (html id's) no longer being there


window.onload=set_start_field;


function set_start_field()
{
   document.getElementById('salutation').focus();
   select_ages();
   show_hide_hotel();
}

*/







var error_flag=false;

function check_field(id)
{
    if(document.getElementById(id).value == "")
    {
      document.getElementById(id).style.background="red";
      error_flag=true;
      }
    else
      document.getElementById(id).style.background="white";
}

function check_field_em(id)
{
    var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;



    var em=document.getElementById(id).value;


     if(!re.test(em))
    {
      document.getElementById(id).style.background="red";
      error_flag=true;
      }
    else
      document.getElementById(id).style.background="white";

}


function check_field_textarea(id)
{
    var field_length=document.getElementById(id).value.length*1;
    var maxlength=document.getElementById(id).maxlength*1;

    if(field_length > maxlength)
    {
      alert('You have entered ' + (field_length-maxlength) + ' too many characters');
      document.getElementById(id).style.background="red";
      error_flag=true;
    }
    else
      document.getElementById(id).style.background="white";

}






function ValidForm(form)
{
  error_flag=false;

  check_field('name');
  check_field('telephone');
  check_field_em('email');
  check_field_textarea('notes');


  if(error_flag==true)
  {
    alert("Please complete all the fields that are highlighted in red");
    error_flag=false;
  	return false;
	}

	return true;

}
