function getReviews(currentPage, objId, objType) {
	var previousPage = $("#currentpage").val();
	$("#reviewpaget" + previousPage).attr("style", "background-color: #ffffff");
	$("#reviewpaget" + currentPage).attr("style", "background-color: #c0c0c0");
	$("#reviewpageb" + previousPage).attr("style", "background-color: #ffffff");
	$("#reviewpageb" + currentPage).attr("style", "background-color: #c0c0c0");
	$("#currentpage").val(currentPage);
	var params = '';
	var targetUrl = '';
	if (objType == 'item') {
		params = "item_id=" + objId + "&currentPage=" + currentPage;
		targetUrl = "/shop/ItemReviewAjax";
	}
	else if (objType == 'recipe') {
		params = "recipe_id=" + objId + "&currentPage=" + currentPage;	
		targetUrl = "/shop/RecipeReviewAjax";
	}
	$.ajax({
	    url: targetUrl,
	    type: 'POST',
	    data: params,
	    dataType: "xml",
	    error: function(){
	        alert('Error loading XML document');
	    },
	    success: function(xml) {
	    	processXML(xml);
	    }
	});
}

function processXML(xml) {
	// remove all the previous reviews
	$(".realreview").remove();
	$(xml).find("review").each(function (reviewId) {
		var tmpObj = $("#RatingRow").clone(true);
		$("#RatingRow").addClass("realreview").attr("id", "RatingRow" + reviewId);
		$("#RatingRow" + reviewId).attr("style", "display: inline");
		var stars = $(this).find("stars").text();
		if (parseInt(stars) > 0)
			$("#rating").attr("src", "/images/star_ratings/" + stars + "stars.gif")
		else
			$("#rating").attr("style", "display:none");
		$("#comments").html($(this).find("comments").text());
		$("#submitted").text($(this).find("submitted").text());
		$("#name").text($(this).find("name").text());
		$("#city_state").text($(this).find("city_state").text());
		$("#rating").attr("id", "rating" + reviewId);
		$("#comments").attr("id", "comments" + reviewId);
		$("#submitted").attr("id", "submitted" + reviewId);
		$("#name").attr("id", "name" + reviewId);
		$("#city_state").attr("id", "city_state" + reviewId);
		tmpObj.insertAfter("#RatingRow" + reviewId);
	});
	$("#RatingRow").attr("style", "display: none");
}