
function vote(id, vote) {
	$('rating_votes_' + id).update("<img src='/working.gif' />");
	
	new Ajax.Request('rpc.php?id=' + id + '&vote=' + vote, {
		method: 'get',
		onSuccess: function (transport) {
			var result = transport.responseJSON;
			if (result.code == "50") {
				var votes = result.total;
				var rating = result.rating;

				$('rating_ul_' + id).update("<li class='current-rating' style='width: " + (rating * 16) + "px;'>Currently " + rating + "/5</li>");
				$('rating_text_' + id).update("Rating: <b>" + rating + "</b>/5");
				if (votes > 1)	$('rating_votes_' + id).update("(" + votes + " votes)");
				else			$('rating_votes_' + id).update("(" + votes + " vote)");
				
				$('rating_ul_' + id).addClassName("voted");
				$('rating_votes_' + id).addClassName("voted");
				$('rating_text_' + id).addClassName("voted");
			} else {

			}
		}
	});
}

