$(document).ready(function() {
	$(".rating").rating({
		callback: function(value, link, rating) {
			var form = $("#RatingAjaxRateScoopForm");
			$("#RatingValue_").val(value);
			$("#RatingValue").val(value);

			//var rating = $.rating.groups['data_Rating][value]'];
			//rating.readOnly = true;

			$.post(
				form.attr("action"),
				form.serialize(),
				function(response) {
					var response_field = $("#about_this_scoop .content .rating_response");
					if(typeof(response.response.success) != 'undefined') {
						$(response_field).addClass("success");
						$(response_field).removeClass("error");
						$(response_field).text(response.response.success);
					} else {
						$(response_field).addClass("error");
						$(response_field).removeClass("success");
						$(response_field).text(response.response.error);
					}
				},
				'json'
			);
		}
	});
});