// JavaScript Document
$(document).ready(function(){
	$('#newsletter-form').submit(function(e){
		e.preventDefault();
		
		if (($("#name").val() != '') && ($("#email").val() != '')){		
			$.post('/content/newsletter/newsletter-result2.php', $("#newsletter-form").serialize(), function(data) {
				$('#article-content').html(data);
				$("#article-content").scrollTop();
				
				// Scroll to the top of the results
				$('html, body').animate({
					scrollTop: $("#article-content").offset().top
				}, 500);
			});
		} else {
			alert('Please fill in all values!');
			
			if ($('#name').val() == ''){
				$('#name').css('background-color', '#fcc');
			}
			
			if ($('#email').val() == ''){
				$('#email').css('background-color', '#fcc');
			}
		}
	
	});

});
