//js email form validation
function checkEmailForm() {
	if (document.EmailForm) {
		var alerterror="";

		if (document.EmailForm.Name && document.EmailForm.Name.value.length==0) {
			alerterror=alerterror+"Please enter your name!\n";
			document.EmailForm.Name.style.backgroundColor="#ff0000";
		}

		if (document.EmailForm.Phone1) {
			var ph=document.EmailForm.Phone1.value+document.EmailForm.Phone2.value+document.EmailForm.Phone3.value;

			if (ph.length<10 || isNaN(ph)) {
				alerterror=alerterror+"Please enter a valid phone number!\n";
				document.EmailForm.Phone1.style.backgroundColor="#ff0000";
				document.EmailForm.Phone2.style.backgroundColor="#ff0000";
				document.EmailForm.Phone3.style.backgroundColor="#ff0000";
			}
		}

		if (document.EmailForm.EmailAddress) {
			var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,7}$/;

			if (!emailPattern.test(document.EmailForm.EmailAddress.value)) {
				alerterror=alerterror+"Please enter a valid email address!\n";
				document.EmailForm.EmailAddress.style.backgroundColor="#ff0000";
			}
		}

		if (document.EmailForm.Message && document.EmailForm.Message.value.length==0) {
			alerterror=alerterror+"Please enter a message!\n";
			document.EmailForm.Message.style.backgroundColor="#ff0000";
		}

		if (alerterror.length) {
			alert(alerterror);
			return false }
		else {
			document.EmailForm.SendMessage.disabled=true;
			document.EmailForm.SendMessage.value="Processing Request...";
			return true
		}
	}
}
