// JS Functions

// Form Validation
function isValidEmail(str) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str)){
		return true;
	}
	else {
		return false;
	}
}


function checkenquiryform(){
	var ftxt = '';
	
	if (document.enqForm.name.value==''){
		ftxt += '\n- Please enter a Name.';
	}
	
	if (isValidEmail(document.enqForm.email.value)==false){
		ftxt += '\n- Please enter a valid Email Address.';
	}

	
	if (document.enqForm.enquiry.value==''){
		ftxt += '\n- Please enter an Enquiry.';
	}	
	
	if (ftxt!==''){
		alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
		return false;
	}
	else {
		return true;
	}
}
