// Comments AJAX jq by tomi

$(document).ready(function(){
	$(".submit_comment").click(function(){
		if($("#comment").val().length != 0){
			$(".submit_comment").attr('disabled', true);			
			$.post("/user/articlecomment.aspx", { articleid: $(".submit_comment").attr("id"), comments: escape($("#comment").val()) },
			  function(data){
				if(data == "true")
				{
					$("#comment").val("");
					$("#dialog").dialog('open');
					$("#dialog").dialog('option', 'title', 'Your comments have been submitted and are waiting for review!');
					// alert("Your comments have been submitted and are waiting for review!");
					// $("#comment").attr('disabled', true);
					$("#add_comments").hide();
					setTimeout(function(){ 
					 $("#dialog").dialog('close');
   					 cartProcess = false;
					}, 3000 ); 
				}
				else
					alert("There was a problem submitting your comment, please try again.");
			  });
		} else {
			alert("Please fill in your comments!");
		}
	});
});