// User submitted recipes
function validContactUs (contactus) {
	
	// Check if the fields are filled in
	if (contactus.fullName2.value == '' && contactus.fromWhere2.value == '' && contactus.phone2.value == '' && contactus.msgArea.value == '' && contactus.fromAddress.value == '') {
		alert ('Please fill in the fields.')
		contactus.fullName2.focus ()
		return false
	}
	else
	if (contactus.fullName2.value == '') {
		alert ('Complete name field cannot be empty.')
		contactus.fullName2.focus ()
		return false
	}
	else
	if (contactus.fromWhere2.value == '') {
		alert ('E-mail field cannot be empty.')
		contactus.fromWhere2.focus ()
		return false
	}
	else
	if (contactus.phone2.value == '') {
		alert ('Contact number(s) field cannot be empty.')
		contactus.phone2.focus ()
		return false
	}
	else
	if (contactus.msgArea.value == '') {
		alert ('Kindly provide your comment.')
		contactus.msgArea.focus ()
		return false
	}
	else
	// Now we check the contents by using regular expressions
	Email = contactus.fromWhere2.value;
	var emailLength = Email.length - 1;
	var signLocation = Email.indexOf ('@'); 
	var dotLocation = Email.lastIndexOf ('.');
	var signLocation2 = Email.lastIndexOf ('@');
	if (Email.charAt (0) == '@' || Email.charAt (emailLength) == '@' || dotLocation - signLocation < 3 || Email.charAt (0) == '.' || Email.charAt (l) == '.' || Email.length < 8 || signLocation != signLocation2 || Email.indexOf ('@') == -1 || Email.indexOf (' ') != -1 || Email.indexOf ('*') != -1 || Email.indexOf ('/') != -1 || Email.indexOf ('&') != -1 || Email.indexOf ('<') != -1 || Email.indexOf ('>') != -1 || Email.indexOf ('?') != -1 || Email.indexOf ('|') != -1 || Email.indexOf (':') != -1 || Email.indexOf (',') != -1 || Email.indexOf ('=') != -1 || Email.indexOf ('(') != -1 || Email.indexOf (')') != -1 || Email.indexOf ('%') != -1 || Email.indexOf ('#') != -1) {
		alert ('Invalid Email. Please check your entry.')
		contactus.fromWhere2.focus ()
		return false
	}
	
	// If the rest are satisfied, then submit
	else
		return true
}
