(function($){$.widget("lws.lws_radio",{options:{baseIcon:"lws-icon lws-icon-star-empty",baseColor:"#666",selectIcon:"lws-icon lws-icon-star-full",selectColor:"#e6a903",size:"20px",classNames:''},_create:function(){this._getDataOptions();this._createStructure();this.setState();this.container.on('click','.lws-radio-button',this._bind(this._clickRadio,this));$('input[name='+this.name+']').on('change',this._bind(this.setState,this))},_bind:function(fn,me){return function(){return fn.apply(me,arguments)}},_getDataOptions:function(){if(this.element.data('baseicon')!=undefined)
this.options.baseIcon=this.element.data('baseicon');if(this.element.data('optclass')!=undefined)
this.options.classNames=this.element.data('optclass');if(this.element.data('basecolor')!=undefined)
this.options.baseColor=this.element.data('basecolor');if(this.element.data('selecticon')!=undefined)
this.options.selectIcon=this.element.data('selecticon');if(this.element.data('selectcolor')!=undefined)
this.options.selectColor=this.element.data('selectcolor');if(this.element.data('size')!=undefined)
this.options.size=this.element.data('size');},_createStructure:function(){this.container=$("<div>",{'class':'lws-radio-wrapper '+this.options.classNames}).append($("<div>",{'class':'lws-radio-button '+this.options.baseIcon,'css':{'height':this.options.size,'color':this.options.baseColor,'line-height':this.options.size}})).insertAfter(this.element);this.element.css('display','none');this.button=this.container.find('.lws-radio-button');this.name=this.element.attr("name")},setState:function(){if(this.element.prop("checked")){this.button.removeClass(this.options.baseIcon).addClass(this.options.selectIcon);this.button.css('color',this.options.selectColor)}else{this.button.removeClass(this.options.selectIcon).addClass(this.options.baseIcon);this.button.css('color',this.options.baseColor)}},_clickRadio:function(event){if(!this.element.prop("checked"))
this.element.prop("checked",!0).trigger('change');},})})(jQuery)
jQuery(function($){$(".lws_radio").lws_radio()})