/*!
* jquery raty - a star rating plugin
*
* licensed under the mit license
*
* @version 2.1.0
* @author washington botelho
* @documentation wbotelhos.com/raty
*
*/
;(function(b){var a={init:function(c){return this.each(function(){var g=b.extend({},b.fn.raty.defaults,c),n=b(this).data("options",g);if(g.number>20){g.number=20;}else{if(g.number<0){g.number=0;}}if(g.round.down===undefined){g.round.down=b.fn.raty.defaults.round.down;}if(g.round.full===undefined){g.round.full=b.fn.raty.defaults.round.full;}if(g.round.up===undefined){g.round.up=b.fn.raty.defaults.round.up;}if(g.path.substring(g.path.length-1,g.path.length)!="/"){g.path+="/";}if(typeof g.start=="function"){g.start=g.start.call(this);}var h=!isnan(parseint(g.start,10)),f="";if(h){f=(g.start>g.number)?g.number:g.start;}var o=g.staron,d=(g.space)?4:0,k="";for(var l=1;l<=g.number;l++){o=(f');if(g.space){n.append((l",{type:"hidden",name:g.scorename}).appendto(n);if(h){if(g.start>0){j.val(f);}a.roundstar.call(n,f);}if(g.iconrange){a.fillstar.call(n,f);}a.settarget.call(n,f,g.targetkeep);var e=g.width||(g.number*g.size+g.number*d);if(g.cancel){var m=b('');if(g.cancelplace=="left"){n.prepend(" ").prepend(m);}else{n.append(" ").append(m);}e+=g.size+d;}if(g.readonly){a.fixhint.call(n);n.children(".raty-cancel").hide();}else{n.css("cursor","pointer");a.bindaction.call(n);}n.css("width",e);});},bindaction:function(){var c=this,d=this.data("options"),e=this.children("input");c.mouseleave(function(){a.initialize.call(c,e.val());a.settarget.call(c,e.val(),d.targetkeep);});var g=this.children("img").not(".raty-cancel"),f=(d.half)?"mousemove":"mouseover";if(d.cancel){c.children(".raty-cancel").mouseenter(function(){b(this).attr("src",d.path+d.cancelon);g.attr("src",d.path+d.staroff);a.settarget.call(c,null,true);}).mouseleave(function(){b(this).attr("src",d.path+d.canceloff);c.mouseout();}).click(function(h){e.removeattr("value");if(d.click){d.click.call(c[0],null,h);}});}g.bind(f,function(i){var j=parseint(this.alt,10);if(d.half){var h=parsefloat((i.pagex-b(this).offset().left)/d.size),k=(h>0.5)?1:0.5;j=parsefloat(this.alt)-1+k;a.fillstar.call(c,j);if(d.precision){j=j-k+h;}a.showhalf.call(c,j);}else{a.fillstar.call(c,j);}c.data("score",j);a.settarget.call(c,j,true);}).click(function(h){e.val((d.half||d.precision)?c.data("score"):this.alt);if(d.click){d.click.call(c[0],e.val(),h);}});},cancel:function(c){return this.each(function(){var d=b(this);if(d.data("readonly")=="readonly"){return false;}if(c){a.click.call(d,null);}else{a.start.call(d,null);}d.mouseleave().children("input").removeattr("value");});},click:function(c){return this.each(function(){var e=b(this);if(e.data("readonly")=="readonly"){return false;}a.initialize.call(e,c);var d=e.data("options");if(d.click){d.click.call(e[0],c);}else{b.error('you must add the "click: function(score, evt) { }" callback.');}a.settarget.call(e,c,true);});},fillstar:function(e){var d=this.data("options"),c=this.children("img").not(".raty-cancel"),f=c.length,k=0,g,j,l;for(var h=1;h<=f;h++){g=c.eq(h-1);if(d.iconrange&&d.iconrange.length>k){j=d.iconrange[k];if(d.single){l=(h==e)?(j.on||d.staron):(j.off||d.staroff);}else{l=(h<=e)?(j.on||d.staron):(j.off||d.staroff);}if(h<=j.range){g.attr("src",d.path+l);}if(h==j.range){k++;}}else{if(d.single){l=(h==e)?d.staron:d.staroff;}else{l=(h<=e)?d.staron:d.staroff;}g.attr("src",d.path+l);}}},fixhint:function(){var c=this.data("options"),d=this.children("input"),f=parseint(d.val(),10),e=c.noratedmsg;if(!isnan(f)&&f>0){e=(f<=c.hintlist.length&&c.hintlist[f-1]!==null)?c.hintlist[f-1]:f;}d.attr("readonly","readonly");this.css("cursor","default").data("readonly","readonly").attr("title",e).children("img").attr("title",e);},readonly:function(c){return this.each(function(){var d=b(this),e=d.children(".raty-cancel");if(e.length){if(c){e.hide();}else{e.show();}}if(c){d.unbind();d.children("img").unbind();a.fixhint.call(d);}else{a.bindaction.call(d);a.unfixhint.call(d);}});},roundstar:function(f){var c=this.data("options"),e=(f-math.floor(f)).tofixed(2);if(e>c.round.down){var d=c.staron;if(e1)?d:d[0];},settarget:function(f,d){var e=this.data("options");if(e.target){var c=b(e.target);if(c.length==0){b.error("target selector invalid or missing!");}else{var g=f;if(g==null&&!e.cancel){b.error('you must enable the "cancel" option to set hint on target.');}else{if(!d||g==""){g=e.targettext;}else{if(e.targettype=="hint"){if(g===null&&e.cancel){g=e.cancelhint;}else{g=e.hintlist[math.ceil(g-1)];}}else{if(g!=""&&!e.precision){g=parseint(g,10);}else{g=parsefloat(g).tofixed(1);}}}if(e.targetformat.indexof("{score}")<0){b.error('template "{score}" missing!');}else{if(f!==null){g=e.targetformat.tostring().replace("{score}",g);}}if(c.is(":input")){c.val(g);}else{c.html(g);}}}}},showhalf:function(e){var c=this.data("options"),d=(e-math.floor(e)).tofixed(1);if(d>0&&d<0.6){this.children("img").not(".raty-cancel").eq(math.ceil(e)-1).attr("src",c.path+c.starhalf);}},start:function(c){return this.each(function(){var e=b(this);if(e.data("readonly")=="readonly"){return false;}a.initialize.call(e,c);var d=e.data("options");a.settarget.call(e,c,true);});},initialize:function(d){var c=this.data("options");if(d<0){d=0;}else{if(d>c.number){d=c.number;}}a.fillstar.call(this,d);if(d!=""){if(c.halfshow){a.roundstar.call(this,d);}this.children("input").val(d);}},unfixhint:function(){var d=this.data("options"),e=this.children("img").filter(":not(.raty-cancel)");for(var c=0;c