function Rating(c,b,a,f,e,d){this.DivID=c;this.ElementID=b;this.MediaType=a;this.NumberOfRates=(f?f:5);this.RootUrl="http://www.filigranes.be/";this.RateWitdh=15;this.ShowText=(e?e:false);this.Static=(d?d:false)}Rating.prototype.Init=function(){var a=this;var b=this.ElementID+"|"+this.MediaType;if(GetCookie("Mail")){b+="|"+GetCookie("Mail")}b=Base64.encode(b);new Ajax.Request(a.RootUrl+"Rating.ashx",{method:"POST",onSuccess:function(c){a.OnGetRatingSucceed(c)},onFailure:function(c){a.OnGetRatingFailed(c)},postBody:b})};Rating.prototype.OnGetRatingSucceed=function(f){if(document.getElementById(this.DivID).hasChildNodes()){while(document.getElementById(this.DivID).childNodes.length>=1){document.getElementById(this.DivID).removeChild(document.getElementById(this.DivID).firstChild)}}if(f&&f.responseXML){var d=this;var h=f.responseXML.getElementsByTagName("RatingResult");if(h&&h.length>0){var p=h[0];var g="";var a=0;var l=0;var n=0;var q=false;if(p.attributes.getNamedItem("Reference")&&p.attributes.getNamedItem("Reference").nodeValue&&p.attributes.getNamedItem("Reference").nodeValue==this.ElementID){g=this.ElementID;if(p.attributes.getNamedItem("Viewed")&&p.attributes.getNamedItem("Viewed").nodeValue){a=parseInt(p.attributes.getNamedItem("Viewed").nodeValue)}if(p.attributes.getNamedItem("VotesNum")&&p.attributes.getNamedItem("VotesNum").nodeValue){l=parseInt(parseInt(p.attributes.getNamedItem("VotesNum").nodeValue))}if(p.attributes.getNamedItem("Rate")&&p.attributes.getNamedItem("Rate").nodeValue){n=parseFloat(p.attributes.getNamedItem("Rate").nodeValue)}if(p.attributes.getNamedItem("CanVote")&&p.attributes.getNamedItem("CanVote").nodeValue){q=parseInt(p.attributes.getNamedItem("CanVote").nodeValue)}q=(d.Static==false?q:0);var k=document.createElement("div");k.className="ratingblock";divUnitLong=document.createElement("div");divUnitLong.id="unit_long_"+g+this.DivID;divUnitLong.className="unit-rating";k.appendChild(divUnitLong);ulRating=document.createElement("ul");ulRating.id="unit_ul_"+g+this.DivID;ulRating.className="rating";ulRating.style.width=this.RateWitdh*this.NumberOfRates+"px";divUnitLong.appendChild(ulRating);liRating=document.createElement("li");liRating.className="current-rating";liRating.style.width=(n*this.RateWitdh)+"px";liRating.appendChild(document.createTextNode(n+"/"+this.NumberOfRates));ulRating.appendChild(liRating);if(q==1&&!GetCookie(d.ElementID)){for(var j=1;j<=this.NumberOfRates;j++){li=document.createElement("li");ulRating.appendChild(li);aRating=document.createElement("a");aRating.id="rate_"+g+this.DivID+"_"+j;aRating.href="#";switch(j){case 1:aRating.title="Mauvais";break;case 2:aRating.title="Ennuyeux";break;case 3:aRating.title="Pas mal";break;case 4:aRating.title="Bon";break;case 5:aRating.title="Excellent";break;default:aRating.title=j+" out of "+this.NumberOfRates;break}aRating.className="r"+j+"-unit rater";aRating.rel="nofollow";aRating.onclick=function(i){d.OnRateClick(i)};aRating.onmouseover=function(i){d.OnRateOver(i)};aRating.onmouseleave=function(i){d.OnRateLeave(i)};aRating.appendChild(document.createTextNode(j));li.appendChild(aRating)}}var m=document.createElement("span");m.id="span-title";divUnitLong.appendChild(m);if(this.ShowText){pRating=document.createElement("p");var c="";if(n>0){c="Not&eacute; "+n;if(q==0||GetCookie(d.ElementID)){pRating.className="voted";c+=" par vous ";if(l-1>1){c+=" et "+(l-1)+" autres personnes"}else{if(l-1>0){c+=" et "+(l-1)+" autre personne"}}}else{if(l>1){c+=" par "+(l)+" autres personnes"}else{if(l>0){c+=" par "+(l)+" autre personne"}}}}else{if(q==0){pRating.className="voted"}else{c+="Soyez le premier &#224; voter !"}}pRating.innerHTML=c;divUnitLong.appendChild(pRating);if(GetCookie(g)){var o=GetCookie(g);var e=document.createElement("div");var b=document.createElement("legend");b.className="span-your-vote";switch(o){case"1":b.innerHTML="Vous avez detest&#233; <img src='"+this.RootUrl+"/Images/Rating/my_rating_1.png' />";break;case"2":b.innerHTML="Vous n'avez pas aim&#233; <img src='"+this.RootUrl+"/Images/Rating/my_rating_2.png' />";break;case"3":b.innerHTML="Vous avez aim&#233; <img src='"+this.RootUrl+"/Images/Rating/my_rating_3.png' />";break;case"4":b.innerHTML="Vous avez beaucoup aim&#233; <img src='"+this.RootUrl+"/Images/Rating/my_rating_4.png' />";break;case"5":b.innerHTML="Vous avez ador&#233; <img src='"+this.RootUrl+"/Images/Rating/my_rating_5.png' />";break;default:b.innerHTML="Votre note "+o;break}e.appendChild(b);divUnitLong.appendChild(e)}}document.getElementById(this.DivID).appendChild(k)}else{this.OnGetRatingFailed(null)}}}};Rating.prototype.OnGetRatingFailed=function(b){if(document.getElementById(this.DivID).hasChildNodes()){while(document.getElementById(this.DivID).childNodes.length>=1){document.getElementById(this.DivID).removeChild(document.getElementById(this.DivID).firstChild)}}var a=document.createElement("div");a.className="ratingblock";divUnitLong=document.createElement("div");divUnitLong.id="unit_long_"+this.ElementID+this.DivID;divUnitLong.className="unit-rating";a.appendChild(divUnitLong);ulRating=document.createElement("ul");ulRating.id="unit_ul_"+this.ElementID+this.DivID;ulRating.style.width=this.RateWitdh*this.NumberOfRates+"px";divUnitLong.appendChild(ulRating);liRating=document.createElement("li");liRating.className="current-rating";liRating.style.width=(this.NumberOfRates*this.RateWitdh)+"px";liRating.appendChild(document.createTextNode(this.NumberOfRates+"/"+this.NumberOfRates));ulRating.appendChild(liRating);if(this.ShowText){pRating=document.createElement("p");pRating.className="static";pRating.appendChild(document.createTextNode("Une erreur est survenue ! Impossible de voter !"));divUnitLong.appendChild(pRating);document.getElementById(this.DivID).appendChild(a)}};Rating.prototype.OnRateOver=function(c){if(!c){c=window.event}var b=undefined;if(c&&c.srcElement){b=c.srcElement}else{b=c.target}if(b!=undefined){var a=b.title;if(document.getElementById("span-title")){document.getElementById("span-title").innerHTML=a}}};Rating.prototype.OnRateLeave=function(b){if(!b){b=window.event}var a=undefined;if(b&&b.srcElement){a=b.srcElement}else{a=b.target}if(a!=undefined){if(document.getElementById("span-title")){document.getElementById("span-title").innerText=""}}};Rating.prototype.OnRateClick=function(c){if(!c){c=window.event}var b=undefined;if(c&&c.srcElement){b=c.srcElement}else{b=c.target}if(b!=undefined){var a=b.id.split("_");if(a.length>2){this.SaveRating(a[2])}}};Rating.prototype.SaveRating=function(b){var a=this;var c=this.ElementID+"|"+this.MediaType+"|"+b;if(GetCookie("Mail")){c+="|"+GetCookie("Mail")}c=Base64.encode(c);new Ajax.Request(a.RootUrl+"RatingSave.ashx",{method:"POST",onSuccess:function(d){a.OnGetRatingSucceed(d)},onFailure:function(d){a.OnGetRatingFailed(d)},postBody:c});date_expire=new Date(2100,12,31,23,59,59);SetCookie(this.ElementID,b,date_expire,"/","filigranes.be",null,false)};