zul.wgt.Rating=zk.$extends(zul.Widget,{_orient:"horizontal",_rating:0,_cancelable:!0,_max:5,_disabled:!1,_iconSclass:"z-icon-star",$define:{iconSclass:function(a){this.desktop&&this.rerender()},rating:function(a){this.desktop&&this._toggleClass("selected",a)},disabled:function(a){this.desktop&&jq(this).children().toggleClass(this.$s("disabled"),a)},readonly:function(a){this.desktop&&jq(this).children().toggleClass(this.$s("readonly"),a)}},bind_:function(){this.$supers(zul.wgt.Rating,"bind_",arguments);
var a=this,b="vertical"==a._orient;jq(a).children().each(function(c){jq(this).data("rate",b?a._max-c:c+1);a.domListen_(this,"onMouseOver","_doMouseOver").domListen_(this,"onMouseOut","_doMouseOut")})},unbind_:function(){var a=this;jq(a).children().each(function(){a.domUnlisten_(this,"onMouseOver","_doMouseOver").domUnlisten_(this,"onMouseOut","_doMouseOut")});this.$supers(zul.wgt.Rating,"unbind_",arguments)},domClass_:function(a){var b=this.$supers("domClass_",arguments);a&&a.zclass||(b+=" "+this.$s(this._orient));
return b},doSelect_:function(a){this._disabled||this._readonly||this._changeRating(a)},_changeRating:function(a){a=jq(a.domTarget).data("rate");var b=this._cancelable&&this._rating==a;b?jq(this).children().removeClass(this.$s("selected")):this._toggleClass("selected",a);jq(this).children().removeClass(this.$s("hover"));this._rating=b?0:a;this.fire("onChange",{rating:this._rating})},_doMouseOver:function(a){this._disabled||this._readonly||this._toggleClass("hover",jq(a.domTarget).data("rate"))},_doMouseOut:function(a){this._disabled||
this._readonly||jq(this).children().removeClass(this.$s("hover"))},_toggleClass:function(a,b){var c=this;jq(c).children().each(function(){var d=jq(this);d.toggleClass(c.$s(a),d.data("rate")<=b)})}});
