function chkFrm() {
	strErrors = ""; //string to hold error messages

	//Salutation
	var oSal = document.register_conf.salutation.selectedIndex;
	
	if (document.register_conf.salutation.options[oSal].value=="NA") {
		strErrors += "<li>A Salutation must be selected.<\/li>\n";
		document.register_conf.salutation.focus();
	}

	//First Name
	if (document.register_conf.firstname.value == "") {
		strErrors += "<li>First Name is required.<\/li>\n";
		document.register_conf.firstname.select();
		document.register_conf.firstname.focus();
	} else {
		var strFstName = document.register_conf.firstname.value;
		var strFstNameRegExp = /^[a-zA-Z]+(([\s-'])?[a-zA-Z]+)*$/;
		
		if (strFstName.search(strFstNameRegExp) ==-1) {
			strErrors += "<li>First Name Invalid: Must contain only alphabetic characters.<\/li>\n";
			document.register_conf.firstname.select();
			document.register_conf.firstname.focus();
		}
	}
	
	//Last Name
	if (document.register_conf.lastname.value == "") {
		strErrors += "<li>Last Name is required.<\/li>\n";
		document.register_conf.lastname.select();
		document.register_conf.lastname.focus();
	} else {
		var strLstName = document.register_conf.lastname.value;
		var strLstNameRegExp = /^[a-zA-Z]+(([\s-'])?[a-zA-Z]+)*$/;
		
		if (strLstName.search(strLstNameRegExp) ==-1) {
			strErrors += "<li>Last Name Invalid: Must contain only alphabetic characters.<\/li>\n";
			document.register_conf.lastname.select();
			document.register_conf.lastname.focus();
		}
	}

	//Position
	if (document.register_conf.position.value == "") {
		strErrors += "<li>A postion title is required.<\/li>\n";
		document.register_conf.position.select();
		document.register_conf.position.focus();
	}


	//Address 1
	if (document.register_conf.address1.value == "") {
		strErrors += "<li>An address is required.<\/li>\n";
		document.register_conf.address1.select();
		document.register_conf.address1.focus();
	}

	//City
	if (document.register_conf.city.value == "") {
		strErrors += "<li>City is required.<\/li>\n";
		document.register_conf.city.select();
		document.register_conf.city.focus();
	} else {
		var strCity = document.register_conf.city.value;
		var strCityRegExp = /^[a-zA-Z]+(([\s-'])?[a-zA-Z]+)*$/;
		
		if (strCity.search(strCityRegExp) ==-1) {
			strErrors += "<li>City Invalid: Must contain only alphabetic characters<\/li>\n";
			document.register_conf.city.select();
			document.register_conf.city.focus();
		}
	}
	
	//State
	if (document.register_conf.state.value == "") {
		strErrors += "<li>State is required.<\/li>\n";
		document.register_conf.state.select();
		document.register_conf.state.focus();
	} else {
		var strState = document.register_conf.state.value;
		var strStateRegExp = /^[a-zA-Z]+(([\s-'])?[a-zA-Z]+)*$/;
		
		if (strState.search(strStateRegExp) ==-1) {
			strErrors += "<li>State Invalid: Must contain only alphabetic characters<\/li>\n";
			document.register_conf.state.select();
			document.register_conf.state.focus();
		}
	}
	
	//Post Code
	if (document.register_conf.zip.value == "") {
		strErrors += "<li>Post Code is Required.</li>\n";
		document.register_conf.zip.focus();
		document.register_conf.zip.select();
	} else {
		var strZipRegExp = /^\d{4,10}$/;
		var strZip = document.register_conf.zip.value;
		
		if (strZip.search(strZipRegExp)==-1) {
			strErrors += "<li>Post Cost must contain 4-10 digits, no spaces.</li>\n";
			document.register_conf.zip.focus();
			document.register_conf.zip.select();
		}
	}
	
	//Country
	var oCoun = document.register_conf.country.selectedIndex;
	
	if (document.register_conf.country.options[oCoun].value=="NA") {
		strErrors += "<li>Country must be selected.<\/li>\n";
		document.register_conf.country.focus();
	} 
	
	//Contact Number
	if (document.register_conf.workphone.value == "") {
		strErrors += "<li>Contact Phone Number is Required.</li>\n";
		document.register_conf.workphone.focus();
		document.register_conf.workphone.select();
	} else {
		var strPhoneRegExp = /^\d{8,15}$/;
		var strPhone = document.register_conf.workphone.value;
		
			if (strPhone.search(strPhoneRegExp)==-1) {
				strErrors += "<li>Phone Number must contain 8-15 digits, no spaces.</li>\n";
				document.register_conf.workphone.focus();
				document.register_conf.workphone.select();
			}
	}
	
	//Fax
	if (document.register_conf.fax.value != "") {
		var strFax = document.register_conf.fax.value;
	
		if (strFax.length >=1) {
			var strFaxRegExp = /^\d{8,15}$/;
		
			if (strFax.search(strFaxRegExp)==-1) {
				strErrors += "<li>Fax Number must contain 8-15 digits, no spaces.</li>\n";
				document.register_conf.fax.focus();
				document.register_conf.fax.select();
			}
		}
	}
	
	//Mobile
	if (document.register_conf.mobile.value != "") {
		var strMobile = document.register_conf.mobile.value;
	
		if (strMobile.length >=1) {
			var strMobileRegExp = /^\d{8,15}$/;
		
			if (strMobile.search(strMobileRegExp)==-1) {
				strErrors += "<li>Mobile Number must contain 8-15 digits, no spaces.</li>\n";
				document.register_conf.mobile.focus();
				document.register_conf.mobile.select();
			}
		}
	}
	
	//Email
	if (document.register_conf.email.value == "") {
	strErrors += "<li>Email is required<\/li>\n";
	document.register_conf.email.select();
	document.register_conf.email.focus();
	} else {
		var strEmailRegExp = /^\+?[a-zA-Z0-9](([-.]|[_]+)?[a-zA-Z0-9]+)*@([a-zA-Z0-9]+(\.|\-))+[a-zA-Z]{2,4}$/;
		var strEmail = document.register_conf.email.value;
		
			if (strEmail.search(strEmailRegExp)==-1) { 
				strErrors += "<li>Email address is invalid.</li>\n";
			}
	}
	
	//Room Type
	var oRoom = document.register_conf.roomtype.selectedIndex;
	
	if (document.register_conf.roomtype.options[oRoom].value=="NA") {
		strErrors += "<li>Please select your Room Type.<\/li>\n";
		document.register_conf.roomtype.focus();
	}
	
	//Sharing Room
	if ((document.register_conf.roomtype.options[oRoom].value=="Shared Room") && (document.register_conf.sharingwith.value=="")) {
		strErrors += "<li>Please indicate the person you are sharing the room with.<\/li>\n";
		document.register_conf.sharingwith.focus();
	}
	
	//Additional Nights
	var oAddNight = document.register_conf.addnights.selectedIndex;
	
	if (document.register_conf.addnights.options[oAddNight].value=="NA") {
		strErrors += "<li>Please indicate the number of additional nights.<\/li>\n";
		document.register_conf.addnights.focus();
	}
	
	//Transfer Required
	var oTransfer = document.register_conf.transfer.selectedIndex;
	
	if (document.register_conf.transfer.options[oTransfer].value=="NA") {
		strErrors += "<li>Please select Transfer Requirements.<\/li>\n";
		document.register_conf.transfer.focus();
	}
	
	//Pickup
	var oPickup = document.register_conf.pickup.selectedIndex;
	
	if ((document.register_conf.transfer.options[oTransfer].value=="Yes") && (document.register_conf.pickup.options[oPickup].value=="NA")) {
		strErrors += "<li>Please select Pickup Option.<\/li>\n";
		document.register_conf.pickup.focus();
	}
	
	//Dietary Requirements
	var oDiet = document.register_conf.diet.selectedIndex;
	
	if (document.register_conf.diet.options[oDiet].value=="NA") {
		strErrors += "<li>Please select your Dietary Requirements.<\/li>\n";
		document.register_conf.diet.focus();
	}
	
	//Dietary Requirements Other
	if ((document.register_conf.diet.options[oDiet].value=="Other") && (document.register_conf.dietother.value=="")) {
		strErrors += "<li>Please identify the other Dietary Requirements.<\/li>\n";
		document.register_conf.dietother.focus();											
	}
	

//if there are errors then return the error msg, otherwise submit the form
	if (strErrors) {
	 	return strErrors;
	} else {
		return "";
	} 
}
//-------------------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------------------
//FUNCTION SUBMIT FORM
function submit_form() {
	//check the form to see if there is no errors - if not then submit the form
	//if so, display the error message
	var strErrMsg = ""; //string that holds the errors discovered
	var strFullErrMsg = ""; //formatted string that displays errors with title message etc...
	
	//check that required fields have been filled in
	//if they have not then add the error message to the error message string
	strErrMsg = chkFrm();

	if (strErrMsg) { //if there has been errors discovered, output them
	 	strFullErrMsg = "The following errors have occured: \n <ul>\n";
	 	strFullErrMsg += strErrMsg;
		strFullErrMsg += "\n<\/ul><br>";
		
		//get the element to put the errors in (i.e. the table fild where the errors are to be displayed)
		var elem = document.getElementById('tdErrorMessage');
		elem.innerHTML = strFullErrMsg;
		return false;
	} else {
		//there is no errors so submit the form
		return true;
	} 
}
//---------------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------------
//FUNCTION CLEAR FORM
function clearFrm() {
	//clear all values in the form
	document.register_conf.salutation.value = "NA";
	document.register_conf.firstname.value = "";
	document.register_conf.lastname.value = "";
	document.register_conf.position.value = "";
	document.register_conf.department.value = "";
	document.register_conf.address1.value = "";
	document.register_conf.address2.value = "";
	document.register_conf.city.value = "";
	document.register_conf.state.value = ""
	document.register_conf.zip.value = "";
	document.register_conf.country.value = "NA";
	document.register_conf.workphone.value = "";
	document.register_conf.fax.value = "";
	document.register_conf.mobile.value = "";
	document.register_conf.email.value = "";
	document.register_conf.roomtype.value = "NA";
	document.register_conf.sharingwith.value = "";
	document.register_conf.addnights.value = "NA";
	document.register_conf.accomother.value = "";
	document.register_conf.transfer.value = "NA";
	document.register_conf.pickup.value = "NA";
	document.register_conf.travelother.value = "";
	document.register_conf.diet.value = "NA";
	document.register_conf.dietother.value = "";
	document.register_conf.chkCond.checked = false;
	document.register_conf.btnSubmit.disabled = true;
	
	//get the element to put the errors in (i.e. the table fild where the errors are to be displayed)
	var elem = document.getElementById('tdErrorMessage');
  	elem.innerHTML = "";  //clear the error message
}
//--------------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------------
//FUNCTION BUTTON ENABLE
//A function that will enable the Submit Button if the user checks the accept to conditions checkbox on
// on the form.
function button_enable() {
	if (document.register_conf.chkCond.checked) {
		document.register_conf.btnSubmit.disabled = false;
	}else{
		document.register_conf.btnSubmit.disabled = true;
	}
}
//-----------------------------------------------------------------------------------------------------------