<!--
function ValidateForm(frm) {
	var invalidFields    = new String("");                
	var emptyFields		 = new String("");
	var numEmpty		 = 0;
	var numInvalids		 = 0;
	var pattern          = /^[0-9]*$/;
	var d                = new Date();	
	var curr_date        = ( d.getDate() - 1 );
	var curr_month       = ( d.getMonth() + 1 );
	var curr_year		 = d.getFullYear();
   	var curr_fdate       = d.setFullYear(curr_year, curr_month ,  curr_date);
	var booking_fdate    = d.setFullYear(frm.arrivalYear.value, frm.arrivalMonth.value , frm.arrivalDay.value) ;


	// ***** Check for blank fields *****
	if ( frm.name.value == "") {
		emptyFields += "\n\tFirst name";
		numInvalids += 1;
		numEmpty +=1;
	}
	if ( frm.surname.value == "") {
		emptyFields += "\n\tSurname";
		numInvalids += 1;
		numEmpty +=1;
	}
	if ( frm.email.value == "") {
		emptyFields += "\n\tEmail Address";
		numInvalids += 1;
		numEmpty +=1;
	}

	if (frm.tel.value == "") {
		emptyFields += "\n\tTelephone";
		numInvalids += 1;
		numEmpty +=1;
	}
	if (frm.no_adults.value == "") {
		emptyFields += "\n\tNo of People";
		numInvalids += 1;
		numEmpty +=1;
	}
	
	// ***** Validate the e-mail address *****
	if ((frm.email.value.indexOf('@', 0) == -1) || frm.email.value.indexOf('.') == -1) {
		invalidFields += "- E-Mail Address: \n\tPlease use Username@domainname.extension format.\n\tEx: info@klienwaterval.co.za\n\n";
		numInvalids += 1;  	
	}
	// ***** Validate numerics patterns *****
//	if( pattern.test( frm.telephone.value) == false)  {	
//		invalidFields += "- The telephone number should be numeric\n\n";
//		numInvalids += 1;
//	}

	if( pattern.test(frm.no_adults.value ) == false) {	
		invalidFields += "- The Number of people should be numeric\n\n";
		numInvalids += 1;
	}

	if( pattern.test(frm.no_children.value ) == false) {	
		invalidFields += "- The Number of people should be numeric\n\n";
		numInvalids += 1;
	}

	// ***** Validate on dates *****
//	if (booking_fdate <= curr_fdate) {
//		 invalidFields += "- The booking date should be after today's date \n\n";
//		 numInvalids += 1;
//	}


   if ( numInvalids != 0) {
				invalidFields = formErrorSentence(numEmpty, emptyFields, invalidFields);
				alert(invalidFields);
				return false;
  } else {
			return true;		
  }
 }

function formErrorSentence(numEmpty, strEmpty, strInvalid)  {
	var position   = 0;
	var tempString = new String("");

	msg = "__________________________________\n\n";
	msg += "This booking was not sent because of the following error(s).\n";
	msg += "Please correct these error(s) and re-submit.\n";
	msg += "__________________________________\n\n";
	msg += strInvalid;

	if (numEmpty > 0)
	msg += "- The following required field(s) are empty:" + strEmpty;
	return msg;
}



		// -->
