
$(document).ready(function(){
	
	$("form").submit(function(){

		var str = $("form").serialize();

		$.ajax({
   			type: "POST",
			url: "inc/contact.php",
			data: str,
			success: function(msg){
    
				$("#note").ajaxComplete(function(event, request, settings){

					if(msg == 'OK') // If message was sent, hide form and show success message
					{
						result = '<div class="notification_ok">Your message has been sent. Thank you!</div>';
						$("#fields").hide();
					
					} else {
						result = msg;
					}

					$(this).html(result);

				});

			}

		});

		return false;

	});

});