function setVote(a,b,g){return function(){b=b+"\x26vote\x3d"+g;new Ajax.Request(b,{method:"get",onSuccess:function(f){var c=f.responseText.evalJSON(),d=c.avgvote,h=c.uservote;c=c.totalvotes;if(d=parseFloat(d)){var e=20*d;a.down("li.current-rating").style.width=e+"%"}else alert(f.responseText);d=a.up(".rating-container").id;e=$(d).down(".rating-message");""!=e.prevmsg&&(e.innerHTML=e.prevmsg,e.prevmsg="");e.down("span").innerHTML=c;(h=parseInt(h))?(e=20*h,$(d+"-user").down(".star-rating").down("li.current-rating").style.width=
e+"%"):alert(f.responseText)}})}}function showMsg(a,b){return function(){""==a.prevmsg&&(a.prevmsg=a.innerHTML);a.update(["Mauvais","Satisfaisant","Bon","Tr\u00e8s bon","Excellent"][b])}}function hideMsg(a){return function(){""!=a.prevmsg&&a.update(a.prevmsg)}}
document.observe("dom:loaded",function(){$$(".star-rating").each(function(a){if(!a.hasClassName("locked")){var b=a.up(".rating-wrapper").id;if(b&&0==b.indexOf("rating-")){b=b.substring(7);b=Object.toQueryString({xpage:"plain",outputSyntax:"plain",doc:b});var g=(new XWiki.Document("Ratings","XWiki")).getURL("view",b),f=a.up(".rating-container").down(".rating-message");a.select("a").each(function(c,d){Event.observe(c,"click",setVote(a,g,d+1));f.prevmsg="";Event.observe(c,"mouseover",showMsg(f,d));Event.observe(c,
"mouseout",hideMsg(f))})}}})});