$().ready(function() {
	
	//approval confirmation
	$(".approve").click(function() {
		return confirm('Are you sure you wish to approve this comment?');
	});
	
	//deactivation confirmation
	$(".deactivate").click(function() {
		return confirm('Are you sure you wish to deactivate this comment?');
	});
	
	//delete confirmation
	$("#hide_comment").click(function() {
	  $("#add_comment").hide();
		return false;
	});
	
	//jquery validations
	$("#addComment").validate({
		rules: {
			name: {
				required: true,
				minlength: 3
			},
			content: 'required',
			security_code: 'required'
		},		
		messages: {
			name: {
				required: "Please give a name",
				minlength: "The name must consist of at least 3 characters"
			},
			content: "Please give your comment",
			security_code: "Please enter the security code"
		}		
	});
	
});

function showAddComment(id) {
	$("#add_comment").show();
	$("#addComment #item_id").val(id);
	return false;
}