$.widget("ui.customInput",{options:{change:$.noop},_create:function(){var e=this.element,t=this;if(e.is("[type = 'checkbox'], [type = 'radio']")){var n=e.attr("id"),o=e.attr("name"),i=$("label[for = '"+n+"']"),c=e.is("[type = 'checkbox']")?"checkbox":"radio";$("<div class = 'custom-"+c+"' style = 'display: inline-block;'></div>").insertBefore(e).append(e,i);$("input[name = '"+o+"']");i.hover(function(){i.addClass("hover");"checkbox"===c&&e.is(":checked")&&i.addClass("checkedHover")},function(){i.removeClass("hover checkedHover")});e.bind("updateState",function(){if(e.is(":checked")){if("radio"===c){var n=$("input[name = '"+o+"']");n.each(function(){$("label[for="+$(this).attr("id")+"]").removeClass("checked")})}i.addClass("checked");t.options.change&&t.options.change.call(e,!0)}else{i.removeClass("checked checkedHover checkedFocus");t.options.change&&t.options.change.call(e,!1)}}).trigger("updateState").click(function(){e.trigger("updateState")}).focus(function(){i.addClass("focus");"checkbox"===c&&e.is(":checked")&&$(this).addClass("checkedFocus")}).blur(function(){i.removeClass("focus checkedFocus")})}},checked:function(e){var t=this.element;if("undefined"==typeof e)return t.prop("checked");var n=t.prop("checked");n!==e&&t.prop("checked",e).trigger("updateState");return e},disable:function(e){this.element.attr("disabled",e);this.element.parent()[e?"addClass":"removeClass"]("disabled")}});$.widget("ui.select",{options:{options:[],select:$.noop,change:$.noop},_create:function(){var e=this,t=this.element.css({display:"inline-block"});$("<button class = 'main-button'>"+i18n("select")+"</button>").button({icons:{secondary:"ui-icon-drop-down"}}).click(function(n){if(!t.attr("disabled")){n.stopPropagation();e.popupMenu(this)}}).appendTo(t);t.buttonset()},popupMenu:function(e){var t=this,n=this.options.options;"function"==typeof n&&(n=n());var o=$.utils.getSelectMenu(n,function(e,n,o){t.setValue(e,o);t.options.select&&t.options.select.call(t.element[0],e,o);return!0},e);o&&o.show().position({my:"left top",at:"left bottom",of:$(e)});return o},value:function(e,t){var n=this.element,o=this.element.find(".main-button");if(void 0===e)return o.attr("value")||"";if(e){var i=this.options.options;"function"==typeof i&&(i=i());for(var c=0,s=i.length;s>c;c++){if(i[c]===e){t=i18n(e);break}if(i[c].value===e){t=i[c].label;break}}}else t=i18n("select");o.attr("value",e?e:"").find(".ui-button-text").text(t);n.trigger("change");this.options.change&&this.options.change.call(n[0],e,t)},setValue:function(){this.value.apply(this,arguments)},getValue:function(){return this.value()},disabled:function(e){this.element.attr("disabled",e)}});