$(function() {
	$("#submit_comment").click(function() {
		var author_name = $("#author_name").val();
		var author_email = $("#author_email").val();
		var comment = $("textarea#comment").val();
		var antispam = $("#antispam").val();
		var article_id = $("#article_id").val();
		var dataString = 'author_name='+author_name+'&author_email='+author_email+'&comment='+comment+'&article_id='+article_id;
		if(author_name == '' || author_email == '' || comment == '' || antispam != 'blue') {
			alert('Please complete all boxes');
		} else {
			$("#loading").show();
			$.ajax({
				type: "POST",
				url: "http://www.your-familyhistory.com/ajax/comment.php",
				data: dataString,
				cache: false,
				success: function(html) {
					$("ol#comments").append(html);
					$("ol#comments li:last").fadeIn("slow");
					$("#loading").hide();
					
					$("#author_name").val('')
					$("#author_email").val('');
					$("textarea#comment").val('');
					$("#antispam").val('');
				}
			});
		} return false;
	}); 
});
