/*----------------------------------------------------------------------*/
/*  Script for validating fields in common to booking form screens      */
/*----------------------------------------------------------------------*/
	function validateForm() {
		
/*  validate name entered                                                       */
		if (bookingForm.name.value == '') {
			alert("Please enter a contact name")
		   	bookingForm.name.focus()
		  	return false
		}
/*  validate email                                                              */
		if ( bookingForm.email.value != '' 
		   & !validEmail(bookingForm.email.value ) ) {
			alert("Please enter a valid email address")
		   	bookingForm.email.focus()
		  	return false
		}
/*  validate phone no. entered, is longer than 5 digits, and contains digits and blanks only */
		if ( bookingForm.phone.value == ''
		   | bookingForm.phone.value.length < 6
		   | !isNumBlank(bookingForm.phone.value) ) {
			alert("Please enter a valid phone number")
		   	bookingForm.phone.select()
		   	bookingForm.phone.focus()
		  	return false
		}
/*  validate number of people have been entered                                 */
		if (bookingForm.numPeople.value == '') {
			alert("Please enter an approximate number of people coming")
		   	bookingForm.numPeople.value = '0'
		   	bookingForm.numPeople.select()
		   	bookingForm.numPeople.focus()
		  	return false
		}
/*  validate number of people is numeric                                        */
		if (!isNumBlank(bookingForm.numPeople.value) ) {
			alert("Please enter a valid numeric for number of people")
		   	bookingForm.numPeople.select()
		   	bookingForm.numPeople.focus()
		  	return false
		}
		return true
	}  /* end validateForm function */

/*----------------------------------------------------------------------*/
/*  validate email address
/*----------------------------------------------------------------------*/
	function validEmail(email) {
		atPos = email.indexOf("@",1)
		if (atPos == -1) {                         // must be a @
		  	return false
		}
		if (email.indexOf("@",atPos+1) != -1) { // must be only 1 x @
		  	return false
		}
		periodPos = email.indexOf(".",atPos)
		if (periodPos == -1) {                     // must be a . after @
		  	return false
		}
		if (periodPos + 3 > email.length) {        // must be at least 2 chars after . 
		  	return false
		}
	  	return true
	}
	  
/*----------------------------------------------------------------------*/
/*  validate for numerics (embedded blanks are allowed)
/*----------------------------------------------------------------------*/
	function isNumBlank(field) {
		for (i=0; i<field.length; i++) {
			thisChar = field.charAt(i)
			if ( thisChar != " "
			   & ( thisChar < "0"
			     | thisChar > "9" ) ) {
			  return false
			}
		}
		return true	  	 
	}  
	
/*----------------------------------------------------------------------*/
/*  set up today's date and month array for date fields
/*----------------------------------------------------------------------*/
	today   = new Date
	monName = new Array("January",
						"February",
						"March",
						"April",
						"May",
						"June",
						"July",
						"August",
						"September",
						"October",
						"November",
						"December" )

