$(document).ready(function(){ 
  $("#ajax-contact-form").submit(function(){
  $('#note').show();
  $('#note').append("<img id='loader' src='images/loader.gif' />");
  $('#sending').html("<h1>Sending Message</h1>")
 
  

var str = $(this).serialize();

   $.ajax({
   type: "POST",
   url: "contact.php",
   data: str,
   success: function(msg){
    
$("#sending").ajaxComplete(function(event, request, settings){
$('#note').hide();
if(msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form
{
result = '<div class="notification_ok"><h2>Message Sent.</h2><p> We will be in touch soon.</p></div>';
$("#fields").hide();
$('#checkmark').append("<img src='images/check.jpg' />");
}
else
{
result = msg;
}

$(this).html(result);

});

}

 });

return false;

});

});
