$(function() {
	//review comment
	$(".reviewCommentForm").bind("submit", function(e) {	
		//never actually submit
		e.preventDefault();
		
		var self = $(this);
		self.siblings('.ajax-loader').show();
		
		$.post($(this).attr('action'), $(this).serialize(), function(data) {

			self.siblings('.ajax-loader').hide();
			
			self.siblings('.comments').append(data);
			self.siblings('.add-comment').show();
			self.hide();
			var counter = parseInt(self.parents('.footer').find('.comment-counter').html());
			self.parents('.footer').find('.comment-counter').html(counter+1);
		});
	});    
	
	//edit review comment
	$(".editCommentForm").bind("submit", function(e) {	
		//never actually submit
		e.preventDefault();		

		var self = $(this);
		self.siblings('.ajax-loader').show();
		
		$.post($(this).attr('action'), $(this).serialize(), function(data) {
			self.siblings('.ajax-loader').hide();
			self.siblings('.edit-comment').show();
			self.siblings('.comment-text').show();
			self.siblings('.comment-text').html(data);
			self.hide();
		});
	});    
});
