$(function () {

$(".error").hide();

	$(".submit").click(function () {
		$(".error").hide();
		
		var name = $("input#name").val();
			if (name == "") 
				{
				$("label#name_error").show();
				$("input#name").focus();
				return false;
				}
				
		var emailfrom = $("input#emailfrom").val();
			if (emailfrom == "") 
				{
				$("label#email_error").show();
				$("input#emailfrom").focus();
				return false;
				}
				
		var comment = $("textarea#comment").val();
			if (comment == "") 
				{
				$("label#comment_error").show();
				$("textarea#comment").focus();
				return false;
				}
				
		  var dataString = 'name='+ name + '&emailfrom=' + emailfrom + '&comment=' + comment;
 // alert (dataString);return false;
  $.ajax({
    type: "POST",
    url: "contact_form_script.php",
    data: dataString,
    success: function() {
      $('#dialog').html("<div id='message'></div>");
      $('#message').html("<h2>Contact Form Submitted!</h2>")
      .append("<p>We will be in touch soon.</p>")
      .hide()
      .fadeIn(1500, function() {
        
      });
    }
  });
  return false;
	});		

});
