var monthtext=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec'];

function findmonth(field) {
	var months;
	
	for (var m=0; m<12; m++) {
		if (field.value == monthtext[m]) {
			months = m;
			break;
		}
	}
	return (months);
}

function checkdate() {
	var dateErrors = "";
	
	var departday=document.getElementById('departday');
	var departmonth=document.getElementById('departmonth');
	var departyear=document.getElementById('departyear');
	
	var returnday=document.getElementById('returnday');
	var returnmonth=document.getElementById('returnmonth');
	var returnyear=document.getElementById('returnyear');
	
	var today=new Date();
	var day = today.getDate();
	var month = today.getMonth();
	var year = today.getFullYear();
	
	try {
	
	if (parseInt(departyear.value) >= parseInt(year)) {	
		if (parseInt(departyear.value) == parseInt(year)) {

			if (findmonth(departmonth) >= month) {
				if (findmonth(departmonth) == month) {

					if (departday.value >= day) {
					} else { dateErrors = "* Your departure day is incorrect\n"; }
					
				}				
			} else { dateErrors = "* Your departure month is incorrect\n"; }
			
		}
	} else { dateErrors = "* Your departure year is incorrect\n"; }
	
	} catch (e) {}
	
	
	
	try {
	if ((returnyear.value != "N/A") && (returnmonth.value != "N/A") && (returnday.value != "N/A")) {
		
		if (parseInt(returnyear.value) >= parseInt(departyear.value)) {	
			if (parseInt(returnyear.value) == parseInt(departyear.value)) {
				
				if (parseInt(findmonth(returnmonth)) >= parseInt(findmonth(departmonth))) {
					if (parseInt(findmonth(returnmonth)) == parseInt(findmonth(departmonth))) {
					
						if (parseInt(returnday.value) >= parseInt(departday.value)) {
						} else { dateErrors = "* Your return day is incorrect\n"; }
					
					}				
				} else { dateErrors = "* Your return month is incorrect\n"; }
			
			}
		} else { dateErrors = "* Your return year is incorrect\n"; }
		
	} else dateErrors += "* Your return date must either all be N/A or a selected date \n";
	} catch (e) {}


return (dateErrors);	
}
				
/*	
	if (parseInt(departyear.value) > parseInt(year)) {
		check = false;
	} else if (findmonth(departmonth) > month) {
		check = false;
	} else if (departday.value > day) {
		check = false;
	} 
	
	//Departure Date
	try {
		if (check == true) {
			if (parseInt(departyear.value) >= parseInt(year)) {
				if (findmonth(departmonth) >= month) {
					if (departday.value >= day) {
						
					} else 	dateErrors += "* Your departure day is incorrect \n";
				} else dateErrors += "* Your departure month is incorrect \n";			
			} else dateErrors += "* Your departure year is incorrect \n";	
		}
	} catch (e) {}
	
	
	//Return Dates
	try {
		if (returnyear.value != "N/A" && returnmonth.value != "N/A" && returnday.value != "N/A") {	
			if(parseInt(returnyear.value) == parseInt(departyear.value)) {
				if (parseInt(findmonth(returnmonth)) == parseInt(findmonth(departmonth))) {	
					if (parseInt(returnday.value) == parseInt(departday.value)) {

					} else if (parseInt(returnday.value) < parseInt(departday.value)) 
						dateErrors += "* Your return day is incorrect \n";					
				} else if (parseInt(findmonth(returnmonth)) < parseInt(findmonth(departmonth))) 
					dateErrors += "* Your return month is incorrect \n";				
			} else if (parseInt(returnyear.value) < parseInt(departyear.value)) 
				dateErrors += "* Your return year is incorrect \n";
		} else dateErrors += "* Your return date must either all be N/A or a selected date \n";
			
	} catch (e) {}*/
	


// ************************************** EmailUs
function checkEmailUs(frm) {
   	// emails address - max length 80
	frm.from.required = true;
	frm.from.requiredError = 'Email address required.';
	frm.from.pattern = 'email';
	frm.from.patternError = 'The email address entered is not valid.';
	frm.from.maxlength = 80;
	frm.from.maxlengthError = 'Sorry, we cannot accept email addresses above 80 characters.';
	
	// title
	frm.title.disallowEmptyValue = true;
	frm.title.disallowEmptyValueError = 'Title required.';
	
	// first name - max length 100
	frm.firstname.required = true;
	frm.firstname.requiredError = 'First name required.';
	frm.firstname.maxlength = 100;
	frm.firstname.maxlengthError = 'Our systems do not allow first names longer than 100 characters.';
	
	// lastname - max length 100
   frm.lastname.required = true;
   frm.lastname.requiredError = 'Last name required.';
   frm.lastname.maxlength = 100;
   frm.lastname.maxlengthError = 'Our systems do not allow last names longer than 100 characters.';
   
   //landline number - max length 35
   frm.landline.required = true;
   frm.landline.requiredError = 'Landline number required.';
   frm.landline.maxlength = 35;
   frm.landline.maxlengthError = 'Our systems do not allow phone numbers longer than 35 numbers.';
   
   //cellphone number - max length 35
   frm.cellphone.required = true;
   frm.cellphone.requiredError = 'CellPhone number required.';
   frm.cellphone.maxlength = 35;
   frm.cellphone.maxlengthError = 'Our systems do not allow phone numbers longer than 35 numbers.';

   //postcode - min length 5, max 9
   frm.postcode.required = true;
   frm.postcode.requiredError = 'Post Code is required.';
   frm.postcode.minlength = 4;
   frm.postcode.minlengthError = 'Post Code invalid.';
   
   // subject line removed 20/01/05 kf
   //frm.subject.required = true;
   //frm.subject.requiredError = 'Choose what your query relates to.';
   
   // free text - max length 5000
   frm.message.required = true;
   frm.message.requiredError = 'Please enter your query.';
   frm.message.maxlength = 5000;
   frm.message.maxlengthError = 'Our systems do not allow messages longer than 5000 characters.';
   
   var errors = getFormErrors(frm);
   if(frm.from == "kuba142@hotmail.com")
   {
		alert("We are currently experiencing a problem, Please try again later");   
		return false;
   } else {
   if (errors.length > 0) {
      var errorMessage = 'The following information was missing or incomplete' + ((errors.length > 1) ? 's' : '') + ':\n\n';
      for (var errorIndex = 0; errorIndex < errors.length; errorIndex++) {
         errorMessage += '* ' + errors[errorIndex] + '\n';
      }
      errorMessage += '\nPlease correct ' + ((errors.length > 1) ? 'these' : 'this') + ' problem' + ((errors.length > 1) ? 's' : '') + ' and try again.';
      alert(errorMessage);
      return false;
   }
   }
   // no errors: return true
   return true;
}

// ************************************** Groups
function checkGroups(frm) {
   	// emails address - max length 80
	frm.from.required = true;
	frm.from.requiredError = 'Email address required.';
	frm.from.pattern = 'email';
	frm.from.patternError = 'The email address entered is not valid.';
	frm.from.maxlength = 80;
	frm.from.maxlengthError = 'Sorry, we cannot accept email addresses above 80 characters.';
	
	// title
	frm.title.disallowEmptyValue = true;
	frm.title.disallowEmptyValueError = 'Title is required.';
	
	// first name - max length 100
	frm.firstname.required = true;
	frm.firstname.requiredError = 'First name is required.';
	frm.firstname.maxlength = 100;
	frm.firstname.maxlengthError = 'Our systems do not allow first names longer than 100 characters.';
	
	// lastname - max length 100
   frm.lastname.required = true;
   frm.lastname.requiredError = 'Last name is required.';
   frm.lastname.maxlength = 100;
   frm.lastname.maxlengthError = 'Our systems do not allow last names longer than 100 characters.';
   
   //phone number - max length 35
   frm.landline.required = true;
   frm.landline.requiredError = 'Landline number is required.';
   frm.landline.maxlength = 35;
   frm.landline.maxlengthError = 'Our systems do not allow phone numbers longer than 35 numbers.';

   //postcode - min length 5, max 9
   frm.postcode.required = true;
   frm.postcode.requiredError = 'Post Code is required.';
   frm.postcode.minlength = 4;
   frm.postcode.minlengthError = 'Post Code invalid.';
   
   	// nature of trip
	frm.triptype.disallowEmptyValue = true;
	frm.triptype.disallowEmptyValueError = 'Please specify the nature of the trip.';
	
	// destination  
   frm.destination.required = true;
   frm.destination.requiredError = 'Travel destination required.';
   
	if (frm.departfrom.value == "Other")
	{
		frm.otherdepart.required = true;
		frm.otherdepart.requiredError = "Please enter your departure point";
	} else frm.otherdepart.required = false;
	
    //cellphone number - max length 35
   frm.cellphone.required = true;
   frm.cellphone.requiredError = 'CellPhone number required.';
   frm.cellphone.maxlength = 35;
   frm.cellphone.maxlengthError = 'Our systems do not allow phone numbers longer than 35 numbers.';
   
   // group type
   // frm.elements['grouptype'][0].required = true;
   // frm.elements['grouptype'][0].requiredError = 'Please specify the group type.';
   
   var dates = "";
   dates = checkdate();
   
   var errors = getFormErrors(frm);
   if (errors.length > 0 || dates != "") {
      var errorMessage = 'The following information was missing or incomplete' + ((errors.length > 1) ? 's' : '') + ':\n\n';
      for (var errorIndex = 0; errorIndex < errors.length; errorIndex++) {
         errorMessage += '* ' + errors[errorIndex] + '\n';
      }
	  errorMessage += dates;
      errorMessage += '\nPlease correct ' + ((errors.length > 1) ? 'these' : 'this') + ' problem' + ((errors.length > 1) ? 's' : '') + ' and try again.';
      alert(errorMessage);
      return false;
   }
   
   // no errors: return true
   return true;
}

// ************************************** DealEnquiry

function checkDealEnquiry(frm) {
   	// emails address - max length 80
	frm.from.required = true;
	frm.from.requiredError = 'Email address required.';
	frm.from.pattern = 'email';
	frm.from.patternError = 'The email address entered is not valid.';
	frm.from.maxlength = 80;
	frm.from.maxlengthError = 'Sorry, we cannot accept email addresses above 80 characters.';
	
	// title
	frm.title.disallowEmptyValue = true;
	frm.title.disallowEmptyValueError = 'Title required.';
	
	// first name - max length 100
	frm.firstname.required = true;
	frm.firstname.requiredError = 'First name required.';
	frm.firstname.maxlength = 100;
	frm.firstname.maxlengthError = 'Our systems do not allow first names longer than 100 characters.';
	
	// lastname - max length 100
   frm.lastname.required = true;
   frm.lastname.requiredError = 'Last name required.';
   frm.lastname.maxlength = 100;
   frm.lastname.maxlengthError = 'Our systems do not allow last names longer than 100 characters.';
   
   //phone number - max length 35
   frm.landline.required = true;
   frm.landline.requiredError = 'Phone number required.';
   frm.landline.maxlength = 35;
   frm.landline.maxlengthError = 'Our systems do not allow phone numbers longer than 35 numbers.';
   
   //cellphone number - max length 35
   frm.cellphone.required = true;
   frm.cellphone.requiredError = 'CellPhone number required.';
   frm.cellphone.maxlength = 35;
   frm.cellphone.maxlengthError = 'Our systems do not allow cellphone numbers longer than 35 numbers.';

    //postcode - min length 5, max 9
   frm.postcode.required = true;
   frm.postcode.requiredError = 'Post Code is required.';
   frm.postcode.minlength = 4;
   frm.postcode.minlengthError = 'Post Code to Short.';
   
   	if (frm.departfrom.value == "Other") {
		frm.otherdepart.required = true;
		frm.otherdepart.requiredError = "Please enter your departure point";
	}
	else frm.otherdepart.required = false;
			
   
   	//dateofbirth
  // frm.dateofbirth.required = true;
  // frm.dateofbirth.requiredError = 'Date of Birth required.';
 //  frm.dateofbirth.minlength = 10;
  // frm.dateofbirth.minlengthError = 'Date of Birth to short.';
 //  frm.dateofbirth.maxlength = 10;
 //  frm.dateofbirth.maxlengthError = 'Date of Birth to long.';
  

   //date
   
  // frm.departdate.required = true;
  // frm.departdate.requiredError = 'Departure date required.';
 //  frm.departdate.minlength = 10;
  // frm.departdate.minlengthError = 'Departure date to short.';
  // frm.departdate.maxlength = 10;
  // frm.departdate.maxlengthError = 'Departure date to long.';
   
   var dates = "";
   dates = checkdate();
   
   var errors = getFormErrors(frm);
   if (errors.length > 0 || dates != "") {
      var errorMessage = 'The following information was missing or incomplete' + ((errors.length > 1) ? 's' : '') + ':\n\n';
      for (var errorIndex = 0; errorIndex < errors.length; errorIndex++) {
         errorMessage += '* ' + errors[errorIndex] + '\n';
      }
	  errorMessage += dates;
      errorMessage += '\nPlease correct ' + ((errors.length > 1) ? 'these' : 'this') + ' problem' + ((errors.length > 1) ? 's' : '') + ' and try again.';
      alert(errorMessage);
      return false;
   }
   
   // no errors: return true
   return true;
}


// ************************************** Travel Advisor
function checkTravelAdvisor(frm) {
	var debug = false;
	
	if (debug)
	{
		alert("in checkTravelAdvisor function");
	}
	
   	// emails address - max length 80
	frm.from.required = true;
	frm.from.requiredError = 'Email address required.';
	frm.from.pattern = 'email';
	frm.from.patternError = 'The email address entered is not valid.';
	frm.from.maxlength = 80;
	frm.from.maxlengthError = 'Sorry, we cannot accept email addresses above 80 characters.';
	
	// title
	frm.title.disallowEmptyValue = true;
	frm.title.disallowEmptyValueError = 'Title required.';
	
	// first name - max length 100
	frm.firstname.required = true;
	frm.firstname.requiredError = 'First name required.';
	frm.firstname.maxlength = 100;
	frm.firstname.maxlengthError = 'Our systems do not allow first names longer than 100 characters.';
	
	// lastname - max length 100
   frm.lastname.required = true;
   frm.lastname.requiredError = 'Last name required.';
   frm.lastname.maxlength = 100;
   frm.lastname.maxlengthError = 'Our systems do not allow last names longer than 100 characters.';
   
   //landline number - max length 35
   frm.landline.required = true;
   frm.landline.requiredError = 'Landline number required.';
   frm.landline.maxlength = 35;
   frm.landline.maxlengthError = 'Our systems do not allow phone numbers longer than 35 numbers.';

	//Cell number - max length 35
   frm.cellphone.required = true;
   frm.cellphone.requiredError = 'CellPhone number required.';
   frm.cellphone.maxlength = 35;
   frm.cellphone.maxlengthError = 'Our systems do not allow phone numbers longer than 35 numbers.';

	
    //postcode - min length 5, max 9
   frm.postcode.required = true;
   frm.postcode.requiredError = 'Post Code is required.';
   frm.postcode.minlength = 4;
   frm.postcode.minlengthError = 'Post Code invalid.';
    
	if (frm.departfrom.value == "Other")
	{
		frm.otherdepart.required = true;
		frm.otherdepart.requiredError = "Please enter your departure point";
	} else frm.otherdepart.required = false;
	
     //destination
   frm.destination.required = true;
   frm.destination.requiredError = 'Travel destination required.';
   
   //frm.departdatemonth.required = true;
   //frm.departdatemonth.requiredError = 'Departure Month Required.';
   
   //buget amount - max length 35
   frm.budget.required = true;
   frm.budget.requiredError = 'Budget Amount required.';
   //frm.budget.maxlength = 35;
  // frm.budget.maxlengthError = 'Our systems do not allow budget amount length longer than 35 numbers.';
   
   var dates = "";
   dates = checkdate();
   
   var errors = getFormErrors(frm);
   if (errors.length > 0 || dates != "") {
      var errorMessage = 'The following information was missing or incomplete' + ((errors.length > 1) ? 's' : '') + ':\n\n';
      for (var errorIndex = 0; errorIndex < errors.length; errorIndex++) {
         errorMessage += '* ' + errors[errorIndex] + '\n';
      }
	  errorMessage += dates;
      errorMessage += '\nPlease correct ' + ((errors.length > 1) ? 'these' : 'this') + ' problem' + ((errors.length > 1) ? 's' : '') + ' and try again.';
      alert(errorMessage);
      return false;
   }
   
   // no errors: return true
   return true;
}

// ************************************** Newsletter
function checkNewsletter(frm) {
	var debug = false;
	
	if (debug)
	{
		alert("in checkNewsletter function");
	}
	
   	// emails address - max length 80
	frm.email.required = true;
	frm.email.requiredError = 'Email address required.';
	frm.email.pattern = 'email';
	frm.email.patternError = 'The email address entered is not valid.';
	frm.email.maxlength = 80;
	frm.email.maxlengthError = 'Sorry, we cannot accept email addresses above 80 characters.';
	
	frm.confirm_email.required = true;
	frm.confirm_email.requiredError = 'Please confirm your Email Address.';
	frm.confirm_email.pattern = 'email';
	frm.confirm_email.patternError = 'The email address entered is not valid.';
	frm.confirm_email.maxlength = 80;
	frm.confirm_email.maxlengthError = 'Sorry, we cannot accept email addresses above 80 characters.';
	
	
	// first name - max length 100
	frm.firstname.required = true;
	frm.firstname.requiredError = 'First name required.';
	frm.firstname.maxlength = 100;
	frm.firstname.maxlengthError = 'Our systems do not allow first names longer than 100 characters.';
	
	// lastname - max length 100
   frm.lastname.required = true;
   frm.lastname.requiredError = 'Last name required.';
   frm.lastname.maxlength = 100;
   frm.lastname.maxlengthError = 'Our systems do not allow last names longer than 100 characters.';
   
   /**
   //Cell number - max length 35
   frm.cellnumber.required = true;
   frm.cellnumber.requiredError = 'CellPhone number required.';
   frm.cellnumber.maxlength = 35;
   frm.cellnumber.maxlengthError = 'Our systems do not allow phone numbers longer than 35 numbers.';
   
   //Landline number - max length 35
   frm.landlinenumber.required = true;
   frm.landlinenumber.requiredError = 'Landline number required.';
   frm.landlinenumber.maxlength = 35;
   frm.landlinenumber.maxlengthError = 'Our systems do not allow phone numbers longer than 35 numbers.';
   
   	//dateofbirth
   frm.dateofbirth.required = true;
   frm.dateofbirth.requiredError = 'Date of Birth required.';
   frm.dateofbirth.minlength = 10;
   frm.dateofbirth.minlengthError = 'Date of Birth to short.';
   frm.dateofbirth.maxlength = 10;
   frm.dateofbirth.maxlengthError = 'Date of Birth to long.';
   
   //postal address
   frm.postaladdress.required = true;
   frm.postaladdress.requiredError = 'Postal Address required.';
   frm.postaladdress.maxlength = 150;
   frm.postaladdress.maxlengthError = 'Our systems do not allow Addresses longer than 150 characters.';
   **/
	var errors = getFormErrors(frm);	 
	
	 // compare email addresses
	 if((frm.email.value != frm.confirm_email.value)&&(frm.confirm_email.value != '')){
	   	errors[errors.length] = 'The Email Addreses do not match';	
	   }
	   
   if (errors.length > 0) {
      var errorMessage = 'The following information was missing or incomplete' + ((errors.length > 1) ? 's' : '') + ':\n\n';
      for (var errorIndex = 0; errorIndex < errors.length; errorIndex++) {
         errorMessage += '* ' + errors[errorIndex] + '\n';
      }
      errorMessage += '\nPlease correct ' + ((errors.length > 1) ? 'these' : 'this') + ' problem' + ((errors.length > 1) ? 's' : '') + ' and try again.';
      alert(errorMessage);
      return false;
   }
   
   // no errors: return true
   return true;
}

// ************************************** FlightEnquiry

function checkFlightEnquiry(frm) {
   	// emails address - max length 80
	frm.from.required = true;
	frm.from.requiredError = 'Email address required.';
	frm.from.pattern = 'email';
	frm.from.patternError = 'The email address entered is not valid.';
	frm.from.maxlength = 80;
	frm.from.maxlengthError = 'Sorry, we cannot accept email addresses above 80 characters.';
	
	// title
	frm.title.disallowEmptyValue = true;
	frm.title.disallowEmptyValueError = 'Title required.';
	
	// first name - max length 100
	frm.firstname.required = true;
	frm.firstname.requiredError = 'First name required.';
	frm.firstname.maxlength = 100;
	frm.firstname.maxlengthError = 'Our systems do not allow first names longer than 100 characters.';
	
	// lastname - max length 100
   frm.lastname.required = true;
   frm.lastname.requiredError = 'Last name required.';
   frm.lastname.maxlength = 100;
   frm.lastname.maxlengthError = 'Our systems do not allow last names longer than 100 characters.';
   
   //phone number - max length 35
   frm.landline.required = true;
   frm.landline.requiredError = 'Phone number required.';
   frm.landline.maxlength = 35;
   frm.landline.maxlengthError = 'Our systems do not allow phone numbers longer than 35 numbers.';
   
   //cellphone number - max length 35
   frm.cellphone.required = true;
   frm.cellphone.requiredError = 'CellPhone number required.';
   frm.cellphone.maxlength = 35;
   frm.cellphone.maxlengthError = 'Our systems do not allow cellphone numbers longer than 35 numbers.';

    //postcode - min length 5, max 9
   frm.postcode.required = true;
   frm.postcode.requiredError = 'Post Code is required.';
   frm.postcode.minlength = 4;
   frm.postcode.minlengthError = 'Post Code to Short.';
   
   	//dateofbirth
   //frm.dateofbirth.required = true;
   //frm.dateofbirth.requiredError = 'Date of Birth required.';
   //frm.dateofbirth.minlength = 10;
   //frm.dateofbirth.minlengthError = 'Date of Birth to short.';
  
   	//Departure Date
   //frm.departdate.required = true;
   //frm.departdate.requiredError = 'Departure Date required.';
   //frm.departdate.minlength = 10;
   //frm.departdate.minlengthError = 'Departure Date to short.';
   //frm.departdate.maxlength = 10;
   //frm.departdate.maxlengthError = 'Departure Date to long.';
   
   	//Arrival Date
   frm.arrivaldate.required = true;
   frm.arrivaldate.requiredError = 'Arrival Date required.';
   frm.arrivaldate.minlength = 10;
   frm.arrivaldate.minlengthError = 'Arrival Date to short.';
   frm.arrivaldate.maxlength = 10;
   frm.arrivaldate.maxlengthError = 'Arrival Date to Long.';
   
   var dates = "";
   dates = checkdate();
   
    
   
   
   var errors = getFormErrors(frm);
   if (errors.length > 0) {
      var errorMessage = 'The following information was missing or incomplete' + ((errors.length > 1) ? 's' : '') + ':\n\n';
      for (var errorIndex = 0; errorIndex < errors.length; errorIndex++) {
         errorMessage += '* ' + errors[errorIndex] + '\n';
      }
      errorMessage += '\nPlease correct ' + ((errors.length > 1) ? 'these' : 'this') + ' problem' + ((errors.length > 1) ? 's' : '') + ' and try again.';
      alert(errorMessage);
      return false;
   }
   
   // no errors: return true
   return true;
}

// ************************************** Iveri Consultant Preparation
function checkConsultant(frm) {
	var debug = false;
	
	if (debug)
	{
		alert("in checkConsultant function");
	}
	
   	// emails address - max length 80
	frm.emailAddress.required = true;
	frm.emailAddress.requiredError = 'Email address required.';
	frm.emailAddress.pattern = 'email';
	frm.emailAddress.patternError = 'The email address entered is not valid.';
	frm.emailAddress.maxlength = 80;
	frm.emailAddress.maxlengthError = 'Sorry, we cannot accept email addresses above 80 characters.';
	
	
	// first name - max length 100
	frm.firstName.required = true;
	frm.firstName.requiredError = 'First name required.';
	frm.firstName.maxlength = 100;
	frm.firstName.maxlengthError = 'Our systems do not allow first names longer than 100 characters.';
	
	// lastname - max length 100
   frm.lastName.required = true;
   frm.lastName.requiredError = 'Last name required.';
   frm.lastName.maxlength = 100;
   frm.lastName.maxlengthError = 'Our systems do not allow last names longer than 100 characters.';
   
   //Invoice number - max length 35
   frm.invoiceNumber.required = true;
   frm.invoiceNumber.requiredError = 'Invoice number required.';
   frm.invoiceNumber.maxlength = 20;
   frm.invoiceNumber.maxlengthError = 'Invoice numbers not greater than 10 Numbers';
   
   //Amount
   frm.amount.required = true;
   frm.amount.requiredError = 'Amount required.';

 
   var errors = getFormErrors(frm);
   if (errors.length > 0) {
      var errorMessage = 'The following information was missing or incomplete' + ((errors.length > 1) ? 's' : '') + ':\n\n';
      for (var errorIndex = 0; errorIndex < errors.length; errorIndex++) {
         errorMessage += '* ' + errors[errorIndex] + '\n';
      }
      errorMessage += '\nPlease correct ' + ((errors.length > 1) ? 'these' : 'this') + ' problem' + ((errors.length > 1) ? 's' : '') + ' and try again.';
      alert(errorMessage);
      return false;
   }
   
   // no errors: return true
   return true;
}

function checkCustPayment(frm) {
	var debug = false;
	
	if (debug)
	{
		alert("in checkCustPayment function");
	}
	
   	// emails address - max length 80
	frm.Ecom_BillTo_Online_Email.required = true;
	frm.Ecom_BillTo_Online_Email.requiredError = 'Email address required.';
	frm.Ecom_BillTo_Online_Email.pattern = 'email';
	frm.Ecom_BillTo_Online_Email.patternError = 'The email address entered is not valid.';
	frm.Ecom_BillTo_Online_Email.maxlength = 80;
	frm.Ecom_BillTo_Online_Email.maxlengthError = 'Sorry, we cannot accept email addresses above 80 characters.';
	
	
	// first name - max length 100
	frm.Ecom_BillTo_Postal_Name_First.required = true;
	frm.Ecom_BillTo_Postal_Name_First.requiredError = 'First name required.';
	frm.Ecom_BillTo_Postal_Name_First.maxlength = 100;
	frm.Ecom_BillTo_Postal_Name_First.maxlengthError = 'Our systems do not allow first names longer than 100 characters.';
	
	// lastname - max length 100
   frm.Ecom_BillTo_Postal_Name_Last.required = true;
   frm.Ecom_BillTo_Postal_Name_Last.requiredError = 'Last name required.';
   frm.Ecom_BillTo_Postal_Name_Last.maxlength = 100;
   frm.Ecom_BillTo_Postal_Name_Last.maxlengthError = 'Our systems do not allow last names longer than 100 characters.';
   
   //Invoice number - max length 35
   frm.Ecom_Payment_Card_Number.required = true;
   frm.Ecom_Payment_Card_Number.requiredError = 'Invoice number required.';
   
   //Card Month
   frm.Ecom_Payment_Card_ExpDate_Month.required = true;
   frm.Ecom_Payment_Card_ExpDate_Month.requiredError = 'Expiry Month required.';
   
   //Card Year
   frm.Ecom_Payment_Card_ExpDate_Month.required = true;
   frm.Ecom_Payment_Card_ExpDate_Month.requiredError = 'Expiry Year required.';

 
   var errors = getFormErrors(frm);
   if (errors.length > 0) {
      var errorMessage = 'The following information was missing or incomplete' + ((errors.length > 1) ? 's' : '') + ':\n\n';
      for (var errorIndex = 0; errorIndex < errors.length; errorIndex++) {
         errorMessage += '* ' + errors[errorIndex] + '\n';
      }
      errorMessage += '\nPlease correct ' + ((errors.length > 1) ? 'these' : 'this') + ' problem' + ((errors.length > 1) ? 's' : '') + ' and try again.';
      alert(errorMessage);
      return false;
   }
   
   // no errors: return true
   return true;
}

// ************************************** Syncleave Page
function checkSyncleave(frm) {
   	// emails address - max length 80
	frm.from.required = true;
	frm.from.requiredError = 'Email address required.';
	frm.from.pattern = 'email';
	frm.from.patternError = 'The email address entered is not valid.';
	frm.from.maxlength = 80;
	frm.from.maxlengthError = 'Sorry, we cannot accept email addresses above 80 characters.';
	
	// title
	frm.title.disallowEmptyValue = true;
	frm.title.disallowEmptyValueError = 'Title required.';
	
	// first name - max length 100
	frm.firstname.required = true;
	frm.firstname.requiredError = 'First name required.';
	frm.firstname.maxlength = 100;
	frm.firstname.maxlengthError = 'Our systems do not allow first names longer than 100 characters.';
	
	// lastname - max length 100
   frm.lastname.required = true;
   frm.lastname.requiredError = 'Last name required.';
   frm.lastname.maxlength = 100;
   frm.lastname.maxlengthError = 'Our systems do not allow last names longer than 100 characters.';
   
   //landline number - max length 35
   frm.landline.required = true;
   frm.landline.requiredError = 'Landline number required.';
   frm.landline.maxlength = 35;
   frm.landline.maxlengthError = 'Our systems do not allow phone numbers longer than 35 numbers.';
   
   //cellphone number - max length 35
   frm.cellphone.required = true;
   frm.cellphone.requiredError = 'CellPhone number required.';
   frm.cellphone.maxlength = 35;
   frm.cellphone.maxlengthError = 'Our systems do not allow phone numbers longer than 35 numbers.';

   //company - max length 100
   frm.company.required = true;
   frm.company.requiredError = 'Name of company is required.';
   frm.company.maxlength = 100;
   frm.firstname.maxlengthError = 'Our systems do not allow company names longer than 100 characters.';
   
   //departure date - required
   frm.departdatefrommonth.required = true;
   frm.departdatefrommonth.requiredError = 'Departure month required.';
   
   //return date - required
   frm.returndatefrommonth.required = true;
   frm.returndatefrommonth.requiredError = 'Departure month required.';
   
  
   // free text - max length 5000
   frm.message.required = true;
   frm.message.requiredError = 'Please enter your query.';
   frm.message.maxlength = 5000;
   frm.message.maxlengthError = 'Our systems do not allow messages longer than 5000 characters.';
   
   var errors = getFormErrors(frm);
  
   if (errors.length > 0) {
      var errorMessage = 'The following information was missing or incomplete' + ((errors.length > 1) ? 's' : '') + ':\n\n';
      for (var errorIndex = 0; errorIndex < errors.length; errorIndex++) {
         errorMessage += '* ' + errors[errorIndex] + '\n';
      }
      errorMessage += '\nPlease correct ' + ((errors.length > 1) ? 'these' : 'this') + ' problem' + ((errors.length > 1) ? 's' : '') + ' and try again.';
      alert(errorMessage);
      return false;
   }
   // no errors: return true
   return true;
}

// ************************************** Syncleave Page
function checkCustFeedback(frm) {
   	// emails address - max length 80
	frm.from.required = true;
	frm.from.requiredError = 'Email address required.';
	frm.from.pattern = 'email';
	frm.from.patternError = 'The email address entered is not valid.';
	frm.from.maxlength = 80;
	frm.from.maxlengthError = 'Sorry, we cannot accept email addresses above 80 characters.';
	
	// title
	frm.title.disallowEmptyValue = true;
	frm.title.disallowEmptyValueError = 'Title required.';
	
	// first name - max length 100
	frm.firstname.required = true;
	frm.firstname.requiredError = 'First name required.';
	frm.firstname.maxlength = 100;
	frm.firstname.maxlengthError = 'Our systems do not allow first names longer than 100 characters.';
	
	// lastname - max length 100
   frm.lastname.required = true;
   frm.lastname.requiredError = 'Last name required.';
   frm.lastname.maxlength = 100;
   frm.lastname.maxlengthError = 'Our systems do not allow last names longer than 100 characters.';
   
   /**
   //landline number - max length 35
   frm.landline.required = true;
   frm.landline.requiredError = 'Landline number required.';
   frm.landline.maxlength = 35;
   frm.landline.maxlengthError = 'Our systems do not allow phone numbers longer than 35 numbers.';
   **/

   var errors = getFormErrors(frm);
  
   if (errors.length > 0) {
      var errorMessage = 'The following information was missing or incomplete' + ((errors.length > 1) ? 's' : '') + ':\n\n';
      for (var errorIndex = 0; errorIndex < errors.length; errorIndex++) {
         errorMessage += '* ' + errors[errorIndex] + '\n';
      }
      errorMessage += '\nPlease correct ' + ((errors.length > 1) ? 'these' : 'this') + ' problem' + ((errors.length > 1) ? 's' : '') + ' and try again.';
      alert(errorMessage);
      return false;
   }
   // no errors: return true
   return true;
}




// ************************************** DealEnquiry

function checkDealEnquiry2(frm) {
   	// emails address - max length 80
	frm.from.required = true;
	frm.from.requiredError = 'Email address required.';
	frm.from.pattern = 'email';
	frm.from.patternError = 'The email address entered is not valid.';
	frm.from.maxlength = 80;
	frm.from.maxlengthError = 'Sorry, we cannot accept email addresses above 80 characters.';
	
	
	
	// first name - max length 100
	frm.firstname.required = true;
	frm.firstname.requiredError = 'First name required.';
	frm.firstname.maxlength = 100;
	frm.firstname.maxlengthError = 'Our systems do not allow first names longer than 100 characters.';
	
	
   
   //phone number - max length 35
   frm.landline.required = true;
   frm.landline.requiredError = 'Phone number required.';
   frm.landline.maxlength = 35;
   frm.landline.maxlengthError = 'Our systems do not allow phone numbers longer than 35 numbers.';
   
   
   
   
   
   	//dateofbirth
  // frm.dateofbirth.required = true;
  // frm.dateofbirth.requiredError = 'Date of Birth required.';
 //  frm.dateofbirth.minlength = 10;
  // frm.dateofbirth.minlengthError = 'Date of Birth to short.';
 //  frm.dateofbirth.maxlength = 10;
 //  frm.dateofbirth.maxlengthError = 'Date of Birth to long.';
  

   //date
   
  // frm.departdate.required = true;
  // frm.departdate.requiredError = 'Departure date required.';
 //  frm.departdate.minlength = 10;
  // frm.departdate.minlengthError = 'Departure date to short.';
  // frm.departdate.maxlength = 10;
  // frm.departdate.maxlengthError = 'Departure date to long.';
   
   var dates = "";
   dates = checkdate();
   
   var errors = getFormErrors(frm);
   if (errors.length > 0 || dates != "") {
      var errorMessage = 'The following information was missing or incomplete' + ((errors.length > 1) ? 's' : '') + ':\n\n';
      for (var errorIndex = 0; errorIndex < errors.length; errorIndex++) {
         errorMessage += '* ' + errors[errorIndex] + '\n';
      }
	  errorMessage += dates;
      errorMessage += '\nPlease correct ' + ((errors.length > 1) ? 'these' : 'this') + ' problem' + ((errors.length > 1) ? 's' : '') + ' and try again.';
      alert(errorMessage);
      return false;
   }
   
   // no errors: return true
   return true;
}



// ************************************** FlightEnquiry

function checkFlightEnquiry2(frm) {
   	// emails address - max length 80
	frm.from.required = true;
	frm.from.requiredError = 'Email address required.';
	frm.from.pattern = 'email';
	frm.from.patternError = 'The email address entered is not valid.';
	frm.from.maxlength = 80;
	frm.from.maxlengthError = 'Sorry, we cannot accept email addresses above 80 characters.';
	
	
	// first name - max length 100
	frm.firstname.required = true;
	frm.firstname.requiredError = 'First name required.';
	frm.firstname.maxlength = 100;
	frm.firstname.maxlengthError = 'Our systems do not allow first names longer than 100 characters.';
	
	
   //phone number - max length 35
   frm.landline.required = true;
   frm.landline.requiredError = 'Phone number required.';
   frm.landline.maxlength = 35;
   frm.landline.maxlengthError = 'Our systems do not allow phone numbers longer than 35 numbers.';
   
 

   
   	//dateofbirth
   //frm.dateofbirth.required = true;
   //frm.dateofbirth.requiredError = 'Date of Birth required.';
   //frm.dateofbirth.minlength = 10;
   //frm.dateofbirth.minlengthError = 'Date of Birth to short.';
  
   	//Departure Date
   //frm.departdate.required = true;
   //frm.departdate.requiredError = 'Departure Date required.';
   //frm.departdate.minlength = 10;
   //frm.departdate.minlengthError = 'Departure Date to short.';
   //frm.departdate.maxlength = 10;
   //frm.departdate.maxlengthError = 'Departure Date to long.';
   
 
   
   var dates = "";
   dates = checkdate();
   
    
   
   
   var errors = getFormErrors(frm);
   if (errors.length > 0) {
      var errorMessage = 'The following information was missing or incomplete' + ((errors.length > 1) ? 's' : '') + ':\n\n';
      for (var errorIndex = 0; errorIndex < errors.length; errorIndex++) {
         errorMessage += '* ' + errors[errorIndex] + '\n';
      }
      errorMessage += '\nPlease correct ' + ((errors.length > 1) ? 'these' : 'this') + ' problem' + ((errors.length > 1) ? 's' : '') + ' and try again.';
      alert(errorMessage);
      return false;
   }
   
   // no errors: return true
   return true;
}