(function(d){var a=d.telerik;a.list={initialize:function(){this.previousValue=this.value();a.bind(this,{dataBinding:this.onDataBinding,dataBound:this.onDataBound,error:this.onError,open:this.onOpen,close:this.onClose,valueChange:this.onChange,load:this.onLoad});d(document.documentElement).bind("mousedown",d.proxy(function(h){var f=this.dropDown.$element;var g=f&&f.parent().length>0;if(g&&!d.contains(this.element,h.target)&&!d.contains(f.parent()[0],h.target)){this.trigger.change();this.trigger.close()}},this))},common:function(){this.open=function(){if(this.data.length==0){return}var g=this.$element;var e=this.dropDown;var f={offset:g.offset(),outerHeight:g.outerHeight(),outerWidth:g.outerWidth(),zIndex:a.getElementZIndex(g[0])};if(e.$items){e.open(f)}else{this.fill(function(){e.open(f)})}};this.close=function(){this.dropDown.close()};this.dataBind=function(e,g){e=e||[];this.data=e;for(var h=0,f=e.length;h-1&&h0){l.filters[j](l,e,i);var f=l.filteredDataIndexes;if((f&&f.length>0)||(j==0&&l.selectedIndex!=-1)){r=false}}if(r){var o={};o[l.queryString.text]=i;l.loader.ajaxRequest(function(t){var u=l.trigger;var s=l.dropDown;if(t&&t.length==0){s.close();s.dataBind();return}l.data=t;a.trigger(l.element,"dataBound");l.filters[j](l,t,i);var v=s.$items;if(v.length>0){if(!s.isOpened()){u.open()}l.filtering.autoFill(l,v.first().text())}else{u.close()}},{data:o})}}else{r=false;l.filters[j](l,l.data,i)}if(!r){var q=k.$items;var g=q.length;var h=l.selectedIndex;var m=j==0?h!=-1?q[h].innerText||q[h].textContent:"":q.length>0?q.first().text():"";this.autoFill(l,m);if(g==0){n.close()}else{if(!k.isOpened()){n.open()}}}};this.multiple=function(e){return e}},filters:function(){this.filters=[function e(f,j,m){if(!j||j.length==0){return}var k=f.dropDown;var h=k.$items;if(h.length==0||f.loader.isAjax()){k.dataBind(j);h=k.$items}for(var g=0,l=j.length;g .t-dropdown-wrap .t-icon").addClass("t-loading")},this),100)},this.hideBusy=function(){clearTimeout(this.busyTimeout);this.component.$element.find("> .t-dropdown-wrap .t-icon").removeClass("t-loading")}},trigger:function(e){this.component=e;this.change=function(){var k=e.data;var m=e.text();var n=m.toLowerCase();var l=e.previousValue;for(var g=0,j=k.length;g0)&&!f.isOpened()&&!a.trigger(e.element,"open")){e.open()}};this.close=function(){if(!e.dropDown.$element.is(":animated")&&e.dropDown.isOpened()&&!a.trigger(e.element,"close")){e.close()}}},highlightFirstOnFilter:function(f,e){if(f.highlightFirst){e.first().addClass("t-state-selected");f.dropDown.scrollTo(e[0])}},moveToEnd:function(e){if(e.createTextRange){var f=e.createTextRange();f.moveStart("textedit",1);f.select()}},selection:function(e,h,f){if(e.createTextRange){var g=e.createTextRange();g.collapse(true);g.moveStart("character",h);g.moveEnd("character",f-h);g.select()}else{if(e.selectionStart){e.selectionStart=h;e.selectionEnd=f}}},updateTextAndValue:function(f,g,e){f.text(g);if(e==null){f.$input.val(g)}else{f.$input.val(e)}},getZIndex:function(e){var f="auto";d(e).parents().andSelf().each(function(){f=d(this).css("zIndex");if(Number(f)){f=Number(f)+1;return false}});return f},keycodes:[8,9,13,27,37,38,39,40,35,36,46]};function c(e,f){return function(h,l,m){if(!l||l.length==0){return}var k=d.map(l,function(o,n){if(f(m,o.Text||o)){return n}});var j=k.length;var g=new RegExp("(?![^&;]+;)(?!<[^<>]*)("+m.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)",e?"ig":"i");h.filteredDataIndexes=k;h.selectedIndex=-1;h.dropDown.onItemCreate=function(n){n.html=n.html.replace(g,"$1")};h.dropDown.dataBind(d.map(k,function(o,n){return l[o]}));var i=h.dropDown.$items;i.removeClass("t-state-selected");a.list.highlightFirstOnFilter(h,i)}}function b(e,g,j){if(!e||!g){return null}var k=j.length;j=j.toLowerCase();for(var f=0,h=e.length;f .t-dropdown-wrap > .t-input");this.$input=this.$element.find("input:last");this.dropDown=new a.dropDown({attr:this.dropDownAttr,effects:this.effects,onClick:d.proxy(function(l){this.select(l.item);this.trigger.change();this.trigger.close()},this)});this.dropDown.$element.css("direction",g.closest(".t-rtl").length?"rtl":"");this.fill=function(o){function n(q){var p;var s=q.value();if(s){p=function(w){return s==(w.Value||w.Text)}}else{var r=q.dropDown.$items;var u=q.index;var t=r.filter(".t-state-selected");var v=t.length;var p=u!=-1&&u0?v-1:0}q.select(p)}var l=this.dropDown;var m=this.loader;if(!l.$items&&!m.ajaxError){if(m.isAjax()){m.ajaxRequest(function(p){this.data=p;this.dataBind(p);n(this);a.trigger(this.element,"dataBound");this.trigger.change();if(o){o()}})}else{this.dataBind(this.data);n(this);if(o){o()}}}};this.enable=function(){g.removeClass("t-state-disabled").bind({keydown:d.proxy(j,this),keypress:d.proxy(k,this),click:d.proxy(function(n){var m=this.trigger;var l=this.dropDown;g.focus();if(l.isOpened()){m.close()}else{if(!l.$items){this.fill(m.open)}else{m.open()}}},this)})};this.disable=function(){g.addClass("t-state-disabled").unbind("click")};this.reload=function(){this.dropDown.$items=null;this.fill()};this.select=function(m){var l=this.highlight(m);if(l==-1){return l}this.selectedIndex=l;a.list.updateTextAndValue(this,d(this.dropDown.$items[l]).text(),this.data[l].Value)};this.text=function(l){if(l!==undefined){this.$text.html(l||" ")}else{return this.$text.html()}};this.value=function(m){if(m!==undefined){var l=this.select(function(n){return m==n.Value});if(l==-1){l=this.select(function(n){return m==n.Text})}if(l!=-1){this.previousValue=m}}else{return this.$input.val()}};a.list.common.call(this);a.list.initialize.call(this);this[this.enabled?"enable":"disable"]();function i(){clearTimeout(this.timeout);this.timeout=setTimeout(d.proxy(function(){h=""},this),1000)}function j(r){var o=this.trigger;var m=this.dropDown;var p=r.keyCode||r.which;if(r.altKey&&p==38){o.close();return}if(r.altKey&&p==40){o.open();return}if(p>34&&p<41){r.preventDefault();if(!m.$items){this.fill();return}var n=m.$items;var q=d(n[this.selectedIndex]);var l=(p==35)?n.last():(p==36)?n.first():(p==37||p==38)?q.prev():(p==39||p==40)?q.next():[];if(l.length){var s=l[0];this.select(s);m.scrollTo(s);if(!m.isOpened()){o.change()}}}if(p==8){i();r.preventDefault();h=h.slice(0,-1)}if(p==9||p==13||p==27){o.change();o.close()}}function k(p){var l=this.dropDown;var m=p.keyCode||p.charCode;if(m==0||d.inArray(m,a.list.keycodes)!=-1||p.ctrlKey||p.altKey||p.shiftKey){return}if(!l.$items){this.fill();return}var n=h;n+=String.fromCharCode(m);if(n){var o=b(this.data,l.$items,n);if(o){this.select(o);l.scrollTo(o)}h=n}i()}};d.fn.tDropDownList=function(e){return a.create(this,{name:"tDropDownList",init:function(f,g){return new a.dropDownList(f,g)},options:e})};d.fn.tDropDownList.defaults={effects:a.fx.slide.defaults(),accessible:false,index:0,enabled:true}})(jQuery);