
function mp3web_rating(stars_wrapper, captionEl, id, model, domain, msg, voted)
{

  $("#" + stars_wrapper).stars({
	captionEl: $("#" + captionEl),
	oneVoteOnly: true,
	disabled: voted,
	inputType: "select",
	callback: function(ui, type, value){
		$.getJSON("/proxy.php?url=/votes/ajax_vote.json",
			{id: id,
			 model: model,
			 rating: value,
			 domain_id: domain
			},
        function(data){
          if(!data.error)
          {
          	$("#average").text(data.avg + ' (' + data.votes + ')');
          	$("#rate_message").html(value==ui.options.cancelValue ? msg.removed : msg.saved ).stop().css("opacity", 1).css("display","block").fadeIn(300);
			setTimeout(function(){ $("#rate_message").fadeOut(1000) }, 2000);
          }
          else 
          {
          	$("#rate_message").html(data.error).stop().css("opacity", 1).css("display","block").fadeIn(300);
          	
			setTimeout(function(){ $("#rate_message").fadeOut(1000) }, 1200);
          }
        });
        
	}
 });
}