!function(a,b,c,d){a.fn.rating=function(b){var c,e=a(this),f=e.selector||"",g=(new Date).getTime(),h=[],i=arguments[0],j="string"==typeof i,k=[].slice.call(arguments,1);return e.each(function(){var e,l=a.extend(!0,{},a.fn.rating.settings,b),m=l.namespace,n=l.className,o=l.metadata,p=l.selector,q=l.error,r="."+m,s="module-"+m,t=a(this),u=t.find(p.icon),v=this,w=t.data(s);e={initialize:function(){e.verbose("Initializing rating module",l),l.interactive?e.enable():e.disable(),l.initialRating&&(e.debug("Setting initial rating"),e.setRating(l.initialRating)),t.data(o.rating)&&(e.debug("Rating found in metadata"),e.setRating(t.data(o.rating))),e.instantiate()},instantiate:function(){e.verbose("Instantiating module",l),t.data(s,e)},destroy:function(){t.removeData(s),u.off(r)},event:{mouseenter:function(){var b=a(this);b.nextAll().removeClass(n.hover),t.addClass(n.hover),b.addClass(n.hover).prevAll().addClass(n.hover)},mouseleave:function(){t.removeClass(n.hover),u.removeClass(n.hover)},click:function(){var b=a(this),c=e.getRating(),d=u.index(b)+1;l.clearable&&c==d?e.clearRating():e.setRating(d)}},clearRating:function(){e.debug("Clearing current rating"),e.setRating(0)},getRating:function(){var a=u.filter("."+n.active).size();return e.verbose("Current rating retrieved",a),a},enable:function(){e.debug("Setting rating to interactive mode"),u.on("mouseenter"+r,e.event.mouseenter).on("mouseleave"+r,e.event.mouseleave).on("click"+r,e.event.click),t.addClass(n.active)},disable:function(){e.debug("Setting rating to read-only mode"),u.off(r),t.removeClass(n.active)},setRating:function(b){var c=b-1>=0?b-1:0,d=u.eq(c);t.removeClass(n.hover),u.removeClass(n.hover).removeClass(n.active),b>0&&(e.verbose("Setting current rating to",b),d.addClass(n.active).prevAll().addClass(n.active)),a.proxy(l.onRate,v)(b)},setting:function(b,c){return c===d?l[b]:(a.isPlainObject(b)?a.extend(!0,l,b):l[b]=c,void 0)},internal:function(b,c){return c===d?e[b]:(a.isPlainObject(b)?a.extend(!0,e,b):e[b]=c,void 0)},debug:function(){l.debug&&(l.performance?e.performance.log(arguments):(e.debug=Function.prototype.bind.call(console.info,console,l.name+":"),e.debug.apply(console,arguments)))},verbose:function(){l.verbose&&l.debug&&(l.performance?e.performance.log(arguments):(e.verbose=Function.prototype.bind.call(console.info,console,l.name+":"),e.verbose.apply(console,arguments)))},error:function(){e.error=Function.prototype.bind.call(console.error,console,l.name+":"),e.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;l.performance&&(b=(new Date).getTime(),d=g||b,c=b-d,g=b,h.push({Element:v,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":c})),clearTimeout(e.performance.timer),e.performance.timer=setTimeout(e.performance.display,100)},display:function(){var b=l.name+":",c=0;g=!1,clearTimeout(e.performance.timer),a.each(h,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",f&&(b+=" '"+f+"'"),(console.group!==d||console.table!==d)&&h.length>0&&(console.groupCollapsed(b),console.table?console.table(h):a.each(h,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),h=[]}},invoke:function(b,f,g){var h,i,j;return f=f||k,g=v||g,"string"==typeof b&&w!==d&&(b=b.split(/[\. ]/),h=b.length-1,a.each(b,function(c,f){var g=c!=h?f+b[c+1].charAt(0).toUpperCase()+b[c+1].slice(1):b;if(a.isPlainObject(w[f])&&c!=h)w=w[f];else{if(!a.isPlainObject(w[g])||c==h)return w[f]!==d?(i=w[f],!1):w[g]!==d?(i=w[g],!1):(e.error(q.method),!1);w=w[g]}})),a.isFunction(i)?j=i.apply(g,f):i!==d&&(j=i),a.isArray(c)?c.push(j):"string"==typeof c?c=[c,j]:j!==d&&(c=j),i}},j?(w===d&&e.initialize(),e.invoke(i)):(w!==d&&e.destroy(),e.initialize())}),c!==d?c:this},a.fn.rating.settings={name:"Rating",namespace:"rating",verbose:!0,debug:!0,performance:!0,initialRating:0,interactive:!0,clearable:!1,onRate:function(){},error:{method:"The method you called is not defined"},metadata:{rating:"rating"},className:{active:"active",hover:"hover",loading:"loading"},selector:{icon:".icon"}}}(jQuery,window,document);