(function ($){ $.widget("ui.selectmenu", { getter: "value", version: "1.8", eventPrefix: "selectmenu", options: { transferClasses: true , typeAhead: "sequential", style: 'dropdown', positionOptions: { my: "left top", at: "left bottom", offset: null } , width: null , menuWidth: null , handleWidth: 26, maxHeight: null , icons: null , format: null , bgImage: function (){ } , wrapperElement: "", listWrapperElement: "
"} , _create: function (){ var self = this, o = this.options; var selectmenuId = this.element.attr('id') || 'ui-selectmenu-' + Math.random().toString(16).slice(2, 10); this.ids = [selectmenuId + '-button', selectmenuId + '-menu'] ; this._safemouseup = true ; this.newelement = $('', { 'class': this.widgetBaseClass + ' ui-widget ui-state-default ui-corner-all', 'id': this.ids[0], 'role': 'button', 'href': '#nogo', 'tabindex': this.element.attr('disabled')? 1: 0, 'aria-haspopup': true , 'aria-owns': this.ids[1]} ); this.newelementWrap = $(o.wrapperElement).append(this.newelement).insertAfter(this.element); var tabindex = this.element.attr('tabindex'); if (tabindex) { this.newelement.attr('tabindex', tabindex); } this.newelement.data('selectelement', this.element); this.selectmenuIcon = $('').prependTo(this.newelement); this.newelement.prepend(''); $('label[for="' + selectmenuId + '"]').attr('for', this.ids[0]).bind('click.selectmenu', function (){ self.newelement[0].focus(); return false ; } ); this.newelement.bind('mousedown.selectmenu', function (event){ self._toggle(event, true ); if (o.style == "popup") { self._safemouseup = false ; _AN_Call_settimeout("setTimeout", window, function (){ self._safemouseup = true ; } , 300); } return false ; } ).bind('click.selectmenu', function (){ return false ; } ).bind("keydown.selectmenu", function (event){ var ret = false ; switch (event.keyCode){ case $.ui.keyCode.ENTER: ret = true ; break ; case $.ui.keyCode.SPACE: self._toggle(event); break ; case $.ui.keyCode.UP: if (event.altKey) { _AN_Call_open("open", self, event); } else { self._moveSelection(-1); } break ; case $.ui.keyCode.DOWN: if (event.altKey) { _AN_Call_open("open", self, event); } else { self._moveSelection(1); } break ; case $.ui.keyCode.LEFT: self._moveSelection(-1); break ; case $.ui.keyCode.RIGHT: self._moveSelection(1); break ; case $.ui.keyCode.TAB: ret = true ; break ; default : { ret = true ; } } return ret; } ).bind('keypress.selectmenu', function (event){ self._typeAhead(event.which, 'mouseup'); return true ; } ).bind('mouseover.selectmenu focus.selectmenu', function (){ if (!o.disabled) { $(this).addClass(self.widgetBaseClass + '-focus ui-state-hover'); } } ).bind('mouseout.selectmenu blur.selectmenu', function (){ if (!o.disabled) { $(this).removeClass(self.widgetBaseClass + '-focus ui-state-hover'); } } ); $(document).bind("mousedown.selectmenu", function (event){ self.close(event); } ); this.element.bind("click.selectmenu", function (){ self._refreshValue(); } ).bind("focus.selectmenu", function (){ if (self.newelement) { self.newelement[0].focus(); } } ); if (!o.width) { o.width = this.element.outerWidth(); } this.newelement.width(o.width); this.element.hide(); this.list = $('