$(document).ready(function() {
	// SUBSCRIPTION VALIDATION
	$("#subscribe").submit(function() {

		var str = $(this).serialize();

		$.ajax({

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

					if(msg == 'OK') { // Message Sent? Show the 'Thank You' message and hide the form
						result = '<p class="subscribe_ok">Thank you for subscribing!<br>You will receive a link via email to verify your subscription.</p>';
						$("#subscribe-pre").hide();
						$("#subscribe-welcome").hide();
					} else {
						result = msg;
					}
	
					$(this).html(result);

				});
			}

		});

		return false;
	
	});

});

