$(document).ready(function() {

	// SUBSCRIPTION VALIDATION
	$("#subscribeForm").submit(function() {

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

		$.ajax({

			type: "POST",
			url:  "subscribe_process.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

						$("#subscribe-pre").fadeOut('fast');
						$("#form-elements").fadeOut('fast');
						//$("#comment-form").fadeOut(2000);

						result = '<h3>Thank you for subscribing!</h3><p>You will receive a link via email to verify your subscription.<br><strong>If you do not receive the validation email, please check your junk mail.</strong></p>';

					} else {
						result = msg;
					}
	
					$(this).html(result);

				});
			}

		});

		return false;
	
	});

});
