$(document).ready(function(){
$("#submit").click(function(){
$(".error").hide();
var hasError = false;
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
var contactVal = $("#Contact_Name").val();
if(contactVal == '') {
$("#Contact_Name").after('You forgot to enter your name.').fadeIn('slow');
hasError = true;
}
var emailFromVal = $("#Contact_eMail").val();
if(emailFromVal == '') {
$("#Contact_eMail").after('You forgot to enter the email address to send from.');
hasError = true;
} else if(!emailReg.test(emailFromVal)) {
$("#Contact_eMail").after('Enter a valid email address to send from.');
hasError = true;
}
var messageVal = $("#Contact_Query").val();
if(messageVal == '') {
$("#Contact_Query").after('You forgot to enter the message.');
hasError = true;
}
if(hasError == false) {
$(this).hide();
document.forms[0].submit();
/*$("#sendEmail li.buttons").append('');
$.post("/wp-content/uploads/2008/01/sendemail.php",
{ emailTo: emailToVal, emailFrom: emailFromVal, subject: subjectVal, message: messageVal },
function(data){
$("#sendEmail").slideUp("normal", function() {
$("#sendEmail").before('
Your email was sent.
'); }); } ); */ } return false; }); });