!function(l){"use strict";var c={init:function(t){return this.each(function(){this.self=l(this),c.destroy.call(this.self),this.opt=l.extend(!0,{},l.fn.um_raty.defaults,t),c._adjustCallback.call(this),c._adjustNumber.call(this),"img"!==this.opt.starType&&c._adjustStarType.call(this),c._adjustPath.call(this),c._createStars.call(this),this.opt.cancel&&c._createCancel.call(this),this.opt.precision&&c._adjustPrecision.call(this),c._createScore.call(this),c._apply.call(this,this.opt.score),c._target.call(this,this.opt.score),this.opt.readOnly?c._lock.call(this):(this.style.cursor="pointer",c._binds.call(this)),this.self.data("options",this.opt)})},_adjustCallback:function(){for(var t=["number","readOnly","score","scoreName","target"],a=0;a",{name:this.opt.scoreName,type:"hidden"}).appendTo(this)},_createCancel:function(){var t=this.opt.path+this.opt.cancelOff,a=l("<"+this.opt.starType+" />",{title:this.opt.cancelHint,class:this.opt.cancelClass});"img"===this.opt.starType?a.attr({src:t,alt:"x"}):a.attr("data-alt","x").addClass(t),"left"===this.opt.cancelPlace?this.self.prepend(" ").prepend(a):this.self.append(" ").append(a),this.cancel=a},_createScore:function(){var t=l(this.opt.targetScore);this.score=t.length?t:c._buildScoreField.call(this)},_createStars:function(){for(var t=1;t<=this.opt.number;t++){var a=c._nameForIndex.call(this,t),e={alt:t,src:this.opt.path+this.opt[a]};"img"!==this.opt.starType&&(e={"data-alt":t,class:e.src}),e.title=c._getHint.call(this,t),l("<"+this.opt.starType+" />",e).appendTo(this),this.opt.space&&this.self.append(ta){var r=this.opt.iconRange[a];s=c._getRangeIcon.call(this,r,o),e<=r.range&&c._setIcon.call(this,i,s),e===r.range&&a++}else s=this.opt[o?"starOn":"starOff"],c._setIcon.call(this,i,s)}},_getRangeIcon:function(t,a){return a?t.on||this.opt.starOn:t.off||this.opt.starOff},_getScoreByPosition:function(t,a){var e=parseInt(a.alt||a.getAttribute("data-alt"),10);if(this.opt.half){var s=c._getSize.call(this),i=parseFloat((t.pageX-l(a).offset().left)/s);e=this.opt.precision?e-1+i:e-1+(.5=t?"starOn":"starOff"},_roundStars:function(t){var a=(t%1).toFixed(2);if(a>this.opt.round.down){var e="starOn";this.opt.halfShow&&a=a.number&&(t=a.number-1,e=10);var s=c._getSize.call(this)/10,i=l(this.stars[t]),o=i.offset().left+s*parseInt(e,10),r=l.Event("mousemove",{pageX:o});i.trigger(r)})},readOnly:function(a){return this.each(function(){var t=l(this);t.data("readonly")!==a&&(a?(t.off(".um_raty").children("img").off(".um_raty"),c._lock.call(this)):(c._binds.call(this),c._unlock.call(this)),t.data("readonly",a))})},reload:function(){return c.set.call(this,{})},score:function(){var t=l(this);return arguments.length?c.setScore.apply(t,arguments):c.getScore.call(t)},set:function(s){return this.each(function(){var t=l(this),a=t.data("options"),e=l.extend({},a,s);t.um_raty(e)})},setScore:function(t){return this.each(function(){!0!==l(this).data("readonly")&&(c._apply.call(this,t),c._target.call(this,t))})}};l.fn.um_raty=function(t){return c[t]?c[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void l.error("Method "+t+" does not exist!"):c.init.apply(this,arguments)},l.fn.um_raty.defaults={cancel:!1,cancelClass:"raty-cancel",cancelHint:"Cancel this rating!",cancelOff:"cancel-off.png",cancelOn:"cancel-on.png",cancelPlace:"left",click:void 0,half:!1,halfShow:!0,hints:["bad","poor","regular","good","gorgeous"],iconRange:void 0,mouseout:void 0,mouseover:void 0,noRatedMsg:"Not rated yet!",number:5,numberMax:20,path:void 0,precision:!1,readOnly:!1,round:{down:.25,full:.6,up:.76},score:void 0,scoreName:"score",single:!1,space:!0,starHalf:"star-half.png",starOff:"star-off.png",starOn:"star-on.png",starType:"img",target:void 0,targetFormat:"{score}",targetKeep:!1,targetScore:void 0,targetText:"",targetType:"hint"}}(jQuery);