/* 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 = 'lightpink';
		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);
}
