/*!@license
* Infragistics.Web.ClientUI Combo localization resources 13.1.20131.2523
*
* Copyright (c) 2011-2014 Infragistics Inc.
*
* http://www.infragistics.com/
*
*/
(function($){$.ig=$.ig||{};if(!$.ig.Combo){$.ig.Combo={locale:{noMatchFoundText:"No Results",dropDownButtonTitle:"Show drop-down",clearButtonTitle:"Clear value"}}}})(jQuery);/*!@license
* Infragistics.Web.ClientUI Combo 13.1.20131.2523
*
* Copyright (c) 2011-2014 Infragistics Inc.
*
* http://www.infragistics.com/
*
* Depends on:
* jquery-1.4.4.js
* jquery.ui.core.js
* jquery.ui.widget.js
* infragistics.util.js
* infragistics.dataSource.js
*
* Example to use:
*	<script type="text/javascript">
*	$(function () {
*		$('#combo1').igCombo();
*	});
*	</script>
*	<input id="combo1" />
*/
(function($){var _aNull=function(v,nan){return v===null||v===undefined||nan&&typeof v==="number"&&isNaN(v)},_toPx=function(val){if(!val){return 0}if(typeof val==="number"){return val}val=val.toString();val=val.match(/[e%mitc]/i)?0:parseFloat(val);return isNaN(val)?0:Math.floor(val+.5)},_px=function(elem,css){return _toPx(elem.css(css))},_notab=function(elem){return elem.attr("tabIndex",-1).css("outline",0).attr("unselectable","on")},_stop=function(e){try{e.preventDefault();e.stopPropagation()}catch(ex){}},_equals=function(o1,o2){return o1===o2||o1&&o2&&o1.getTime&&o2.getTime&&o1.getTime()===o2.getTime()},_now=function(){return(new Date).getTime()},_offset=function(e,xy){return $.ig.util?$.ig.util.offset(e,xy):xy||(e?e.offset():null)},_listIDShift=100,_cascWait;$.widget("ui.igCombo",{options:{height:null,width:null,tabIndex:null,animationShowDuration:100,animationHideDuration:50,enableDisplayBlock:false,mode:"editable",dropDownOnFocus:false,renderMatchItems:"multi",caseSensitive:false,filteringCondition:"contains",filteringType:null,filterExprUrlKey:null,autoComplete:false,format:true,selectedItems:[{index:-1,value:null,text:null}],multiSelection:"off",enableActiveItem:true,allowCustomValue:false,clearSelectionOnBlur:false,selectItemBySpaceKey:false,itemSeparator:", ",dropDownWidth:0,dropDownMaxHeight:300,dropDownMinHeight:0,dropDownAsChild:false,virtualization:false,showDropDownButton:true,enableClearButton:true,noMatchFoundText:null,dropDownButtonTitle:null,clearButtonTitle:null,text:null,itemTemplate:null,headerTemplate:null,footerTemplate:null,nullText:null,dataSource:null,dataSourceType:null,dataSourceUrl:null,responseTotalRecCountKey:null,responseDataKey:null,responseContentType:null,requestType:"GET",validatorOptions:null,inputName:null,loadOnDemandSettings:{enabled:false,pageSize:null},dataBindOnOpen:false,closeDropDownOnSelect:true,closeDropDownOnBlur:true,valueKeyType:null,textKeyType:null,valueKey:null,textKey:null,parentCombo:null,cascadingDataSources:null,parentComboKey:null},events:{dropDownOpening:null,dropDownOpened:null,dropDownClosing:null,dropDownClosed:null,dataBinding:null,dataBound:null,textChanged:null,selectionChanging:null,selectionChanged:null,activeItemChanging:null,activeItemChanged:null,noMatchFound:null,filtering:null,filtered:null},css:{combo:"ui-igcombo ui-state-default ui-widget ui-corner-all",field:"ui-igcombo-field ui-corner-all",fieldHolder:"ui-igcombo-fieldholder",fieldHolderRTL:"ui-igcombo-fieldholder-rtl ui-corner-right",fieldHolderLTR:"ui-igcombo-fieldholder-ltr ui-corner-left",hover:"ui-igcombo-hover ui-state-hover",focus:"ui-igcombo-focus ui-state-focus",fieldHover:"ui-igcombo-field-hover",fieldFocus:"ui-igcombo-field-focus",disabled:"ui-igcombo-disabled ui-state-disabled",waitFiltering:"ui-igcombo-waitfiltering",nullText:"ui-igcombo-nulltext",button:"ui-igcombo-button ui-state-default",buttonRTL:"ui-igcombo-button-rtl ui-corner-left",buttonLTR:"ui-igcombo-button-ltr ui-corner-right",buttonFocus:"ui-igcombo-button-focus",buttonHover:"ui-igcombo-button-hover ui-state-hover",buttonPressed:"ui-igcombo-button-pressed ui-state-highlight",buttonIcon:"ui-igcombo-buttonicon ui-icon-triangle-1-s ui-icon",clear:"ui-igcombo-clear",clearHover:"ui-igcombo-clear-hover ui-state-hover",clearPressed:"ui-igcombo-clear-pressed ui-state-highlight",clearFocus:"ui-igcombo-clear-focus",clearIcon:"ui-igcombo-clearicon ui-icon-circle-close ui-icon",checkbox:"ui-state-default ui-corner-all ui-igcombo-checkbox ui-igcheckbox-small",checkboxHover:"ui-state-hover ui-igcombo-checkbox-hover",checkboxIconHover:"ui-state-hover ui-igcombo-checkboxicon-hover",checkboxOff:"ui-icon ui-igcombo-checkbox-off ui-igcheckbox-small-off",checkboxOn:"ui-icon ui-icon-check ui-igcombo-checkbox-on ui-igcheckbox-small-on",list:"ui-igcombo-list ui-widget ui-widget-content ui-corner-all",listItemHolder:"ui-igcombo-listitemholder",listItem:"ui-igcombo-listitem ui-state-default",listItemHover:"ui-igcombo-listitem-hover ui-state-hover",listItemActive:"ui-igcombo-listitem-active ui-state-active",listItemSelected:"ui-igcombo-listitem-selected ui-state-highlight",listItemMatch:"ui-igcombo-listitem-match",listItemTextWithCheckbox:"ui-igcombo-listitemtextwithcheckbox",noTopCorners:"ui-igcombo-no-top-corners",noBottomCorners:"ui-igcombo-no-bottom-corners"},RECORDS_VIEW:"{0}",RECORDS_DATA:"{1}",RECORDS_SERVER:"{2}",RECORDS_SERVER_TOTAL:"{3}",_create:function(){var name,evts,inp,i,len,clear,but,sel,txt,fieldHolder,touch,me=this,o=me.options,css=me.css,elem=me.element,selItems=o.selectedItems,fl="float",field=elem,rtl=elem.css("direction")==="rtl",oldC={display:0,visibility:0,position:0},oldA={title:0};me._data=[];me._rtl=rtl;me._lastScroll=me._virtualTop=me._topID=0;me._changeID=me._activeID=me._scrollTo=-1;i=me._noMouse()?null:o.renderMatchItems;me._matchFlag=i&&i!=="none"?i:null;if(o.id!==undefined&&o.id!==null&&o.id!==""&&(elem.attr("id")===undefined||elem.attr("id").toString()==="")){elem.attr("id",o.id)}if(selItems&&selItems.length===1&&selItems[0].index===-1&&selItems[0].value===null){o.selectedItems=selItems=null}name=elem[0].nodeName;if(name){name=name.toUpperCase()}inp=name==="INPUT";me._SELECT=sel=name==="SELECT";if(!o.inputName){me._oldCss=oldC;me._oldAttr=oldA}if(inp){oldA.value=oldA.disabled=oldA.readOnly=oldA.alt=oldA.tabIndex=oldC.textAlign=oldC.position=oldC.overflow=oldC[fl]=0}else if(sel){if(!o.dataSource){sel=elem[0].options;len=sel.length;if(!selItems||selItems.length===0){clear=selItems=o.selectedItems=[]}o.dataSource=[];o.valueKey="value";o.textKey="text";for(i=0;i<len;i+=1){txt=sel[i].text||sel[i].innerHTML;o.dataSource[i]={value:sel[i].value||txt,text:txt};if(clear&&(i===elem[0].selectedIndex||sel[i].selected)){selItems.push({index:i})}}}}else{if(name!=="DIV"&&name!=="SPAN"){throw new Error(name+" is not supported as base element")}oldA.innerHTML=0}for(i in oldC){if(oldC.hasOwnProperty(i)){oldC[i]=elem.css(i)}}for(i in oldA){if(oldA.hasOwnProperty(i)){oldA[i]=elem[0][i]}}oldC.width=elem[0].style.width;o.width=o.width||oldC.width;oldC.height=elem[0].style.height;o.height=o.height||oldC.height;if(selItems&&selItems.length>0){txt=""}else if(_aNull(txt=o.text)){if(!elem[0].multiple){txt=o.inputName?"":inp?oldA.value:sel?elem.val():oldA.innerHTML}txt=txt?txt.replace(/[\x09\x0a]/g,""):"";i=txt.length;while((i-=1)>=0){if(txt.charCodeAt(i)===32){txt=txt.substring(0,i)}else{break}}}if(inp||sel){me._swap=true;elem=$("<span />").css({position:field.css("position"),left:field.css("left"),top:field.css("top")}).insertBefore(field);if(rtl){elem.css("direction","rtl")}if(sel){field.css("display","none");field=$("<input />")}}else{field=$("<input />");if(!o.inputName){elem.html("")}}me._oldTxt="";me.mainElem=elem;i=elem.css("position");me._static=!i||i==="static";elem.css("overflow","hidden");me._fieldHolder=fieldHolder=$("<span />").addClass(css.fieldHolder).addClass(rtl?css.fieldHolderRTL:css.fieldHolderLTR).css("float",rtl?"right":"left").appendTo(elem);me.fieldElem=field.appendTo(fieldHolder).addClass(css.field).css("float",rtl?"right":"left").bind(me._evts={keydown:function(e){me._onKey(e,0)},keypress:function(e){me._onKey(e,1)},keyup:function(e){me._onKey(e,2)},focus:function(e){me._onEvt(this,8,e)},blur:function(e){me._onEvt(this,9,e)},paste:function(e){me._onChange(e)},beforecut:function(e){me._onChange(e)},cut:function(e){me._onChange(e)},drop:function(e){me._onChange(e)}});if(!_aNull(i=o.tabIndex)){field.attr("tabIndex",i)}field[0].disabled=o.disabled;field[0].readOnly=this._mode(o)>0?"readonly":"";elem.addClass(css.combo).css("display","inline-block").bind(me._elemEvts={MSPointerOver:function(e){me._onEvt(this,26,e)},pointerover:function(e){me._onEvt(this,26,e)},mouseover:function(e){me._onEvt(null,6,e)},mouseleave:function(e){me._onEvt(null,7,e)}});me._mEvts=evts={mousedown:function(e){me._onEvt(this,3,e)},mouseup:function(e){me._onEvt(this,4,e)},MSPointerOver:function(e){me._onEvt(this,26,e)},pointerover:function(e){me._onEvt(this,26,e)},mouseover:function(e){me._onEvt(this,6,e)},mouseleave:function(e){me._onEvt(this,7,e)}};me._tEvts=touch={touchstart:function(e){_stop(e)},touchmove:function(e){_stop(e)},touchend:function(e){_stop(e);var el=$(this);setTimeout(function(){el.trigger("mousedown").trigger("mouseup")},350)}};me.buttonElem=but=_notab($("<span />").addClass(css.button).addClass(rtl?css.buttonRTL:css.buttonLTR).css("float",rtl?"left":"right").attr("data-id",1).appendTo(elem).bind(evts).bind(touch));_notab($("<span />").addClass(css.buttonIcon).appendTo(but).bind(touch));me.clearElem=clear=_notab($("<span />").addClass(css.clear).css("float",rtl?"left":"right").attr("data-id",2).appendTo(fieldHolder).bind(evts).bind(touch));_notab($("<span />").addClass(css.clearIcon).appendTo(clear).bind(touch));me._titles();me.validator();me._clearOn=false;me._doSize();i=me._cascade();if(i){if(i!==true){if(typeof i==="string"){i=i.replace("#","")}_cascWait=_cascWait||{};if(_cascWait[i]){_cascWait[i].push(me)}else{_cascWait[i]=[me]}}}else if(!o.dataBindOnOpen){me.dataBind()}if(txt){me.text(txt)}me._canFire=true},dropDownVisible:function(showHide,fire){if(!arguments.length){return!!this._ddOn}this._canFire=fire;this._doDrop(showHide?2:0);this._canFire=true;return this},remove:function(){var p,v=this._validator,e=this.mainElem;if(!e||!e[0]){return}if(v){v.hide()}if(this._fcs){this._onEvt(null,9)}this.fieldElem.removeClass(this.css.fieldHover);e.removeClass(this.css.hover);p=e[0].parentNode;if(p&&p.tagName){this._doDrop(0);this._fcs=0;p.removeChild(e[0])}return this},validator:function(destroy){var o=this.options.validatorOptions,field=this.fieldElem,v=this._validator;if(v&&(destroy||!o)){v.destroy();delete this._validator}else if(!v&&!destroy&&o&&field.igValidator){o.combo=o.element=this.mainElem;this._validator=field.igValidator(o).data("igValidator")}return this._validator},validate:function(){return this._validator?this._validator.validate():null},setFocus:function(delay){var me=this;if(me.fieldElem&&!me._fcs){if(delay===-1){try{me.fieldElem[0].focus()}catch(ex){}}else{setTimeout(function(){me.setFocus(-1)},delay||0)}}return this},hasFocus:function(){return this._fcs===1},isSelected:function(index){var selItems=this.options.selectedItems,len=selItems?selItems.length:0;while((len-=1)>=0){if(selItems[len].index===index){return true}}return false},selectedIndex:function(index,fire){if(index===undefined){var i,selItems=this.options.selectedItems,len=selItems?selItems.length:0;index=-1;while((len-=1)>=0){i=selItems[len].index;index=index<0?i:Math.min(i,index)}return index}this._canFire=fire!==false&&(fire||this._cascFire);this._select(index);this._updateFromList(null,1);this._fixNull();this._canFire=true;return this},activeIndex:function(index,fire){if(index===undefined){return this._activeID}this._canFire=fire;this._activate(index);this._canFire=true;return this},value:function(val,fire){if(this._noMouse()){return this.text(val,fire)}if(val===undefined){val=this.options.selectedItems;return val&&val[0]?val[0].value:null}this._canFire=fire!==false&&(fire||this._cascFire);this._valTime=_now();this._valLast=val;this._select(null,val);this._updateFromList(null,1);this._canFire=true;return this},text:function(text,fire){if(text===undefined){text=this.fieldElem.val();return this._nullT&&(!text||text===this.options.nullText)?"":text}this._canFire=fire!==false&&(fire||this._cascFire);this._select(null,text,2);this._updateFromList(null,1);if(this._custom()){this._onChange(null,null,text)}this._canFire=true;return this},values:function(vals){var o=this.options,selItems=o.selectedItems,i=selItems?selItems.length:0;if(vals===undefined){vals=[];while((i-=1)>=0){vals[i]=selItems[i].value}return vals}i=vals?vals.length:0;selItems=[];while((i-=1)>=0){selItems[i]={value:vals[i]}}o.selectedItems=selItems;this._initSel(o);return this},itemByIndex:function(id){return id<0?null:{element:this._findItem(id),index:id,value:this._item(id),text:this._item(id,2)}},itemByValue:function(val){var id=-1;while(++id<this._count){if(_equals(val,this._item(id))){return this.itemByIndex(id)}}},getFooter:function(){return this.listElem?this.listElem.find("[data-footer]"):null},getDataSource:function(){return this._dataSource},getData:function(){return this._data},getRecordsCount:function(flag){var count=this._count,ds=this._dataSource;if(flag===this.RECORDS_VIEW||flag===0){return count}if(ds){count=ds._data.length;if(flag===this.RECORDS_DATA||flag===1){return count}count=Math.max(ds.totalRecordsCount(),count);if(flag===this.RECORDS_SERVER||flag===2){return count}if(flag===this.RECORDS_SERVER_TOTAL||flag===3){count=Math.max(Math.max(count,this._totalAll||0),parseInt(this.options._totalAll||0,10))}}return count},listScrollTop:function(val){if(val!==undefined&&!this._ddOn){this.dropDownVisible(true)}var dd=this._ddScroll||this._ddCont;if(val===undefined){return dd?dd[0].scrollTop:0}if(dd){dd[0].scrollTop=val||0}return this},_cascade:function(evt,destroy,combo){var key,i,url,me=this,val=me._parentCombo,o=me.options,ds=o.cascadingDataSources,old=me._cascOpt,parent=combo||o.parentCombo;combo=evt?val:parent;if(val&&!evt){key=val._cascFire;i=key?key.length:0;while(i-->0){if(key[i]===me){key.splice(i,1);if(key.length===0){delete val._cascFire}break}}delete me._parentCombo;delete me._cascFilter;if(destroy){return}if(old){o.valueKey=old.value;o.textKey=old.text;o.dataSource=old.ds;o.dataSourceUrl=old.url;if(!combo){me.dataBind()}}}if(!combo||destroy){return}if(evt){delete me._cascSel;me.selectedIndex(-1);me.activeIndex(-1)}else{if(!ds){key=o.parentComboKey;if(!key){return}if(o.filteringType==="remote"){me._cascFilter=-1}else{o.filteringType="local";me._cascFilter=1}me._cascKey=key;url=o.dataSource?null:o.dataSourceUrl}if(typeof combo==="string"||combo.nodeName){combo=$(parent);if(combo.length!==1){combo=$("#"+parent);if(combo.length!==1){return parent}}}if(combo&&combo[0]&&typeof combo.data==="function"){parent=combo[0];combo=combo.data("igCombo")}if(!combo||combo.widgetName!=="igCombo"||combo===me){return parent}key=combo._cascFire;i=key?key.length:0;while(i-->0){if(key[i]===me){break}}if(i<0){combo._cascFire=key=key||[];key.push(me)}me._parentCombo=combo;if(!old&&ds){old=me._cascOpt={value:o.valueKey,text:o.textKey,ds:o.dataSource,url:o.dataSourceUrl}}if(!combo._hasData){return parent}}val=combo.options.selectedItems;val=val&&val.length>0?val[0].value:null;if(me._valTime&&_now()-me._valTime<200){me._valTime=1}if(ds){ds=val===null?null:ds[val];val=ds?ds.valueKey:null;o.valueKey=val||old.value;val=ds?ds.textKey:null;o.textKey=val||old.text;o.dataSourceUrl=url=ds?ds.dataSourceUrl:null;o.dataSource=ds?ds.dataSource||(ds.length&&!url?ds:null):null;me._hasData=false;me._urlBind=me._lod=me._totalAll=o._totalAll=me._count=0;me._cascUrl=url;if(url){val=o.selectedItems;me._cascSel=val?val[0]?val[0].value:null:null}me.dataBind();delete me._cascUrl}else{me._cascVal=val;if(me._hasData){if(_aNull(val,true)||val===""){me._dataChange()}else{me.filter()}}else{me._cascUrl=url;me.dataBind();delete me._cascUrl}}return true},_noMouse:function(){var o=this.options,ds=o.dataSource;o=o.itemTemplate;return o&&ds&&ds.length===1&&o.indexOf("{")<0&&o.indexOf("}")<0},_custom:function(){return this.options.allowCustomValue||this._noMouse()},_multi:function(o){o=o.multiSelection;return o&&o!=="off"},_checkBox:function(o){o=o.multiSelection;return o===2||o&&o.toLowerCase&&o.toLowerCase()==="onwithcheckboxes"},_mode:function(o){o=o.mode;return o===1||o==="dropdown"?1:o===2||o==="readonlylist"?2:o===3||o==="readonly"?3:0},_fixSelElem:function(elem,sel){var css=this.css,icon=css.listItemSelected,iconOut=css.checkboxOff;if(sel){elem.addClass(icon)}else{elem.removeClass(icon)}if(elem.attr("data-check")){elem[0]._check=sel;icon=css.checkboxOn;elem.find("[data-icon]").removeClass(sel?iconOut:icon).addClass(sel?icon:iconOut)}},_copyA:function(a){var len=a?a.length:0,a1=len?[]:null;while((len-=1)>=0){a1[len]=a[len]}return a1},_clearSel:function(){var elems=this._selElems,i=elems?elems.length:0;while((i-=1)>=0){this._fixSelElem(elems[i])}this._selElems=null},_selChanged:function(e){if(this._selArg){var elem,o,selItems,key=this._cascFire,i=key?key.length:0;while(i-->0){key[i]._cascade(true)}this._fire("selectionChanged",e,this._selArg);if(this._SELECT){elem=this.element[0];o=elem.options;selItems=this.options.selectedItems;i=selItems?selItems[0]:null;i=i?i.index:-1;elem.selectedIndex=i;if(o&&i>=0&&i<o.length){o[i].selected=true}if(elem.onchange){elem.onchange()}}delete this._selArg}},_selChange:function(selItems,e,clear,noReturn){var i,old=this.options.selectedItems,i0=old?old.length:0,i1=selItems?selItems.length:0;if(!i1){selItems=null}if(i0===i1){while(i0-->0){for(i=0;i<i1;i+=1){if(noReturn){if(old[i0].value===selItems[i].value&&old[i0].text===selItems[i].text){break}}else if(old[i0].index===selItems[i].index){break}}if(i===i1){break}}}old=i0>=0&&this._hasData&&!this._waitFilter?{owner:this,oldItems:old,items:selItems}:null;delete this._selArg;if(old&&!this._fire("selectionChanging",e,old)&&!noReturn){return}this._selTime=e&&this.options.focusOnSelect===false?_now():0;this._selArg=old;if(clear||!i1){this._clearSel()}this.options.selectedItems=selItems;this._noFilter=selItems&&selItems.length;return 1},_addSel:function(id,e){if(id>=0&&!this.isSelected(id)){var selItems=this._copyA(this.options.selectedItems);id=this._createSelItem(id);if(!selItems){selItems=[id]}else{selItems.push(id)}if(this._selChange(selItems,e)){this._selChanged(e)}}return this.options.selectedItems},_sepEnd:function(txt){var sep=this._sep(),len=txt.length;return len>1&&txt.lastIndexOf(sep)===len-sep.length},_select:function(id,val,flag,part,e){var vals,lenVals,txt,j,cond,ds,selItems=null,scrollID=-1,actID=-1,i=-1,o=this.options,more=1,count=this._count,act=part?o.allowCustomValue?2:1:null,sep=false,lower=!o.caseSensitive&&typeof val==="string";if(e&&part&&!this._ddOn&&e.type!=="mouseup"){this._doDrop(1,e)}if(this._noMouse()){return}if(act){this._changeID=-1}if(!_aNull(val)&&val!==""){if(flag===2){val=val.toString()}vals=typeof val==="string"?this._texts(val):val.length?val:[val];if((lenVals=vals.length)>0){j=vals[lenVals-1];if(!j&&(flag===2||_aNull(j))){if(act===1){sep=this._sepEnd(val)}vals.splice(lenVals-=1,1)}}if(lenVals===0){this._selChange(selItems,e,1,1);this._selChanged(e);return}while((i+=1)<lenVals){vals[i]={val:vals[i],id:-1,done:null}}if(!this._isStrCond(cond=this._cond(o))){cond="startsWith"}ds=this._dataSource;id=-1;while((id+=1)<count&&more){if(_aNull(txt=this._item(id,flag))){continue}if(lower){txt=txt.toString().toLowerCase()}more=null;for(i=0;i<lenVals;i+=1){if(!vals[i].done){more=1;val=vals[i].val;if(val===txt||part&&ds._findMatch(txt,val,"string",false,cond)){j=i;while((j-=1)>=0){if(vals[j].id===id){break}}if(act&&j>=0){continue}if(act&&i+1===lenVals&&!sep){if(actID<0){this._changeID=scrollID=actID=id;if(act===1&&!o.enableActiveItem){vals[i].id=id}}}else if(vals[i].id<0){vals[i].id=id}if(act!==1&&(val===txt||!part)){vals[i].id=id;vals[i].done=1}}}}}selItems=[];for(i=0;i<lenVals;i+=1){if((id=vals[i].id)>=0&&act!==2){if(scrollID<0){scrollID=id}j=selItems.length;while((j-=1)>=0){if(selItems[j].index===id){break}}if(j<0&&(this._multi(o)||selItems.length===0)){selItems.push(this._createSelItem(id))}}}}else if(typeof id==="number"&&id>=0&&id<count){selItems=[this._createSelItem(scrollID=id)]}if(this._selChange(selItems,e,1)){if(scrollID>=0){this._fixSelScroll(this._scrollTo=scrollID);if(sep){this._updateFromList(e,1,1)}}this._selChanged(e)}if(act){this._activate(actID,e)}},_createSelItem:function(id,txt,val){return{index:id,value:val||this._item(id),text:txt||this._item(id,2)}},_item:function(id,valHtmlText){var val,textValue,i,txtVal,format,tags,j,o=this.options,key=this._keyVal,row=this._data[id],mf=this._matchFlag;if(valHtmlText){key=this._key}if(!row){return valHtmlText?"":null}val=row[key];if(!valHtmlText){return val}format=format||o.format;if(format){if(_aNull(txtVal=row[i=key+"_"])){if(_aNull(val)){val=""}else if($.ig&&$.ig.formatter&&(typeof val==="number"||val&&val.getMonth)){val=$.ig.formatter(val,null,format==="auto"||format===true?null:format)}else{val=val.toString()}row[i]=val}else{val=txtVal}}else{val=_aNull(val)?"":val.toString()}if(valHtmlText!==1){return val}textValue=val;i=o.itemTemplate;if(i&&$.ig.tmpl){if(!this._it){if($.ig.util.isIE&&i.indexOf("unselectable")<0){tags=["<div","<span","<img","<a","<td","<li"];j=tags.length;while(j-->0){i=i.replace(new RegExp(tags[j],"gi"),tags[j]+' unselectable="on"')}}this._it=i}val=$.ig.tmpl(this._it,row);if(mf){val=this._replaceTextInTemplate(val,textValue,this._renderMatches(textValue,o,mf))}return val}if(val===""){return"&nbsp;"}return mf?this._renderMatches(val,o,mf):val},_replaceTextInTemplate:function(template,text,highlightedText){var parsedNode,resultNode,parsedTemplate,parent,children,i;if(text!==highlightedText){parsedTemplate="";parsedNode=$(template);for(i=0;i<parsedNode.length;i++){resultNode=this._replaceTextInNode($(parsedNode[i]),text,highlightedText);resultNode=$("<div>").append(resultNode);parsedTemplate+=resultNode.html()}return parsedTemplate}return template},_replaceTextInNode:function(node,text,highlightedText){var children=node.children(),parent=node.clone().children().remove().end(),i;parent.html(parent.text().replace(text,highlightedText));for(i=0;i<children.length;i++){parent=parent.append(this._replaceTextInNode($(children[i]),text,highlightedText))}return parent},_renderMatches:function(html,o,match){var index,i,lenMatch,len,lenIndex,val=o.caseSensitive?html:html.toLowerCase(),minIndex=0,shift=0,matches=[],txts=this._textsTemp||this._texts(1),lenTxt=txts.length;while(minIndex<99999){i=-1;minIndex=99999;len=val.length;while((i+=1)<lenTxt){index=val.indexOf(txts[i]);lenMatch=txts[i].length;if(index>=0&&index<minIndex&&(index===0||match!=="startsWith")&&!(match==="full"&&len!==lenMatch)&&lenMatch){minIndex=index;lenIndex=lenMatch}}if(minIndex<99999){matches.push({index:shift+=minIndex,len:lenIndex});val=val.substring(minIndex+lenIndex);shift+=lenIndex}if(match!=="multi"||shift>=len){break}}for(i=matches.length-1;i>=0;i-=1){index=matches[i].index;len=matches[i].len;html=html.substring(0,index)+'<span unselectable="on" class="'+this.css.listItemMatch+'">'+html.substring(index,index+len)+"</span>"+html.substring(index+len)}return html},_renderRow:function(id,repaint){var txt,elem,box,i,top,cell,me=this,itemWidth=me._itemWidth,o=me.options,checkBoxes=me._checkBox(o),cbWidth=me._cbWidth||0,html=me._html,lod=me._lodWait&&!html;if(lod){if(me._findItem(id+me._virtualTop)){return}repaint=false}if(html){repaint=false;if(!me._data[id]){return}html+='<li tabIndex="-1" class="'+me.css.listItem+'" style="width:';html+=itemWidth+"px;height:"+me._itemHeight+'px" unselectable="on" data-id="'+(id+_listIDShift)+'"'}else if(!repaint){elem=$("<li />").addClass(me.css.listItem).css({width:itemWidth,height:me._itemHeight}).attr("data-id",id+_listIDShift).attr("tabIndex",-1).attr("unselectable","on").appendTo(me._itemsHolder);if(checkBoxes){box=$("<span />").attr("data-box","x").attr("unselectable","on").css("top",(me._cbTop||0)+"px").addClass(me.css.checkbox).appendTo(elem.attr("data-check","x"));$("<span />").attr("data-icon","x").attr("unselectable","on").addClass(me.css.checkboxOff).appendTo(box);if(!cbWidth){me._cbWidth=cbWidth=box[0].offsetWidth}cell=$("<span />").attr("data-txt","x").attr("unselectable","on").addClass(me.css.listItemTextWithCheckbox).css(me._rtl?"marginRight":"marginLeft",Math.max(cbWidth,14)+3+"px").prependTo(elem)}else{elem.attr("data-txt","x")}}id+=me._virtualTop;if(repaint){elem=this._findItem(id);if(!elem){return}if(!o.virtualization&&!me._matchFlag){return elem}}txt=me._item(id,1);if(html){if(checkBoxes){html+=' data-check="x"><span unselectable="on" data-txt="x" style="'+(me._rtl?"margin-right:":"margin-left:")+(Math.max(cbWidth,14)+3)+'px;" class="'+me.css.listItemTextWithCheckbox+'">'+txt+"</span>";html+='<span unselectable="on" data-box="x" style="top:'+(me._cbTop||0)+'px" class="'+me.css.checkbox;html+='"><span unselectable="on" data-icon="x" class="'+me.css.checkboxOff+'"></span></span>'}else{html+=' data-txt="x">'+txt}me._html=html+"</li>"}else if(!me._data[id]){elem.hide();cell=me._findItem(id+1);if(cell){cell.hide()}}else if(elem[0]._old!==txt){elem[0]._old=txt;cell=elem.find("[data-txt]");if(cell.length===0){cell=elem}if(txt!==cell[0].innerHTML){cell.html(txt)}if(checkBoxes&&_aNull(me._cbTop)){box=elem.find("[data-box]");if(box[0]&&(top=elem[0].clientHeight)>0&&(i=box[0].offsetHeight)>0){if(i>=top){elem.css("height",top=i+1)}me._cbTop=Math.max((top-i-1)/2,0)}}elem.show()}if(lod){me._bindLIs(o,elem)}return elem},_isCheckBox:function(elem){return elem&&(elem.getAttribute("data-box")||elem.parentNode.getAttribute("data-box"))},_fixNull:function(clear){var txt,nullTxt=this.options.nullText;if(!nullTxt&&!this._nullT){return}txt=this.text();if(!clear&&txt===""&&nullTxt&&!this._fcs){this._nullT=true;this.fieldElem.addClass(this.css.nullText).val(nullTxt)}else if(this._nullT){this._nullT=null;this.fieldElem.removeClass(this.css.nullText).val(txt||"")}},_onScroll:function(e){var elem,selItems,selID,selLen,id,top,ds,me=this,count=me._count,itemHeight=me._itemHeightOuter,dd=me._ddScroll||me._ddCont;if(!dd||!me._ddOn||count<2||me._lodWait){return}id=Math.floor((top=dd[0].scrollTop)/itemHeight);if(e){me._lastScroll=top}top=Math.floor(me._lastScroll/itemHeight+.4);if(me._lod&&top>count-me._page*1.5){ds=me._dataSource;top=ds.pageIndex();if(top+1<ds.pageCount()){me._wait(me._lodWait=true);ds.pageIndex(top+1);return}else{top=id}}me._topID=top=Math.max(0,Math.min(top,count-Math.floor(dd[0].offsetHeight/itemHeight)));if(me._ddScroll){me._fixActive(me._activeID);count=me._page+1;me._virtualTop=top;selItems=me.options.selectedItems;selLen=selItems?selItems.length:0;me._selElems=[];while((count-=1)>=0){elem=me._renderRow(count,1);if(elem){for(selID=0;selID<selLen;selID+=1){if(selItems[selID].index===count+top){me._selElems.push(elem);me._fixSelElem(elem,1);break}}if(selID>=selLen){me._fixSelElem(elem)}}}me._fixActive(me._activeID,1)}},_lodLbl:function(){var i=-1,dd=this.listElem;while(i++<3&&this._lodFoot&&dd){dd.find("[data-lod"+i+"]").html(this.getRecordsCount(i))}},_touch:function(act){var scroll,dd=this._ddCont;if(dd&&dd.igScroll){scroll=dd.data("igScroll");if(!act){return scroll?scroll.barY:dd.igScroll({direction:"y",yThumb:"draggable",yScroller:this._ddScroll,cancelStart:"ms"}).attr("data-scroll","y")}if(scroll){scroll[act](true)}}},_xyCheck:function(stop){var xy=this._xy,xyE=this.mainElem;if(!xy){return}if(xyE){xyE=_offset(xyE);if(Math.abs(xyE.left-xy.x)>2||Math.abs(xyE.top-xy.y)>2){stop=true}}if(stop||!xyE){delete this._xy;clearInterval(xy.i);this._doDrop()}},_vAct:function(act){return $.ui.igValidator&&$.ui.igValidator._act(this,act)},_doDrop:function(show,e,repaint){var height,needScroll,winHeight,y,bodyElem,row1st,rowLast,max,end,step,docElem,xy,effect,width,body,i,duration,arg,listWidth,footer,callback,me=this,lod=me._lod,lodWait=me._lodWait,up=me._listUp,extraHeight=me._extraHeight||0,ddCont=me._ddCont,o=me.options,rtl=me._rtl,virtual=o.virtualization,dd=me.listElem,itemsHolder=me._itemsHolder,ddScroll=me._ddScroll,elem=me.mainElem,dif=me._ddItemBorderFix,on=me._ddOn,count=me._count,itemHeightOuter=me._itemHeightOuter;repaint=repaint||me._listChanged;if(me._mode(o)>2){show=0}if(!elem||!show&&!on||show===2&&on){return}if(!repaint&&on&&show&&_now()-on<100){return}show=show?repaint||!on:false;if(me._vAct(show?"drop":"hide")){return}if(!itemHeightOuter&&count&&show){repaint=true}if(!me._hasData){if(show&&o.dataBindOnOpen&&!me._dataSource){me._wait(true);callback=function(){this._dataChange();this._doDrop(2);this._wait(false)};me.dataBind(callback)}return}if(count<1&&me._filtering){row1st=me._noResults;if(!row1st){me._noResults=row1st=_notab($("<li />").css({width:"100%",textAlign:"center"}).addClass(me.css.listItem).html(me._locale("noMatchFoundText")||"&nbsp;"))}}if((!show||show&&!on)&&!me._fire(show?"dropDownOpening":"dropDownClosing",e,arg={owner:me,element:dd||$("<div/>")})){return}if(!lodWait&&show&&me._activeID>=0&&!me.isSelected(me._activeID)&&(i=me.selectedIndex())>=0){me._activate(me._scrollTo=i,e,1)}body=!o.dropDownAsChild;if(!dd){repaint=false}if(!dd||repaint){delete me._listChanged;if((width=parseInt(o.dropDownWidth,10))<5||isNaN(width)){if((width=elem[0].offsetWidth)<5){width=100}}if(!dd){dd=me.listElem=ddScroll=ddCont=_notab(arg.element.attr("data-id",_listIDShift-1).css("position","absolute").addClass(me.css.list).bind(me._mEvts).bind({DOMMouseScroll:function(e){me._onEvt(this,10,e)},mousewheel:function(e){me._onEvt(this,10,e)}}));footer=o.footerTemplate;if(o.headerTemplate||footer){dd.css("overflow","hidden");if(o.headerTemplate){_notab($("<div/>").attr("data-id",_listIDShift-1).css({overflow:"hidden",position:"relative"}).html(o.headerTemplate).appendTo(dd))}ddScroll=ddCont=_notab($("<div/>").attr("data-id",_listIDShift-1).css("position","relative").appendTo(dd));if(footer){i=footer;footer=footer.replace(this.RECORDS_VIEW,'<span data-lod0="x"></span>').replace(this.RECORDS_DATA,'<span data-lod1="x"></span>').replace(this.RECORDS_SERVER,'<span data-lod2="x"></span>').replace(this.RECORDS_SERVER_TOTAL,'<span data-lod3="x"></span>');me._lodFoot=i!==footer;_notab($("<div/>").attr("data-footer","x").attr("data-id",_listIDShift-1).css({overflow:"hidden",position:"relative"}).html(footer).appendTo(dd))}extraHeight=1}me._ddCont=ddCont;me._itemsHolder=itemsHolder=_notab($("<ul/>").attr("data-id",_listIDShift-1).addClass(me.css.listItemHolder).appendTo(ddCont));if(virtual){ddCont.css({overflow:"hidden"});me._ddScroll=ddScroll=_notab($("<div/>").attr("data-id",_listIDShift-1).css({width:"30px",height:"100%",overflowY:"scroll",overflowX:"hidden","float":rtl?"left":"right"}).appendTo(ddCont));me._ddScrollChild=_notab($("<div/>").attr("data-id",_listIDShift-1).css({width:"1px",height:"1px"}).appendTo(ddScroll))}ddScroll.scroll(function(e){me._onScroll(e)});if(me._rtl){dd.css("direction","rtl")}if(body){dd.css({left:"0px",top:"0px"}).appendTo($("body"))}else{dd.prependTo(elem)}me._ddBorderFix=dd.outerWidth()-dd.width();if(extraHeight){ddCont.hide();dd.css("width",width-me._ddBorderFix);me._extraHeight=extraHeight=dd[0].clientHeight;dd.css("width","auto");ddCont.show()}}dd.css({display:"block"});listWidth=width-=me._ddBorderFix;if(row1st){if(itemsHolder.has(row1st).length===0){row1st.appendTo(itemsHolder)}itemHeightOuter=Math.max(10,row1st.outerHeight());dif=0}else if(!lodWait){if(virtual){ddScroll.hide();itemsHolder.css({width:"auto",height:"auto",overflow:"visible","float":"left"})}else{me._keyFixed=1}}if(!itemHeightOuter&&count>0){me._itemWidth=width=Math.ceil(width-1);me._itemHeight="auto";row1st=me._renderRow(0);if((height=row1st.height())<5){height=16}row1st.css({height:me._itemHeight=height});me._ddItemBorderFix=dif=Math.max(0,Math.floor(row1st.outerWidth()-row1st.width()+.4));if(dif>0){me._itemWidth=width-=dif}me._itemHeightOuter=itemHeightOuter=row1st.outerHeight()+Math.max(0,itemsHolder[0].offsetHeight-row1st[0].offsetHeight);me._sameBC(row1st,dd)}itemHeightOuter=itemHeightOuter||0;me._listHeight=Math.max(10,Math.max((max=o.dropDownMinHeight)-extraHeight,itemHeightOuter*(count||1)));max=Math.min(Math.max(0,Math.max(max,o.dropDownMaxHeight)-extraHeight),me._listHeight);if(lod){max=Math.min((lod-1)*itemHeightOuter,max)}height=ddCont.css("height");height=repaint&&height&&height.indexOf("px")>0?parseFloat(height):max;dd.css("width",listWidth);needScroll=me._listHeight>max;if(virtual){me._ddScrollChild.css("height",me._listHeight+itemHeightOuter);ddCont.css("height",me._listHeight=max);dd.css("height",max+extraHeight);if(needScroll){ddScroll.show();ddScroll.css("width",width=ddScroll[0].offsetWidth-ddScroll[0].clientWidth+1);width=listWidth-width;itemsHolder.css({width:width,height:"100%",overflow:"hidden","float":rtl?"right":"left"});width-=dif;count=Math.ceil(max/itemHeightOuter+1)}else{ddScroll.hide();itemsHolder.css("width","100%")
}}else{ddCont.css({overflow:needScroll?"auto":"hidden",width:listWidth,height:me._listHeight=max}).css("overflowX","hidden");dd.css("height",max+extraHeight);if(needScroll){rowLast=$("<div/>").css({position:"absolute",top:max+100+"px",width:9,height:9}).appendTo(ddCont);width=ddCont[0].clientWidth;width=ddCont[0].clientWidth-dif;rowLast.remove()}}if(!needScroll){width=listWidth-dif}me._itemWidth=width;this._repaintList(0,count);me._page=itemHeightOuter?Math.max(2,Math.floor(max/itemHeightOuter)):1;if(repaint&&on){if(me._needsSel){me._fixSelScroll(-1);delete me._needsSel}i=me._listHeightLast;height=me._listHeight+extraHeight;dif=i-height;if(up){end=me._listTop;me._listTop+=dif}me._listHeightLast=height;if(dif){if((duration=dif<0?o.animationShowDuration:o.animationHideDuration)>5){dd.css("height",i).animate({height:height},{duration:duration,step:function(now){if(up){dd.css(body?"top":"marginTop",end+dif*(i-now)/(i-height))}}})}else if(up){dd.css(body?"top":"marginTop",end+dif)}}return}}height=me._listHeightLast=me._listHeight+extraHeight;me._ddOn=show?_now():null;duration=show?o.animationShowDuration:o.animationHideDuration;if(!duration||typeof duration==="number"&&duration<5){duration=null}else{effect=show?o.animationShowEffect:o.animationHideEffect;if(!$.effects||!$.effects[effect]){if(!show&&typeof duration!=="number"){duration=450}effect=null}}me._listHeightEnd=duration&&!effect?0:height;end=function(){if(show){dd.css("filter","");me._fixSelScroll(me._scrollTo);me._touch()}else{dd.css({display:"none"});me._touch("_hide")}me._fire(show?"dropDownOpened":"dropDownClosed",e,arg)};step=function(now,fx){if(me._listUp&&fx&&fx.prop==="height"){dd.css(body?"top":"marginTop",me._listTop+height-now)}};if(show){me._lodLbl();me.setFocus();if(me._needsPaint){me._repaintList()}if(!body&&(!me._static||me._relative)){elem.css("overflow","visible")}if(me._needsSel){me._fixSelScroll(-1);delete me._needsSel}winHeight=999;bodyElem=document.body;docElem=document.documentElement;if((i=window.innerHeight)>50&&i){winHeight=i}else if((i=docElem.clientHeight)>50&&i){winHeight=i}else if((i=bodyElem.clientHeight)>50&&i){winHeight=i}y=Math.max(window.pageYOffset||0,Math.max(bodyElem.scrollTop,docElem.scrollTop));xy=_offset(elem);me._xy=body?{x:xy.left,y:xy.top}:null;xy.height=elem[0].offsetHeight;me._listUp=null;if((up=xy.top+xy.height+height-y-winHeight)>0&&y-xy.top+height<up){me._listUp=up;if(xy.top-(up=height+2)<y&&!me._filtering){up=Math.max(xy.top-y,2)}xy.top+=(xy.height=-up)+_px(elem,"borderTopWidth");elem.addClass(me.css.noTopCorners);dd.addClass(me.css.noBottomCorners)}else{xy.top+=xy.height-_px(elem,"borderBottomWidth");elem.addClass(me.css.noBottomCorners);dd.addClass(me.css.noTopCorners)}dd.css({opacity:duration&&!effect?0:1,height:me._listHeightEnd,display:""});if(body){dd.css({left:xy.left,top:me._listTop=xy.top});me._xy.i=setInterval(function(){me._xyCheck()},300)}else{i=me._rtl?"Right":"Left";dd.css("margin"+i,-_px(elem,"border"+i+"Width")+"px");up=me._listUp?0:_px(elem,"borderTopWidth")+_px(elem,"borderBottomWidth");dd.css("marginTop",me._listTop=xy.height-up);up=_offset(dd);if((up=up.left-xy.left)>30&&up<elem[0].offsetWidth+10){dd.css("marginLeft",-up+"px")}}if(!duration){end()}else if(effect){dd.show(effect,{},duration,end)}else{dd.animate({opacity:1,height:height},{duration:duration,complete:function(){end()},step:function(now,fx){step(now,fx)}})}}else{if(!body&&(!me._static||me._relative)){elem.css("overflow","hidden")}me._xyCheck(true);elem.removeClass(me.css.noTopCorners).removeClass(me.css.noBottomCorners);dd.removeClass(me.css.noBottomCorners).removeClass(me.css.noTopCorners);if(!duration){end()}else if(effect){dd.hide(effect,{},duration,end)}else{dd.animate({opacity:0,height:me._listHeightEnd},{duration:duration,complete:function(){end()},step:function(now,fx){step(now,fx)}})}}return true},_repaintList:function(id,count){if(this._noMouse()){return}var me=this,repaint=!count;if(repaint){id=Math.max(0,this._topID-1);count=id+(this._page&&(this._ddScroll||this._matchFlag)?this._page+3:-1)}count=Math.min(count,this._count);delete this._needsPaint;this._textsTemp=this._texts(1);if(!repaint&&(!this._lodWait||this._lod&&this._filtering===-1)){this._html=" "}while(id<count){this._renderRow(id,repaint);id+=1}if(this._html){this._itemsHolder.html(this._html.substring(this._bindLI=1));delete this._html;setTimeout(function(){me._bindLIs()},600)}if(this._paintAct){this._fixActive(this._activeID,1)}delete this._textsTemp},_startOfSelTrail:function(field,txt,len){var range,sep,end=0,start=0,tr=this._tr();if(tr===1){start=field.selectionStart;end=field.selectionEnd}else if(tr){try{range=document.selection.createRange();tr=range.duplicate();tr.move("textedit",-1);try{while(tr.compareEndPoints("StartToStart",range)<0){tr.moveStart("character",1);if((start+=1)>len){break}}}catch(ex){}end=start+range.text.length}catch(e2){}}if(start===len&&len>2){sep=this._sep();if(sep.length>1&&txt.charAt(len-1)===sep.charAt(1)&&txt.charAt(len-2)===sep.charAt(0)){return start-1}}return start<end&&end===len?start:0},_tr:function(){var field=this.fieldElem[0],tr=this._trVar;if(!tr){try{if((!$.ig.util.isIE||$.ig.util.isIE11)&&!_aNull(field.selectionStart)){tr=1}}catch(ex){}if(tr!==1){try{tr=field.createTextRange?field.createTextRange():null}catch(e2){}}this._trVar=tr}return tr},_setCaret:function(start,end){var tr=this._tr();end=end||start;if(tr){try{if(tr===1){tr=this.fieldElem[0];tr.selectionStart=start;tr.selectionEnd=end;return}if(this._selTime&&_now()-this._selTime<50){return}end-=start;tr.move("textedit",-1);tr.move("character",start);if(end>0){tr.moveEnd("character",end)}tr.select()}catch(ex){}}},_autoComplete:function(filter){var len,txt,selStart,e,backKey,item,tr,txts,ii,last,i=-1,id=this._filtering?this._activeID:this._changeID,field=this.fieldElem,args=this._acArgs,sel="",selEnd=0,o=this.options,selItems=o.selectedItems,itemsLen=selItems?selItems.length:0,sep=this._sep();if(!args||this._noMouse()){return}delete this._acArgs;txt=args.txt;selStart=args.len;e=args.e;if(e&&e.keyCode===$.ui.keyCode.DELETE&&this._custom()){return}backKey=args.backKey;len=txt.length;if(itemsLen>0){if(filter){id=-1}txts=txt.split(sep);tr=selItems;selItems=[];filter=field.val();while((i+=1)<itemsLen){item=tr[i].text;for(ii=0;ii<txts.length;ii+=1){if(txts[ii]===(o.caseSensitive?item:item.toLowerCase())){selItems[ii]=item;if(filter===txts[ii]&&filter!==item){field.val(item)}break}}if(ii===txts.length&&!last){last=item}}while(i>=0){item=i<itemsLen?selItems[i]:last;if(item){if(sel.length>0){sel=sep+sel}sel=item+sel}i-=1}}filter=null;item=id>=0?this._item(id,2):null;if(item&&(!sel||sel!==item)){if(sel){sel+=sep}sel+=item}if(sel&&len>1&&selStart===len&&this._multi(o)&&!backKey&&txt.charAt(len-1)===sep.charAt(0)){if(id>=0){this._addSel(id,e);this._fixSelScroll(-1)}txt=sel+=sep;filter=selStart=i=sel.length}this._userTxt=txt;if(!sel){if(len>0&&!this._filtering){this._fire("noMatchFound",e,{owner:this,text:txt})}if(!backKey){return}}else if(selStart<(selEnd=sel.length)||i>0){field.val(this._oldTxt=sel)}else if(backKey){selEnd=selStart=len}else{return}this._setCaret(selStart,selEnd);this._userTxt=txt.substring(0,selStart);this._selLen=selEnd-selStart;if(filter&&this._multi(o)&&this._filtering){this.filter(e,null,this._noFilter)}},_onChange:function(e,flag,text,backKey){var selStart,len,txt,autoComplete,me=this,field=me.fieldElem,old=me._oldTxt,o=me.options;if(!field||!field[0]){return}txt=e?e.type:null;if(txt&&e.keyCode!==13&&txt.indexOf("blur")<0&&txt.indexOf("mouse")<0&&me._userTxt!==text){delete me._noFilter}if(me._hasData&&me._nullT&&flag===undefined&&!me._fcs){me._fixNull(1)}if(!_aNull(text)){field.val(me._userTxt=text);text=1}txt=me.text();len=txt.length;if(e&&e.type!=="blur"&&(text||flag===2)){me._setCaret(len)}if(!me._expr&&backKey===true&&o.autoComplete&&len>0&&(selStart=me._startOfSelTrail(field[0],txt,len))>0){_stop(e);return me._onChange(e,1,txt.substring(0,selStart-1),2)}if(txt!==old||me._selLen===1&&!flag&&me._userTxt&&old.length-me._userTxt.length===1){if(txt===old){me._userTxt=old}delete me._filterTxt;me._oldTxt=txt;me._fixClear();me._needsPaint=1;if(e){me._fire("textChanged",e,{owner:me,oldText:old,text:txt});if(me._validator){me._validator._evt(e)}}autoComplete=o.autoComplete&&(len>0||backKey);if(me._filtering){if(flag===2&&me._multi(o)){me._repaintList();return}me._userTxt=txt;me.filter(e,null,me._noFilter)}else{if(flag!==2){me._select(null,txt,2,1,e)}if(!autoComplete){me._userTxt=txt;me._repaintList()}}if(autoComplete){me._acArgs={txt:txt,len:len,e:e,backKey:backKey};if(me._filtering>=0){setTimeout(function(){if(!me._jpn){me._autoComplete()}me._repaintList()},0)}}}if(!flag){setTimeout(function(){me._onChange(e,1)},10)}else{me._save(o);if(e&&!me._ddOn&&me._fcs){me._doDrop(1,e)}}},_save:function(o){var item,input,select,sel,i=-1,str="",name=o.inputName;if(!name||!this._hasData||this._waitFilter){return}input=$('input[name="'+name+'"]');if(input[0]===this.element[0]){return}if(input.length===0){input=$('select[name="'+name+'"]');select=input.length;if(select){input.empty()}else{input=$('<input type="hidden" name="'+name+'" />').appendTo(this.element.parent())}}sel=o.selectedItems;while(sel&&(i+=1)<sel.length){item=this._item(sel[i].index);if(item&&item.getTime){item=item.getFullYear()+"-"+(item.getMonth()+1)+"-"+item.getDate()+" "+item.getHours()+":"+item.getMinutes()+":"+item.getSeconds()+"."+item.getMilliseconds()}if(select){$('<option value="'+item+'" selected="selected" >').appendTo(input)}else{if(i>0){str+=","}str+=item}}if(i<1&&this._custom()){str=this.text();if(select){$('<option value="'+str+'" selected="selected" >').appendTo(input)}}if(!select){input.val(str)}},_onKey:function(e,type){var k=e?e.keyCode||e.which:null,me=this,on=me._ddOn,id=me._activeID,o=me.options,kc=$.ui.keyCode,selItems=o.selectedItems,back=k===kc.BACKSPACE,count=me._count-1,mode=me._mode(o);if(type<2&&!me._fire(type===0?"keydown":"keypress",e,{owner:me,keyCode:k})){return _stop(e)}if(type<2&&k===kc.SPACE&&(mode>0||o.selectItemBySpaceKey&&id>=0&&o.enableActiveItem&&on)){_stop(e);if(mode<2&&id>=0&&type===0){me._fixSelScroll(id,e,null,null,1)}return}if(k===46){e.stopPropagation()}if(type<2&&(back||k>40||k===kc.SPACE)&&mode===0){me._jpn=k===229;me._onChange(e,null,null,back)}if(type===0){if(e.shiftKey){return}if(k===kc.ESCAPE){if(!on){setTimeout(function(){me._onChange(e,null,me._focTxt)},0)}else{_stop(e);me._doDrop(0,e)}}if((on||id>=0)&&(k===kc.ENTER||k===kc.NUMPAD_ENTER)){_stop(e);if(mode<2){if(id>=0&&o.enableActiveItem&&!me.isSelected(id)){me._fixSelScroll(id,e,null,null,1)}me._updateFromList(e)}me._doDrop(0,e)}if(k<33||k>40){return}if(e.ctrlKey){return}if(!e.altKey&&!e.metaKey){if(me._count<1){return}if(id<0){if(!on&&k!==kc.DOWN&&k!==kc.UP){return}id=count+1;back=selItems?selItems.length:0;while((back-=1)>=0){id=Math.min(selItems[back].index,id)}if(id>count){id=0}}else if(k===kc.DOWN){id+=1}else if(k===kc.UP){id-=1}else if(k===kc.HOME&&on){id=0}else if(k===kc.END&&on){id=count}else if(k===kc.PAGE_DOWN&&on){id+=me._page}else if(k===kc.PAGE_UP&&on){id-=me._page}else{return}_stop(e);if((id=Math.max(Math.min(id,count),0))!==me._activeID){if(me._activate(id,e)){if(on){me._fixSelScroll(id,e,null,1)}else{me.selectedIndex(id,true)}}}}else if(k===kc.DOWN&&!on||k===kc.UP&&on){return me._doDrop(on?0:1,e)}}},_sep:function(){var sep=this.options.itemSeparator||",";return sep.length>2?sep.substring(0,2):sep},_updateFromList:function(e,zero,addSep){var id=this._changeID,txt="",o=this.options,i=-1,sep=this._sep(),selItems=this._addSel(id===this._activeID?id:-1,e),len=selItems?selItems.length:0;delete this._jpn;if(this._noMouse()){return}this._changeID=-1;if(!this._multi(o)&&len>1){len=1}while((i+=1)<len){txt+=this._item(selItems[i].index,2);if(i+1<len||addSep){txt+=sep}}if(txt.length>0||zero){this._onChange(e,2,txt)}},_findItem:function(id){var dd=this._itemsHolder;if(dd){id-=this._virtualTop;dd=dd.find('[data-id="'+(id+_listIDShift)+'"]');if(dd.length===1){return dd}}},_fixSelScroll:function(id,e,elem,key,ctrl){if(this._fixSel(id,e,elem,key,ctrl)){return}if(e){this._updateFromList(e,ctrl);if(!ctrl&&!key&&this.options.closeDropDownOnSelect){this._doDrop(0,e)}}if(key||!e){this._fixScroll(id)}},_fixActive:function(id,on){var css=this.css.listItemActive,elem=id>=0&&this.options.enableActiveItem?this._findItem(id):null;if(elem){if(on){elem.addClass(css)}else{elem.removeClass(css)}delete this._paintAct}else if(on){this._paintAct=1}},_activate:function(id,e,noScroll){if(!this.options.enableActiveItem||this._noMouse()){this._activeID=id;return 1}var arg,old=this._activeID;if(old!==id&&this._fire("activeItemChanging",e,arg={owner:this,oldIndex:old,index:id})){this._fixActive(old);this._fixActive(this._activeID=id=arg.index,1);if(id>=0&&!noScroll&&(!e||e.type!=="mousedown")){this._fixScroll(id)}this._fire("activeItemChanged",e,arg)}},_fixSel:function(id,e,elem,key,ctrl){var item,next=0,i=id,o=this.options,selItems=this._copyA(o.selectedItems),len=selItems?selItems.length:0,oldSelElems=this._selElems,virtual=this._ddScroll,old=virtual&&id<0?null:this._selElems;if(!this._ddOn||this._noMouse()){return 1}if(id>=0&&!elem){elem=this._findItem(id);if(!elem){old=null;while(virtual&&!elem&&i>=0&&i<=this._count&&(next+=1)<4){this._fixScroll(i);this._onScroll(e);elem=this._findItem(id);i-=1}}if(!elem){return 1}}for(i=0;i<len;i+=1){item=old?old[i]:null;if(!item){item=this._findItem(selItems[i].index);if(item){if(!old){this._selElems=old=[]}this._fixSelElem(old[i]=item,1)}}if(id<0||!item||!e){continue}if(item[0]===elem[0]){if(!ctrl){if(len===1){return}}else{selItems.splice(i,1);if(this._selChange(selItems,e)){this._fixSelElem(elem);old.splice(i,1);this._selChanged(e)}else{this._selElems=oldSelElems}return}}else if(!ctrl){this._fixSelElem(item)}}if(!elem||!e){return}i=null;if(!ctrl||!selItems||!this._multi(o)){i=selItems=[];old=[]}selItems.push(this._createSelItem(id));if(this._selChange(selItems,e,i)){this._activate(id,e);old=old||[];old.push(elem);this._selElems=old;this._fixSelElem(elem,1);this._selChanged(e)}else{this._selElems=oldSelElems;for(i=0;i<this._selElems.length;i++){this._fixSelElem(this._selElems[i],true)}return 1}},_fixScroll:function(id){var scroll,top,last=this._lastScroll,dd=this._ddScroll||this._ddCont,height=this._itemHeightOuter;if(!dd||this._lodWait){return}top=scroll=dd[0].scrollTop;this._scrollTo=-1;if(id<0){if(last&&last!==top){dd[0].scrollTop=last;top=dd[0].scrollTop}if($.ig.util.isSafari&&top>20){dd[0].scrollTop=top-1}}else if((top=id*height)>scroll){if((top+=height-this._listHeight)<scroll){return}}if(top!==last){if(this._ddScroll&&top>last){top+=height-1}dd[0].scrollTop=top}},_bindLIs:function(o,li){var me=this,holder=me._itemsHolder,elem=li;if(!me.mainElem){return}if(!li){if(!this._bindLI||!holder){return}delete this._bindLI;elem=holder.find("li[data-id]")}elem.bind(me._mEvts);if(me._checkBox(o||this.options)){if(!me._evtHov){me._evtHov={MSPointerOver:function(e){me._onEvt(this,26,e)},pointerover:function(e){me._onEvt(this,26,e)},mouseover:function(e){me._onEvt(this,16,e)},mouseleave:function(e){me._onEvt(this,17,e)}}}elem=li||holder;elem.find("span[data-box]").bind(me._evtHov).bind(me._tEvts).find("span[data-icon]").bind(me._tEvts)}},_onEvt:function(el,type,e){var i,hovCss,pressCss,me=this,msOver=me._msOver,o=me.options,css=me.css,field=me.fieldElem,el$=!el||el===field[0]||e&&e.target===field[0]?field:$(el),id=el$.attr("data-id"),elem=me.mainElem,mode=me._mode(o);if(o.disabled){return}if(type===8){me._focTxt=me.text();me._fcs=1;elem.addClass(css.focus);field.addClass(css.fieldFocus);me._fixNull();if(mode<3){me.buttonElem.addClass(css.buttonFocus);me.clearElem.addClass(css.clearFocus)}if(!me._ddOn&&o.dropDownOnFocus){setTimeout(function(){if(me._fcs){me._doDrop(1,e)}},50)}return}if(type===9){i=me.text();if(e&&me._jpn&&$.ig.util.isFF&&me._userTxt!==i){me._onChange(e,null,i)}me._jpn=me._fcs=0;elem.removeClass(css.focus);field.removeClass(css.fieldFocus);me.buttonElem.removeClass(css.buttonFocus);me.clearElem.removeClass(css.clearFocus);if(!e){return}if(o.closeDropDownOnBlur){me._doDrop(0,e)}if(!me._custom()){me._updateFromList(e,1)}if(o.clearSelectionOnBlur||!o.allowCustomValue){me._changeID=-1;me._onChange(e,null)}me._fixNull();if(me._validator){me._validator._evt(e,null,1)}return}if(type===10){elem=me._ddScroll||me._ddCont;o=e.originalEvent||e;i=e.wheelDelta||o.wheelDelta||-(e.detail||o.detail);if(!_aNull(i,true)&&elem){_stop(e);elem[0].scrollTop+=i>0?-me._itemHeightOuter:me._itemHeightOuter}return}if($.ig.util&&$.ig.util.evtButton(e)){return}if(type===26){me._msOver=e.originalEvent.pointerType;return}if(msOver===2&&(type===6||type===16)){delete me._msOver;return}if(!id&&type>15){id=el$.parent().attr("data-id")}id=el$===field?0:isNaN(id=id?parseInt(id,10):-1)?-1:id;if(id>90){me._bindLIs(o)}if(id<0||id>98&&me._noMouse()){return}if(type===3){_stop(e)}if(mode>1&&(type>7||id>3)){return}if(type===16){return el$.addClass(css.checkboxHover)}if(type===17){return el$.removeClass(css.checkboxHover)}hovCss=id>=_listIDShift?me._touch()&&!(msOver&&msOver!==2)?"":css.listItemHover:id===1?css.buttonHover:css.clearHover;pressCss=id>=_listIDShift?"":id===1?css.buttonPressed:css.clearPressed;if(type===3){if(id<3){el$.addClass(pressCss)}return}if(id===_listIDShift-1){return}if(type===4){if(id>=_listIDShift){delete me._jpn;me._fixSelScroll(id-_listIDShift+me._virtualTop,e,el$,null,e.ctrlKey||e.metaKey||me._isCheckBox(e.target))}else if(el$.hasClass(pressCss)){if(id===1){if(me._vAct("drop")){return}me.setFocus();me._doDrop(1,e)}if(id===2){if(me._filtering){me._select(-1)}me._onChange(e,null,"")}el$.removeClass(pressCss)}return}if(type===6){if(id===0){field.addClass(css.fieldHover);elem.addClass(css.hover)}else{el$.addClass(hovCss)}}if(type===7){if(id===0){elem.removeClass(css.hover);field.removeClass(css.fieldHover);if(me._fcs===1){elem.addClass(css.focus)}}else{el$.removeClass(hovCss).removeClass(pressCss)}}},_fixClear:function(size){var o=this.options,show=o.enableClearButton&&this._oldTxt.length>0&&this._mode(o)<2&&!o.disabled;if(this._jpn&&$.ig.util.isFF){return}if(this._clearOn!==show){this._clearOn=show;size=1}if(size){this._doSize()}},_doTimer:function(flag){var me=this,timer=me._timer;if(flag===2){if(timer){clearInterval(timer);delete me._timer}return}if(!timer){me._timer=setInterval(function(){me._doTimer()},200)}if(flag===1){return}if(me._doSize(1)&&!me._percWidth&&!me._percHeight){me._doTimer(2)}},_doButHeight:function(height,perc){var img,imgHeight,min=this._butMinHeight,offsetHeight=height,minHolder=this._minHolderHeight;this.clearElem.css("height",perc?"100%":height-minHolder);height=Math.max(height-min,0);this.buttonElem.css("height",perc?height/offsetHeight*100+"%":height);img=this.buttonElem.children(0);imgHeight=img[0].offsetHeight||16;img.css("marginTop",Math.floor((offsetHeight-(min||0)-imgHeight)/2+.5)+"px");img=this.clearElem.children(0);img.css("marginTop",Math.floor((offsetHeight-minHolder-(img[0].offsetHeight||imgHeight))/2+.5)+"px")},_outerWidth:function(elem){return elem[0].offsetWidth+_px(elem,"marginLeft")+_px(elem,"marginRight")},_outerHeight:function(elem){return elem[0].offsetHeight+_px(elem,"marginTop")+_px(elem,"marginBottom")},_sameBC:function(src,targ){var clr=src.css("backgroundColor");targ.css("background",!clr||clr==="transparent"||clr.replace(/ /g,"").indexOf("(0,0,0,0")>0?"white":clr)},_doSize:function(timer){if(!this.mainElem){return}var fieldWidth,fix,percWidth,percHeight,butHeight,holderHeight,holderWidth,me=this,o=me.options,width=o.width,height=o.height,relative=me._relative,but=me.buttonElem,css=me.css,elem=me.mainElem,elem0=elem[0],field=me.fieldElem,fieldHolder=me._fieldHolder,clearOn=me._clearOn,minFieldHeight=me._minFieldHeight,minFieldWidth=me._minFieldWidth,minHolderWidth=me._minHolderWidth,minHolderHeight=me._minHolderHeight,butWidth=me._butWidth,clearWidth=me._clearWidth,lastHeight=me._lastHeight,clear=me.clearElem,offsetWidth=elem0.offsetWidth,offsetHeight=elem0.offsetHeight;if(offsetWidth&&!me._offsetWidth&&(!width||!height)){fix=$("<span />").css({display:"inline-block",position:"absolute"}).addClass("ui-igcombo").appendTo(me.element.parent());if(!width){width=fix[0].offsetWidth;if(width>10){o.width=width}else{width=0}}if(!height){height=fix[0].offsetHeight;if(height>10&&height!==fix.removeClass("ui-igcombo")[0].offsetHeight){o.height=height}else{height=0}}fix.remove()}width=width||150;height=height||"auto";fix=me._offsetWidth!==offsetWidth||width!==me._lastWidth||me._offsetHeight!==offsetHeight||height!==lastHeight;if(!offsetWidth||timer&&!fix){if(!offsetWidth){me._doTimer(1)}return}if(fix){me._listRemove()}me._lastWidth=width;me._lastHeight=height;me._percWidth=percWidth=typeof width==="string"&&width.indexOf("%")>0;me._percHeight=percHeight=typeof height==="string"&&height.indexOf("%")>0;if(percWidth||percHeight){me._doTimer(1)}if(!lastHeight){me._sameBC(field,fieldHolder);relative=elem.css("position")!=="static";if(!relative&&(percWidth||percHeight)){elem.css("position","relative");relative=true}me._relative=relative;field.css("position",relative?"absolute":"static")}fieldHolder.css({position:"absolute",width:"auto",height:"auto"});clear.hide();field.css({width:0,height:0});if(!lastHeight){fix=me._rtl?css.fieldHolderRTL:css.fieldHolderLTR;if(o.showDropDownButton){fieldHolder.addClass(fix)}else{fieldHolder.removeClass(fix)}fix=me._rtl?css.buttonRTL:css.buttonLTR;if(o.showDropDownButton){but.addClass(fix)}else{but.removeClass(fix)}butWidth=0;if(o.showDropDownButton){but.show();butWidth=me._outerWidth(but);fix=but.css("height");but.css("height",0);me._butMinHeight=me._outerHeight(but);but.css("height",fix)}else{but.hide()}me._butWidth=butWidth;me._minFieldWidth=minFieldWidth=me._outerWidth(field);me._minFieldHeight=minFieldHeight=me._outerHeight(field);me._minWidth=butWidth+me._outerWidth(field);if(o.enableClearButton){clear.show();me._clearWidth=clearWidth=me._outerWidth(clear);clear.hide()}field.hide();me._minHolderHeight=minHolderHeight=fieldHolder[0].offsetHeight;me._minHolderWidth=minHolderWidth=fieldHolder[0].offsetWidth;field.show()}fix=_toPx(width);if(fix){width=fix-_px(elem,"borderLeftWidth")-_px(elem,"borderRightWidth");if(width<1){width=1}}fix=_toPx(height);if(fix){height=fix-_px(elem,"borderTopWidth")-_px(elem,"borderBottomWidth");if(height<1){height=1}}elem.css({width:width,height:height,display:"inline-block",minWidth:0,minHeight:0});offsetWidth=elem0.clientWidth;offsetHeight=elem0.clientHeight;fieldHolder.css("height","auto");butHeight=o.showDropDownButton?me._outerHeight(but):0;if(!relative){fieldHolder.css("position","static")}field.css({height:"auto",position:"static"});holderHeight=me._outerHeight(fieldHolder);if(relative){field.css("position","absolute")}if(clearOn){clear.show()}if(o.height){holderHeight=Math.max(offsetHeight-minHolderHeight,0);fieldHolder.css("height",percHeight?holderHeight/offsetHeight*100+"%":holderHeight);field.css("height",percHeight?(holderHeight-minFieldHeight)/holderHeight*100+"%":holderHeight-minHolderHeight-minFieldHeight);me._doButHeight(offsetHeight,percHeight)}else if(holderHeight<butHeight){fieldHolder.css("height",butHeight-minHolderHeight);field.css("height",butHeight-minHolderHeight-minFieldHeight)}else{me._doButHeight(holderHeight,percHeight);field.css("height",holderHeight-minHolderHeight-minFieldHeight);if(relative){fieldHolder.css("height",holderHeight-minHolderHeight)}elem.css("height",height=holderHeight)}elem.css({display:o.enableDisplayBlock?"block":"inline-block",minWidth:me._minWidth+clearWidth+2});width=Math.max(offsetWidth-butWidth-minHolderWidth,0);fieldHolder.css("width",percWidth?width/offsetWidth*100+"%":width);offsetWidth=elem0.clientWidth;holderWidth=fieldHolder[0].offsetWidth;if((fix=offsetWidth-holderWidth-butWidth)!==0){width+=fix;fieldHolder.css("width",percWidth?width/offsetWidth*100+"%":width)}fieldWidth=width-minFieldWidth-1;if(clearOn){fieldWidth-=clearWidth}field.css("width",percWidth?fieldWidth/width*100+"%":fieldWidth);if((fix=fieldHolder[0].clientWidth-me._outerWidth(field)-(clearOn?clearWidth:0)-1)!==0){fieldWidth+=fix;field.css("width",percWidth?fieldWidth/width*100+"%":fieldWidth)}if(!relative){holderHeight=fieldHolder[0].offsetHeight+5;elem.css("height","auto");for(fix=0;fix<4&&width>0;fix+=1){if(elem0.offsetHeight<holderHeight){break}width-=.5;fieldHolder.css("width",percWidth?width/offsetWidth*100+"%":width)}fieldHolder.css("width",percWidth?--width/offsetWidth*100+"%":--width);elem.css("height",height)}me._offsetWidth=elem0.offsetWidth;me._offsetHeight=elem0.offsetHeight;return 1},_listRemove:function(){var me=this;if(!me.listElem){return}me._touch("destroy");me.mainElem.removeClass(me.css.noTopCorners).removeClass(me.css.noBottomCorners);me.listElem.remove();me._selElems=me.listElem=me._itemsHolder=me._ddCont=me._ddScroll=me._noResults=me._q=me._ddOn=me._extraHeight=me._listChanged=me._ddItemBorderFix=me._itemHeightOuter=me._bindLI=null;me._lastScroll=me._virtualTop=me._topID=0;me._activeID=me._scrollTo=-1},destroy:function(){var i,e,elem=this.mainElem,css=this.css,old=this._oldCss,field=this.fieldElem,elem0=this.element;e=elem?elem[0]:null;if(!e){return this}if(this._loadInd){this._loadInd.destroy()}this._doTimer(2);this._listRemove();this.validator(1);if(this._SELECT){elem.remove();elem0.css("display",old.display)}else{field.removeClass(css.nullText).removeClass(css.fieldFocus).removeClass(css.fieldHolder).unbind(this._evts);if(this._swap){field.removeClass(css.field);field.insertBefore(elem);elem.remove()}else{this.buttonElem.remove();this.clearElem.remove();elem.unbind(this._elemEvts).removeClass(css.combo).removeClass(css.hover).removeClass(css.focus).removeClass(css.disabled);field.remove()}for(i in old){if(old.hasOwnProperty(i)){elem0.css(i,old[i])}}old=this._oldAttr;for(i in old){if(old.hasOwnProperty(i)){elem0[0][i]=old[i]}}}this._cascade(false,true);delete this.mainElem;$.Widget.prototype.destroy.apply(this,arguments);return this},_getType:function(v){return v===true||v===false?"bool":v&&v.getTime?"date":typeof v==="number"?"number":"string"},dataBind:function(callback){var field,ds0,dataOptions,setting,binded,o=this.options,url=o.dataSourceUrl,lod=o.parentComboKey&&o.parentCombo?null:o.loadOnDemandSettings,key=o.responseDataKey,txtKey=o.textKey||o.valueKey,type=o.dataSourceType,vt=o.valueKeyType,tt=o.textKeyType,verb=o.requestType,contentType=o.responseContentType,schema={fields:[]},ds=o.dataSource,dsStr=typeof ds==="string",keys=key?key.split("."):null,len=keys?keys.length-1:-1,i=-1;vt=vt==="auto"?null:vt;if(dsStr&&!type){if($.ig.util.isJsonpUrl(ds)){ds=new $.ig.JSONPDataSource({dataSource:ds})}else{ds=new $.ig.DataSource({dataSource:ds})}}ds0=ds;while(ds0&&i++<len){ds0=ds0[keys[i]]}if(!ds0){ds0=ds;keys=null}else if(keys){schema.searchField=key}field=ds0?ds0[0]:null;if(typeof field==="string"||typeof field==="number"||field&&field.getTime){i=ds0.length;field=ds0;ds0=[];txtKey=txtKey||"x";while(i-->0){ds0[i]={};ds0[i][txtKey]=field[i]}if(keys){field=ds;i=-1;while(++i<len){field=field[keys[i]]}field[keys[len]]=ds0}else{ds=ds0}}dataOptions={callback:callback?callback:this._dataChange,dataSource:ds,requestType:verb,responseContentType:contentType,type:type||undefined,responseDataKey:key,responseTotalRecCountKey:o.responseTotalRecCountKey};field=this._noMouse()||this._cascFilter?null:o.filteringType;this._filtering=field==="local"?1:field==="remote"?-1:0;if(ds0){ds0=ds0[0];for(field in ds0){if(ds0.hasOwnProperty(field)){if(!txtKey){txtKey=o.valueKey=o.textKey=field}i=this._getType(ds0[field]);if(!vt&&field===o.valueKey){o.valueKeyType=vt=i}schema.fields.push({name:field,type:i});if(txtKey!==field&&o.valueKey!==field){o._all=1}}}}if(ds instanceof $.ig.DataSource&&!ds.settings.schema||!(ds instanceof $.ig.DataSource)){dataOptions=$.extend(dataOptions,{schema:schema})}if(ds instanceof $.ig.DataSource){binded=ds._data&&ds._data.length;dataOptions.dataSource=ds.settings.dataSource;ds.settings=$.extend(true,{},ds.settings,dataOptions);ds.settings.callee=this;if(dataOptions.schema){ds._initSchema()}}else{ds=new $.ig.DataSource(dataOptions);ds.settings.callee=this}tt=tt==="auto"?null:tt;schema=vt||tt?ds.schema():null;schema=schema?schema.fields():null;i=schema?schema.length:0;while((i-=1)>=0){field=schema[i];if(vt&&field.name===o.valueKey){field.type=vt}if(tt&&field.name===o.textKey){field.type=tt}}ds._response_data=function(data){var len=data?data.length:0,count=len>0?data[len-1][":totals:"]:null;if(count){data.pop();count=count.split(":");ds.totalRecordsCount(_aNull(len=parseInt(count[0],10),true)?0:len);len=_aNull(len=parseInt(count[1],10),true)?0:len;if(len){o._totalAll=len}}};delete this._lod;if(lod&&lod.enabled&&(url||dsStr)){setting=ds.settings.paging;setting.type="remote";setting.appendPage=setting.enabled=true;setting.pageSizeUrlKey=lod.pageSizeUrlKey||null;setting.pageIndexUrlKey=lod.pageIndexUrlKey||null;if(!_aNull(i=parseInt(o._total,10),true)){ds.totalRecordsCount(i)}lod=parseInt(lod.pageSize||30,10);setting.pageSize=this._lod=_aNull(lod,true)?30:Math.max(lod,5);setting.pageIndex=0}if(this._fire("dataBinding",null,{owner:this,dataSource:ds},1)){this._dataSource=ds;this._keyVal=this._hasData=this._key_=null;this._listRemove();if(binded){this._dataChange()}else{ds.dataBind()}}if(url&&!this._urlBind){setting=ds.settings;setting.dataSource=url;setting.type="remoteUrl";ds._runtimeType=ds.analyzeDataSource();setting.urlParamsEncoded=$.proxy(function(data,params){params=params?params.filteringParams:null;if(params){params.textKey=o.textKey||o.valueKey;params.valueKey=o.valueKey;if(!o.caseSensitive){params.toLower="1"}if(o.compactData){params.compact="1"}if(o.parentComboKey){params.cascade=o.parentComboKey}}},this);this._urlBind=1;if(!o.dataSource){ds.dataBind()}}},_cond:function(o,paint){return o.autoComplete?"startsWith":paint||!this._filtering?o.renderMatchItems:o.filteringCondition},_isStrCond:function(cond){return cond==="startsWith"||cond==="endsWith"||cond==="contains"||cond==="doesNotContain"||cond==="empty"||cond==="notEmpty"},_texts:function(txt){var i,len,sepLen,render=txt===1,o=this.options,sep=this._multi(o)?this._sep():null;if(render||_aNull(txt)){txt=this._userTxt||this._oldTxt}else if(typeof txt!=="string"){return[txt]}if(!o.caseSensitive){txt=txt.toLowerCase()}if(!sep){return txt?[txt]:[]}while(txt.indexOf(sep+sep)>0){txt=txt.replace(sep+sep,sep)}sepLen=sep.length;len=txt.length;if(render){if((i=txt.lastIndexOf(sep.charAt(0)))>0&&i===len-1){txt=txt.substring(0,len-=1)}if((i=txt.lastIndexOf(sep))>0&&i===(len-=sepLen)){txt=txt.substring(0,len)}}else if((i=txt.lastIndexOf(sep.charAt(0)))>0&&i===len-1&&sepLen>1){txt+=sep.charAt(1)}if(txt.indexOf(sep)===0){txt=txt.substring(sepLen)}return txt?txt.split(sep):[]},_fillKeys:function(fix){if((fix||!this._keyFixed)&&this._key!==this._key_){var count=this._count;while((count-=1)>=0){this._item(count,2)}}this._keyFixed=1},_wait:function(on){var css=this.css.waitFiltering,load=this._loadInd,elem=this.mainElem,holder=this._itemsHolder;if(on){elem.addClass(css);if(holder){holder.addClass(css)}if(!load&&elem.igLoading){load=elem.igLoading().data("igLoading");if(load){this._loadInd=load=load.indicator()}}if(load){load.show()}}else if(elem){elem.removeClass(css);if(holder){holder.removeClass(css)}if(load){load.hide()}}},filter:function(e,txtNew,noFilter){var filter,key,i=-1,casc=this._cascFilter,txt=casc?this._cascVal:typeof txtNew==="string"?[txtNew]:txtNew instanceof Array?txtNew:this._texts(),len=casc?0:txt.length,cond=len?txt.toString():null,ds=this._dataSource,o=this.options,expr=[],remote=casc===-1||this._filtering<0;if(noFilter||this._hasData&&cond&&this._filterTxt===cond){return}if(this._expr){this._filterNew={txt:txt,e:e};return}this._filterTxt=cond;delete this._filterNew;if(remote&&len>1&&!txt[len-1]){len=0}if(casc){cond="equals";key=this._cascKey;expr.push({fieldName:key,cond:cond,expr:txt})}else{cond=this._cond(o);key=remote||!this._isStrCond(cond)?this._key:this._key_;
while((i+=1)<len){expr.push({fieldName:key,cond:cond,expr:txt[i]})}}if(expr.length===0&&!e){return}if(!this._fire("filtering",e,this._expr={owner:this,expression:expr},1)){delete this._expr;return}if(remote&&this._hasData&&!this._fire("dataBinding",null,{owner:this,dataSource:ds},1)){delete this._expr;return}if(!casc){this._needsSel=txt;this._needsSelEnd=this._multi(o)&&this._sepEnd(this.text())}filter=ds.settings.filtering;filter.caseSensitive=o.caseSensitive;filter.type=o.filteringType;if(remote){this._wait(true);key=o.filterExprUrlKey;if(key){filter.filterExprUrlKey=key}filter.expressions=expr;this._waitFilter=!this._hasData;if(this._lod){txt=txtNew!==null&&txtNew!==undefined?txtNew:this.text();if(this._lodTxt!==txt){this._lodTxt=txt}ds._data=[];ds._dataView=[];ds._filteredDataView=[];ds._cachedDataView=null;ds.settings.paging.pageIndex=0;ds.pageSizeDirty(true)}ds.dataBind();return}if(expr.length===0||!this._hasData&&!casc){ds.clearLocalFilter()}else{this._fillKeys();ds.filter(expr,"OR",this._noFilter)}this._dataChange(e,true)},_checkExpr:function(){var change,filterNew=this._filterNew,expr=this._expr,len=filterNew&&filterNew.txt?filterNew.txt.length||0:0;if(!filterNew){return}if(expr){expr=expr.expression}if(len!==(expr?expr.length:0)){change=1}while(!change&&(len-=1)>=0){change=filterNew.txt[len]!==expr[len].expr}if(change){delete this._expr;this.filter(filterNew.e,filterNew.txt,this._noFilter);return 1}delete this._filterNew},_fixType:function(val){var fields,type=this.options.valueKeyType;if(!_aNull(val)){if(type==="number"){return typeof val==="number"?val:parseFloat(val)}if(type==="bool"){return val==="true"||val===true}if(type==="date"&&!val.getTime){val=val.toString();fields=val.replace(/[\. :]/g,"-").split("-");return fields.length===7?new Date(parseInt(fields[0],10),parseInt(fields[1],10)-1,parseInt(fields[2],10),parseInt(fields[3],10),parseInt(fields[4],10),parseInt(fields[5],10),parseInt(fields[6],10)):Date.parse(val)}}return val},_initSel:function(o){var item,val,id,ii,custom,more=1,selItems=o.selectedItems,len=selItems?selItems.length:0,i=-1;while(!this._multi(o)&&len>1){selItems.splice(len-=1,1)}id=len;while(id-->0){item=selItems[id];item.value=this._fixType(val=item.value)}custom=o.text||(len===1&&this._custom(o)?val:null);o.text=null;while((i+=1)<this._count&&more){val=this._item(i);more=null;id=len;while((id-=1)>=0){item=selItems[id];if(_aNull(ii=item.index)||ii<0){if(_equals(item.value,val)){if(this.isSelected(i)){selItems.splice(id,1);len-=1}else{item.index=i;item.text=this._item(i,2)}}else{more=1;if(i===this._count-1){selItems.splice(id,1)}}}else{item.value=item.value||this._item(ii);item.text=item.text||this._item(ii,2)}}}if(custom&&(!selItems||!selItems.length)){this.text(custom)}else if(!this.text()||!this._custom(o)){this._updateFromList(null,1)}},_dataChange:function(e,local){var count,txt,selLen,selItems,data,top,firstMatch,fullMatch,firstFullMatch,item,cond,lod=this._lodWait,casc=this._cascFilter,more=!casc,i=-1,actID=-1,sel=this._needsSel,id=-1,keyVal=this._keyVal,key=this._key,dd=this._itemsHolder,ds=this._dataSource,filter=casc||this._filtering,o=this.options,trimmedSep,txtTmp;if(!o||!this._multi||this._cascUrl){return}selItems=o.selectedItems;if(casc&&(_aNull(this._cascVal,true)||this._cascVal==="")){filter=false}else{data=ds.dataView()}this._data=data=data||[];this._count=count=top=data.length;if(!this._hasData&&!count&&o.dataSourceUrl&&o.selectedItems){this._urlSel=1}if(!keyVal){keyVal=o.valueKey;if(!keyVal&&data[0]){for(keyVal in data[0]){if(data[0].hasOwnProperty(keyVal)){break}}}this._keyVal=keyVal;key=o.textKey||keyVal;this._key_=this._key=key;this._keyFixed=!o.format;if(!this._keyFixed){this._key_+="_"}}if(count&&!o.valueKeyType){while(++i<count){if(!_aNull(item=this._item(i))){o.valueKeyType=item===true||item===false?"bool":typeof item==="number"?"number":item.getTime?"date":"string";break}}i=selItems?selItems.length:0;while(i-->0){selItems[i].value=this._fixType(selItems[i].value)}this._cascSel=this._fixType(this._cascSel)}if(this._hasData){if(this._checkExpr()){return}if(this._urlSel===1){this._initSel(o);this._urlSel=2}else{txtTmp=this.text();trimmedSep=$.trim(o.itemSeparator);if(this._urlSel||lod&&this.selectedIndex()<0&&!o.autoComplete||e&&e.type==="keydown"&&this._multi(o)&&o.itemSeparator.lastIndexOf(" ")>-1&&txtTmp.lastIndexOf(trimmedSep)===txtTmp.length-trimmedSep.length){txt=txtTmp}if(!lod){this._activate(-1,e);this._clearSel();this._lastScroll=this._virtualTop=this._topID=0;this._scrollTo=-1}if(dd){if(!lod){dd.empty()}this._listChanged=1}if(txt){this._select(null,txt,2)}}}if(this._expr){if(filter<0){this._fire("dataBound",null,{owner:this,dataSource:ds},1)}if(!this._isStrCond(cond=this._cond(o))){cond="startsWith"}if(!this._multi(o)){cond="equals"}if(this._ddOn||e&&e.type==="keydown"){this._doDrop(1,e)}this._fillKeys(1);selLen=sel&&!casc?sel.length:0;if(casc){this._initSel(o);item=selItems?selItems[0]:null;if(item){while(++id<count){if(item.value===this._item(id)){item.index=id;break}}if(id===count){o.selectedItems=null;this.fieldElem.val("")}}}selItems=[];while((id+=1)<count&&more){txt=this._item(id,2);i=-1;more=null;while((i+=1)<selLen){if(sel[i]){more=1;if(txt&&ds._findMatch(txt,sel[i],"string",!o.caseSensitive,cond)){item=null;if(!selItems[i]){selItems[i]=item=this._createSelItem(id,txt)}fullMatch=txt.length===sel[i].length;if(!firstMatch||fullMatch){firstMatch=1;top=Math.min(top,id);if(fullMatch){if(!firstFullMatch){top=id}firstFullMatch=1;selItems[i]=item||this._createSelItem(id,txt);sel[i]=null;if(!this._multi(o)){id=count+1}break}}}}}}if(selItems[0]){txt=selItems[0].text}while((selLen-=1)>=0){item=selItems[selLen];if(!item||actID<0&&!this._needsSelEnd){if(item){actID=item.index}if(!item||item.text!==txt){selItems.splice(selLen,1)}}}if(!casc){if(this._selChange(selItems,e)){this._selChanged(e);if(this._needsSelEnd){this._updateFromList(e,1,1)}}}if(actID<0&&count){item=this._item(0,2);txt=this.text();if(item&&txt){if(!o.caseSensitive){item=item.toLowerCase();txt=txt.toLowerCase()}if(item.indexOf(txt)===0){actID=0}}}if(actID>=0){this._activate(top=actID,e,1)}this._fixSelScroll(this._scrollTo=top===count?0:top);this._fire("filtered",e,this._expr,1);this._autoComplete(1);this._wait();delete this._waitFilter;delete this._expr}else{if(this._urlSel!==2){txt=this.text();sel=this.selectedIndex();if(txt&&!this._custom(o)&&sel<0){if(!this._hasData||!o.autoComplete){this._select(null,txt,2)}}else{if(e===true&&!_aNull(sel=sel<0?this._cascSel:null)){selItems=null;while(!selItems&&++id<count){if(this._item(id)===sel){selItems=[this._createSelItem(id,null,sel)]}}o.selectedItems=selItems;if(!selItems){this.fieldElem.val("")}delete this._cascSel}if(!casc){this._initSel(o)}}}this._fire("dataBound",null,{owner:this,dataSource:ds},1);if(this._urlSel===2&&!casc){this._noFilter=1;this._updateFromList(null,1);delete this._noFilter;delete this._urlSel}else if(filter){this.filter(null,null,this._noFilter)}if(this._ddOn){this._doDrop(1,e,1)}}if(this._mode(o)>1&&this.selectedIndex()<0&&this.value()===null){this.selectedIndex(0)}if(data.length<1){this._fire("noMatchFound",e,{owner:this,text:this.text()})}this._hasData=1;this._fixClear();this._fixNull();this._save(o);if(this._lodWait&&!local){this._wait();this._fixSel();delete this._lodWait}this._lodLbl();if(_cascWait){more=_cascWait[id=e=this.element[0]];if(!more){more=_cascWait[id=e.id]}count=more?more.length:0;while(count-->0){item=more[count];i=casc=item.options.parentCombo;if(i===id||i==="#"+id){casc=e}else{if(casc&&typeof casc==="string"){casc=$(casc);if(casc.length!==1){casc=$("#"+i)}}if(casc&&casc.element){casc=casc.element[0]}else if(casc&&casc.length===1){casc=casc[0]}}if(casc===e){if(_cascWait){delete _cascWait[id];for(key in _cascWait){if(_cascWait.hasOwnProperty(key)){casc=null;break}}if(casc){_cascWait=undefined}}item._cascade(false,false,this)}}}if(this._valTime===1){delete this._valTime;this.value(this._valLast,true)}},_locale:function(key){var val=this.options[key];if(_aNull(val)){val=$.ig.Combo&&$.ig.Combo.locale?$.ig.Combo.locale[key]:null}return val||""},_titles:function(){var val=this._locale("clearButtonTitle");this.clearElem.attr("title",val).attr("longdesc",val);val=this._locale("dropDownButtonTitle");this.buttonElem.attr("title",val).attr("longdesc",val)},_fire:function(t,e,a,fire){return this._canFire||fire?this._trigger(t,e,a):true},_same:function(old,val){if(old===val){return true}if(!old||!val||typeof val==="string"){return}var p1,p2,item,key,i=val.length;if(i!==old.length||_aNull(i)){return}while(i-->0){item=val[i];if(item&&!old[i]||!item&&old[i]){return}for(key in item){if(item.hasOwnProperty(key)){p1=item[key];p2=old[i][key];if(p1!==p2&&(p1&&!p2||!p1&&p2||!p1.getTime||!p2.getTime||p1.getTime()!==p2.getTime())){return}}}}return true},_setOption:function(key,val){var o=this.options,field=this.fieldElem,elem=this.mainElem;if(this._same(o[key],val)){return this}if(key==="selectedItems"){this._clearSel()}if(key.indexOf("virt")===0||key.indexOf("Match")>0||key.indexOf("empl")>0||key.indexOf("drop")===0||key==="caseSensitive"||key==="format"||key==="enableActiveItem"){o=null;delete this._it}if(key==="multiSelection"||!o){this._listRemove()}$.Widget.prototype._setOption.apply(this,arguments);if(key.indexOf("par")===0||key.indexOf("casc")===0||key.indexOf("useT")===0){this._cascade();return this}if(typeof val==="function"||!o){return this}if(key==="width"||key==="height"||key==="showDropDownButton"){this._lastHeight=null;this._doSize()}else if(key==="selectedItems"||key==="multiSelection"){this._initSel(o);this._updateFromList(null,1);this._fixNull()}else if(key.indexOf("Title")>0){this._titles()}else if(key.indexOf("dataS")===0||key.indexOf("fil")===0||key.indexOf("Key")>0||key.indexOf("OnDem")>0){this._hasData=false;this._lod=this._totalAll=o._totalAll=this._count=0;this.selectedIndex(-1);this.activeIndex(-1);this.dataBind()}else if(key==="enableClearButton"){this._fixClear(1)}else if(key==="tabIndex"||key==="disabled"){field.attr(key,val);this._fixClear()}else if(key==="mode"){field.attr("readOnly",this._mode(o)>0);this._fixClear()}else if(key==="enableDisplayBlock"){elem.css("display",val?"block":"inline-block")}else if(key==="itemSeparator"){this._updateFromList()}else if(key==="text"){this.text(val)}else if(key==="nullText"){this._fixNull()}else if(key==="validatorOptions"){this.validator()}return this}});$.extend($.ui.igCombo,{version:"13.1.20131.2523"})})(jQuery);