function errMsg(msg){
	alert(msg);
	return true;
}
var msg = "";
var missing = "";

// Called by Check Form Fields button.
// If both functions return true, displays values in lower  table and displays an alert message.
function  validate(thisform)
{
// place any other field validations that you require here

  if(thisform.COMPANY_NAME.value == "") missing += "\n - Company Name.";

  if(thisform.CONTACT_NAME.value == "") missing += "\n - Contact Name.";

  if(thisform.DIRECT_NUMBER.value == "") missing += "\n - Direct Number.";

  if(thisform.EMAIL_ADDRESS.value == "") missing += "\n - Email address.";

  if(thisform.EMAIL_ADDRESS.value != "") {
		re=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/
		if(!re.test(thisform.EMAIL_ADDRESS.value)) {
			missing += "\n - Invalid email address.";
		}

		if(thisform.EMAIL_ADDRESS.value != thisform.CONFIRM_EMAIL_ADDRESS.value)
			missing += "\n - Invalid email address. Do not match.";
	}

  if(thisform.CONFERENCE_DATE_IN.value == "" && thisform.CONFERENCE_DATE_OUT.value =="") {
	missing += "\n - Conference Dates. IN and OUT.";
  }

  if(thisform.NUMBER_OF_DELEGATES.value == "") missing += "\n - Number of Delegates.";

//if(thisform.ACCOM_DATE_IN_OPTION_1.value == "" && thisform.ACCOM_DATE_OUT_OPTION_1.value =="") {
//	missing += "\n - Accommodation Dates. Option 1 IN and OUT.";
//  }
  if(thisform.SOURCE.value == "") missing += "\n - How did you hear about us?";

	if(missing.length !=0) {
		msg += "\n\nThe following required fields are missing:";
		msg+= missing;

		errMsg(msg);
		msg = "";
		missing="";
		return false;
	} else {
		return true;
	}
}
// set a random number for the form so that the chance of 2 people submitting the form at the same time is reduced.
function init() {
      var randomnumber=Math.floor(Math.random()*1001);
      document.forms[0].randomnum.value =  randomnumber;
}