(function($){
	$.fn.refreshReview = function(options) {
		$.ajax({
			type: "post",
			url: "app/includes/ajax.php",
			data: {"action": "get_reviews", "obj": options.obj, "label": options.label, "label_plu": options.label_plu}
		}).done(function(data){
			data = JSON.parse(data);
			$("#review-container-"+options.obj).html(data);
		})
	}
})(jQuery);

jQuery(document).ready(function($){

	function refreshReviewTimer() {
	    setTimeout(function () {
	    	$( ".submit-review-btn" ).each(function( index ) {
	    		var options = new Object();
	    		options.obj = $(this).data("id");
	    		options.label = $(this).data("label");
	    		options.label_plu = $(this).data("labelPlu");
	    		$(document).refreshReview(options);
	    	})
	        refreshReviewTimer();
	    }, 10000);
	}

	refreshReviewTimer();
})