	
	/* Validate the form */
	function validateContact(f){
		// Set the flag to indicate if all ok
		var bPass = true;

		// Check that the required fields have data present
		bPass = CheckForInput(f.txtQuestion, "") ? bPass : false;
		bPass = CheckForInput(f.txtName, "") ? bPass : false;
		bPass = CheckForInput(f.txtEmail, "") ? bPass : false;
	
		// If there was an error
		if(!bPass) {
			alert('Please complete the highlighted fields as these are mandatory.');
			return false;
		}
		
		// Check that the email is valid
		if(!validateEmail(f.txtEmail.value)){ 
			f.txtEmail.style.backgroundColor = 'lightblue';
			alert('Please enter a valid email.'); 
			return false; 
		}
	
		// If all ok, return true
		return true;
	}
	
	

	/* Called to check that a required field is present */
	// Returns true/false depending on if data present
	function CheckForInput(inp, value2check){
		// Check that there is data
		if(stripWhitespace(inp.value) == value2check){
			// Highlight the background color if fail
			inp.style.backgroundColor = 'lightblue';
			return false;
		}else{
			// Remove the background color if ok
			inp.style.backgroundColor = 'white';
			return true;
		}
	}
	
	/* Remove white space from start & end of string */
	function stripWhitespace(str) {
		str = this != window ? this : str;
		return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
	}
	
	/* Function to validate an email address */
	function validateEmail(email) {
	  var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
	  return regex.test(email);
	}

	//-->

