$(function() {
  $('.error').hide();
  $(".submit").click(function() {
    $('.error').hide();
	  var name = $("input#name").val();
		if (name == "") {
	  $("label#name_error").show('slow');
      $("input#name").focus();
      return false;
    }
		var email = $("input#email").val();
		if (email == "") {
      $("label#email_error").show('slow');
      $("input#email").focus();
      return false;
    }
	
		var message = $("textarea#message").val();
		if (message == "") {
      $("label#message_error").show('slow');
      $("textarea#message").focus();
      return false;
    }
		
	var dataString = 'name='+ name + '&email=' + email + '&message=' + message;
	$.ajax({
      type: "POST",
      url: "http://www.ozroyal.com/wp-content/themes/ozroyal/js/quickcontact.php",
      data: dataString,
      success: function() {
        $('div#contform').html("<div id='success'></div>");
        $('#success').html("<h2>Contact Form Submitted!</h2>")
        .append("<p>We will get back to you shortly.</p>")
        .hide()
        .fadeIn(1500)
      }
     });
    return false;
	});
});
