function displayRating(a,d,k,b,q){var c=new Array("Not Rated","Awful","Very Poor","Poor","Below Average","Average","Above Average","Good","Very Good","Excellent","Outstanding");var r=a+d+"Cancel";var n=rating[a];var h=prediction[a];var m="";if(q){m=msg_curr_rating+n+" "+c[n*2];var o=". ";if(b){m=m+" "+msg_curr_prediction+h+" "+c[h*2]}}for(var g=1;g<=10;g++){var l=a+g;var p=rateit_imgsrc;if(q){if(n){document[r].style.display="inline"}document[l].title=m;var f=g/2;if(k>0){if(n){document[l].onmouseout=function(){displayRating(a,d,n,0,0)}}else{if(h){document[l].onmouseout=function(){displayRating(a,d,h,1,0)}}}if(n!=k){document[l].title=msg_chg_rating+n+" "+c[n*2]+msg_to+f+" "+c[g]}}else{document[l].onmouseout=function(){displayRating(a,d,0,0,0)};document[l].title=msg_add_rating+f+" "+c[g]}}var e="N";if(b){if(q){document[l].title=m+o+msg_add_rating+c[g]}e="R"}else{if(g<=(k*2)){e="O"}}document[l].src=p+d+e+((g%2)?"k1":"k0")+".png"}}function sprintfRating(b,a,c){var d=a.toString().replace(/\.(\d).*/,".$1");return b.replace(/\%.1f/,d).replace(/\%d/,c)}function clickRating(c,f,i,a,e,g){var h=a+"Action";var j=document.getElementById("rateit-widget-top");var k=numusers[a];var b=rating[a];if(g=="X"){deleteRating(h,f,e);displayRating(a,c,0,0,1);if(j&&k){var d=avg[a]*k;var l;if(k>1){l=(d-b)/(k-1)}else{l=0}if(l.toString()!="NaN"){j.childNodes[0].innerHTML=sprintfRating(msg_rating_votes,l,k-1);avg[a]=l;numusers[a]--}}rating[a]=0}else{submitRating(h,f,i,e,g);displayRating(a,c,g,0,1);if(j&&k){var l;var d=avg[a]*k;if(b&&(b>0)){l=(d+g-b)/k}else{l=(d+g)/(k+1);avg[a]=l;numusers[a]++}if((rating!=rating[a])&&(l.toString()!="NaN")){j.childNodes[0].innerHTML=sprintfRating(msg_rating_votes,l,numusers[a])}}else{if(j){j.childNodes[0].innerHTML=sprintfRating(msg_rating_votes,g,1);avg[a]=g;numusers[a]=1}}rating[a]=g}}function submitRating(d,e,a,f,g){var c=Math.round(Math.random()*(1000000));var b=WikiURL(e)+"version="+a+"&action="+rateit_action+"+&mode=add&rating="+g+"&dimension="+f+"&nocache=1&nopurge=1&rand="+c;document[d].title=msg_thanks;document[d].src=b}function deleteRating(c,d,e){var b=Math.round(Math.random()*(1000000));var a=WikiURL(d)+"action="+rateit_action+"&mode=delete&dimension="+e+"&nocache=1&nopurge=1&rand="+b;document[c].title=msg_rating_deleted;document[c].src=a};