/*!@license
* Infragistics.Web.ClientUI Editors localization resources 13.1.20131.2523
*
* Copyright (c) 2011-2014 Infragistics Inc.
*
* http://www.infragistics.com/
*
*/
(function($){$.ig=$.ig||{};if(!$.ig.Editor){$.ig.Editor={locale:{spinUpperTitle:"Increment",spinLowerTitle:"Decrement",buttonTitle:"Show list",clearTitle:"Clear value",datePickerButtonTitle:"Show calendar",updateModeUnsupportedValue:'The updateMode option supports two possible values - "onChange" and "immediate"'}}}})(jQuery);/*!@license
* Infragistics.Web.ClientUI Editors 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
* jquery.ui.datepicker.js
* infragistics.util.js
*
* Example to use:
*	<script type="text/javascript">
*	$(function () {
*		$('#editor1').igEditor();
*	});
*	</script>
*	<input id="editor1" type="text" />
*/
(function($){var _aNull=function(v,nan){return v===null||v===undefined||nan&&typeof v==="number"&&isNaN(v)},_int=function(val,nan){val=parseInt(val,10);if(isNaN(val)){val=nan||0}return val},_pad_bdr=function(elem,horiz){var v1=horiz?"Left":"Top",v2=horiz?"Right":"Bottom";return _int(elem.css("padding"+v1))+_int(elem.css("padding"+v2))+_int(elem.css("border"+v1+"Width"))+_int(elem.css("border"+v2+"Width"))},_str=function(v){return _aNull(v)?"":v.toString()},_now=function(){return(new Date).getTime()},_offset=function(e,xy){return $.ig.util?$.ig.util.offset(e,xy):xy||(e?e.offset():null)},_stop=function(e){try{e.preventDefault();e.stopPropagation()}catch(ignore){}};$.ig=$.ig||{};$.widget("ui.igEditor",{options:{value:null,tabIndex:null,nullText:null,button:"none",textAlign:null,listItems:null,theme:null,type:null,locale:null,width:null,height:null,validatorOptions:null,required:false,display:"inline-block",renderInContainer:false,selectionOnFocus:-1,readOnly:false,spinOnReadOnly:false,focusOnSpin:false,spinWrapAround:false,hideEnterKey:true,dropDownOnReadOnly:false,dropDownTriggers:"button,ctrl+arrow,alt+arrow",listDropDownAsChild:false,listWidth:0,listMaxHeight:300,listColumns:1,animationShowDuration:200,animationHideDuration:200,inputName:null},events:{keydown:0,keypress:1,keyup:2,mousedown:3,mouseup:4,mousemove:5,mouseover:6,mouseleave:7,focus:8,blur:9,valueChanging:10,valueChanged:11,textChanged:12,invalidValue:13,spin:14,buttonClick:15,showDropDown:16,hideDropDown:17,listSelecting:18,listSelected:19},css:{editor:"ui-igedit ui-state-default ui-widget ui-corner-all",container:"ui-igedit-container",field:"ui-igedit-field",fieldRtl:"ui-igedit-rtl",textArea:"ui-igedit-textarea",hover:"ui-igedit-hover ui-state-hover",focus:"ui-igedit-focus ui-state-focus",buttonsImageStateOverride:"ui-igedit-buttonsimagestateoverride",disabled:"ui-igedit-disabled ui-state-disabled",negative:"ui-igedit-negative",nullValue:"ui-igedit-nullvalue",button:"ui-igedit-button",buttonRtl:"ui-igedit-button-rtl",buttonFocus:"ui-igedit-buttonfocus",buttonDefault:"ui-igedit-buttondefault ui-state-default",buttonHover:"ui-igedit-buttonhover ui-state-hover",buttonPressed:"ui-igedit-buttonpressed ui-state-highlight",buttonDisabled:"ui-igedit-buttondisabled ui-state-disabled",buttonImage:"ui-igedit-buttonimage ui-icon-triangle-1-s ui-icon",buttonClear:"ui-igedit-buttonclear",buttonClearImage:"ui-igedit-buttonimage ui-icon-circle-close ui-icon",buttonImageHover:"ui-igedit-buttonimagehover",buttonImagePressed:"ui-igedit-buttonimagepressed",buttonImageDisabled:"ui-igedit-buttonimagedisabled",spinButton:"ui-igedit-spinbutton",spinButtonImage:"ui-igedit-buttonimage ui-igedit-spinbuttonimage",spinLowerImage:"ui-igedit-spinlowerimage ui-icon-carat-1-s ui-icon",spinLowerImageHover:"ui-igedit-spinlowerimagehover",spinLowerImagePressed:"ui-igedit-spinlowerimagepressed",spinLowerImageDisabled:"ui-igedit-spinlowerimagedisabled",spinUpperImage:"ui-igedit-spinupperimage ui-icon-carat-1-n ui-icon",spinUpperImageHover:"ui-igedit-spinupperimagehover",spinUpperImagePressed:"ui-igedit-spinupperimagepressed",spinUpperImageDisabled:"ui-igedit-spinupperimagedisabled",dropDown:"ui-igedit-dropdown",list:"ui-igedit-list ui-widget ui-widget-content ui-corner-all",listItem:"ui-igedit-listitem ui-state-default",listItemHover:"ui-igedit-listitemhover ui-state-hover",listItemSelected:"ui-igedit-listitemselected ui-state-highlight",listItemColumnBorder:"ui-igedit-listitemcolumnborder",noTopCorners:"ui-igedit-no-top-corners",noBottomCorners:"ui-igedit-no-bottom-corners"},regional:$.ig._regional||{},_create:function(type){var v,css=this.css,elem,field,align,oldCss,o=this.options,me=this,val=o.value;type=this._doType(_aNull(type)?o.type:type,val);if(typeof o.maxLength!=="number"){o.maxLength=0}if(typeof o.spinDelta!=="number"){o.spinDelta=1}o.nullable=o.nullable!==false;this._listID=-1;this._css=css.field;elem=this._element=this._render(this.element,o,css);if(o.display){elem.css("display",o.display)}if(type===3&&(!$.datepicker||this._ta)){throw new Error("The ui.igDatePicker depends on jquery.ui.datepicker and TEXTAREA/multiline is not supported")}if(this._ta){this._css+=" "+css.textArea}field=this._field;this._box=field[0].type==="checkbox";this._1e=field===elem;if(o.readOnly){field[0].readOnly="readonly"}align=o.textAlign;if(!align&&type>3){align="right"}if(align){field.css("textAlign",align)}field[0]._id=-1;field[0].disabled=o.disabled;this._hover=this._mouseDown=0;this._fix=1;this._fcs=-1;this._bad=0;this._k0=this._sel0=0;this._noPaste=0;this._fixMode(1);this._clearHide=false;me._evts=v={keydown:function(e){me._onEvt(e,0)},keypress:function(e){me._onEvt(e,1)},keyup:function(e){me._onEvt(e,2)},paste:function(e){me._onEvt(e,11)},beforecut:function(e){me._onEvt(e,11)},cut:function(e){me._onEvt(e,11)},drop:function(e){me._onEvt(e,11)},focus:function(e){me._onEvt(e,8)},blur:function(e){me._onEvt(e,9)}};field.bind(v);me._mEvts=v={mousedown:function(e){me._onEvt(e,3)},mouseup:function(e){me._onEvt(e,4)},mousemove:function(e){me._onEvt(e,5)},MSPointerOver:function(e){me._onEvt(e,26)},pointerover:function(e){me._onEvt(e,26)},mouseover:function(e){me._onEvt(e,6)},mouseleave:function(e){me._onEvt(e,7)}};if(this._buttons&&this._buttons[1]){v.DOMMouseScroll=function(e){me._onEvt(e,10)};v.mousewheel=function(e){me._onEvt(e,10)}}elem.bind(v);this._fcs=0;v=o.maxLength;if(v&&v>0){field[0].maxLength=v}v=o.tabIndex;if(!_aNull(v)){field[0].tabIndex=v}v=o._vsFormat;if(v&&val&&type>3&&typeof val!=="number"){val=parseFloat(this._txtAsNum(val.toString(),v,"-"))}this._setVal(_aNull(val)?this._value:val);if(this._val()===""){this._text=this._field[0].value=this._focTxt("",false,"")}this._fixCss();oldCss=this._oldCss;val=o.height;if(!val&&!this._1e){val=oldCss.height;if(val){val=val.indexOf("px")>0?_int(val):this.element.height()}}this._height(val);if(this._box){this._fixBC(field,field)}val=o.width;if(!val&&!this._1e){val=oldCss.width;if(val){val=val.indexOf("px")>0?_int(val):this.element.width()}}if(this._selElem){delete oldCss.width;delete oldCss.height}this._width(val);this._lastText=this._val();this._initValidator();this._doClear(o.value)},_doType:function(type,val){if(type==="text"){type=0}if(type==="mask"){type=1}if(type==="date"){type=2}if(type==="datepicker"){type=3}if(type==="numeric"){type=4}if(type==="currency"){type=5}if(type==="percent"){type=6}if(typeof type!=="number"||type<0||type>6){if(typeof val==="number"){type=4}else if(val&&val.getMonth){type=2}else{type=0}}this._type=type;return type},_render:function(elem,o,css){var spin,name,par,csso,inp,cont,oldC,oldA,i,obj,img,clear,buts,butCss,left=elem.css("direction")==="rtl",but=o.button,field=elem,sel=null;name=elem[0].nodeName;par=elem[0].parentNode;if(name){name=name.toUpperCase()}this._ta=name==="TEXTAREA";this._td=name==="TD";this._left=left;inp=name==="INPUT";sel=this._selElem=name==="SELECT";spin=but&&but.indexOf("spin")>=0;clear=but&&but.indexOf("clear")>=0;but=but&&but.indexOf("dropdown")>=0||sel&&!spin;if(clear||but||spin){buts=this._buttons=[]}cont=buts||o.renderInContainer||o.theme;oldC=this._oldCss={display:0};oldA=this._oldAttr={className:0,title:0};if(inp){oldA.value=0;inp=elem[0].type||"text";if(inp==="date"||inp==="number"){elem[0].type="text";oldA.type=inp}}else if(sel){sel=o.listItems;if(!sel){o.listItems=[];sel=elem[0].options;i=sel?sel.length:0;if(i>0){while(i-->0){obj=sel[i].value;img=sel[i].text;o.listItems[i]={value:obj,text:_aNull(img)?obj:img}}this._listID=elem[0].selectedIndex}sel=1}}else{oldA.innerHTML=0}if(inp||this._ta){oldA.disabled=oldA.readOnly=oldA.alt=oldC.textAlign=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;oldC.height=elem[0].style.height;i=inp?oldA.value:sel?elem.val():oldA.innerHTML;if(i===o.nullText){i=""}if(!this._ta&&i){i=i.replace(/[\x09\x0a]/g,"")}this._value=i;if(inp||this._ta||sel){if(oldA.className){this._css+=" "+oldA.className}if(cont){this._swap=true;elem.css("display",sel?"none":"");elem=$("<span />");par.insertBefore(elem[0],field[0]);if(sel){field=$("<input />")}else{par.removeChild(field[0])}elem.css("display",oldC.display)}else{this._css+=" "+css.editor;this._field=elem;return this._field}}else{if(o.textMode==="textarea"||o.textMode==="multiline"){field=$("<textarea />");this._ta=1}else{field=$(o.textMode?'<input type="'+o.textMode+'"/>':"<input />")}elem[0].innerHTML=""}elem.addClass(css.editor+" "+css.container);if(o.theme){elem.addClass(o.theme)}this._field=field;butCss=css.button+" "+css.buttonDefault;if(left){butCss+=" "+css.buttonRtl;this._css+=" "+css.fieldRtl}i=buts?-1:6;inp=this;this._touchEvts={touchstart:function(e){inp.__touch=1;this._drag=null;_stop(e)},touchmove:function(e){this._drag=1;_stop(e)},touchend:function(){if(!this._drag){$(this).trigger("mousedown").trigger("mouseup")}}};while(i++<4){if(but&&i===0||clear&&i===3||spin&&(i===1||i===2)){if(i===0){csso=[butCss,css.buttonHover,css.buttonPressed,css.buttonDisabled,css.buttonImage,css.buttonImageHover,css.buttonImagePressed,css.buttonImageDisabled];sel="button"}else if(i===1){csso=[butCss+" "+css.spinButton,css.buttonHover,css.buttonPressed,css.buttonDisabled,css.spinButtonImage+" "+css.spinUpperImage,css.spinUpperImageHover,css.spinUpperImagePressed,css.spinUpperImageDisabled];sel="spinUpper"}else if(i===2){csso=[butCss+" "+css.spinButton,css.buttonHover,css.buttonPressed,css.buttonDisabled,css.spinButtonImage+" "+css.spinLowerImage,css.spinLowerImageHover,css.spinLowerImagePressed,css.spinLowerImageDisabled];sel="spinLower"}else{csso=[butCss+" "+this.css.buttonClear,css.buttonHover,css.buttonPressed,css.buttonDisabled,css.buttonClearImage,css.buttonImageHover,css.buttonImagePressed,css.buttonImageDisabled];sel="clear"}obj=buts[i]=$("<span />").addClass(csso[0]).appendTo(elem).bind(this._touchEvts);obj[0]._css=csso;obj[0].longdesc=obj[0].title=this._optVal(sel+"Title",1);img=$("<span />").addClass(csso[4]).appendTo(obj);img[0]._id=i+5;obj[0]._id=i+1}}field.appendTo(elem);return elem},_leftShift:function(){var left=0,buts=this._buttons,i=this._left&&buts?4:0;while(i-->0){if(buts[i]){left+=buts[i][0].offsetWidth}}return left},_val:function(){var field=this._field;return field?this._box?field[0].checked:this._nullT?"":field[0].value:""},_fixNull:function(){var txt,nullTxt=this.options.nullText;if(!this._field||!nullTxt&&!this._nullT){return}txt=this._val();this._nullT=null;if(txt===""&&typeof nullTxt==="string"&&this._fcs<2){this._nullT=true;this._field[0].value=nullTxt}this._fixCss()},_focTxt:function(txt,foc,e){var nt=this.options.nullText;this._nullT=null;if(!foc&&txt===""&&nt&&(!_aNull(e)||this.options.readOnly)){txt=nt;this._nullT=true}return txt},validate:function(noLabel){return!this.options.validatorOptions||!this._doInvalid(null,noLabel?2:1)},isValid:function(){return!this._doInvalid(null,9)},_doInvalid:function(e,flag){if(!this._field){return}var ch,i,old,fixVal,val=this._val(),cancel=false,fac=1,inv=this._invPlus,o=this.options,type=this._type;this._inv=null;if(inv){i=0;fixVal=type}else if(o.required&&(!val||type===1&&!this.getValueByMode(0,"",1))){inv=1;fixVal=type}else if(type===0){if(!o.nullable&&!val){inv=1}}else if(type===1){val=this._txt;i=val.length;while(i-->0&&!inv){ch=val.charCodeAt(i);if(ch<21&&ch%2===1){val=this._getVal();inv={value:val,message:this._optVal("mask",2)}}}}else if(type<4){val=this._toDate(val,e==="",true,true);inv=this._inv}else{val=this._toNum(val,true,true);inv=this._inv;fac=this._prop(7);if(inv&&val&&fac>1){old=val;val/=fac;inv.value=val}}if(fixVal===1){val=this._txt}else if(fixVal){val=fixVal<4?this._toDate(val,e==="",true,true):this._toNum(val,true,true)}if(inv===1){val=null;inv={value:val,message:this._optVal("required",2)}}if(typeof inv==="string"){inv={value:val,message:inv}}if(flag===9){return inv}if(inv){cancel=this._fire(13,null,inv);if(val!==inv.value){val=inv.value;inv=null}if(old){if(inv){val=old}else{if(_aNull(val,1)){val=null}else if(val){val*=fac}}}if(type<=1&&!inv){this._setVal(val);return}}if(type>1&&type<4){this._isNull=_aNull(val);if(!this._isNull){this._date=val}if(val&&o.useLastGoodDate){this._goodD=val}}this._value=val;if(flag&&!cancel&&!this._setOpt){return this._doError(flag,null,inv?inv.message:null)}},_focusTxt:function(foc,e,txt0){var e0=e,txt="",o=this.options,type=this._type,d=null,prompt="";if(type===1){txt0=null;if(!_aNull(e)&&!foc){e=e!=="";if(e&&this._bad!==0){this._txt=this._setTxt(this._val(),5,true)}txt0=this._txt;if(!e){this._doInvalid(e0)}}txt=this._getTxt(foc?5:4,foc?o.promptChar:o.padChar,txt0)}else if(type===2||type===3){if(_aNull(txt0)){prompt=o.promptChar;if(_aNull(e)&&foc){return this._getTxt(5,prompt)}if(!_aNull(e)&&!foc){this._doInvalid(e);d=this._value}else if(!this._isNull){d=this._date}}else{d=this._toDate(txt0,foc,true)}txt=this._toTxt(d,foc,prompt,!_aNull(e))}else if(type>3){if(!_aNull(e)&&!foc){this._doInvalid()}txt=this._toTxtNum(this._value,foc)}else{txt=this._val();if(!_aNull(e)&&!foc){this._doInvalid(e)}}return this._focTxt(txt,foc,e)},_repaint:function(){if(this._field&&this._val()!==this._text){this._field[0].value=this._text}},_instant:function(p1,limit,f){var val,type=this._type,mode=this._dataMode;if(this._box){return this._val()}if(type===1){return this.getValueByMode(mode,p1,limit)}if(type===2||type===3){return this.getValueByMode(p1?0:mode,limit)}if(type>3){val=this._toNum(this._val(),limit);if(val&&(limit||f)&&!isNaN(val)&&mode>0){val/=this._prop(7)}return p1||mode>0?val:this._toTxtNum(val,mode===0)}return this._val()},_optVal:function(key,flag){var val=this._validator,o=this.options;if(flag===2){return val?val._loc(key):""}val=o[key];if(!_aNull(val)){return val}if(flag===3||flag===1){if(flag===1&&this._type===3){key="datePickerButtonTitle"}val=o.locale?o.locale[key]:null;return val||($.ig&&$.ig.Editor&&$.ig.Editor.locale?$.ig.Editor.locale[key]:null)||""}o=o.regional;if(typeof o==="string"){o=$.ig.regional[o]}if(o){val=o[key]}if(!o||_aNull(val)){val=$.ig.regional.defaults[key]}return _aNull(val)?this.regional[key]:val},_setOption:function(key,val){var v,old=val,dp=null,o=this.options,loc=key==="locale",reg=key==="regional",buts=this._buttons,field=this._field;if(o[key]===val||key==="textMode"||!field){return this}if(key==="buttonHidden"){this._butVis(null,val);return this}if(key==="theme"){if(this._1e){return this}for(v=0;v<3;v++){if(buts&&buts[v]){buts[v].css("height","")}}if(o.theme){this._element.removeClass(o.theme)}if(val){this._element.addClass(val)}this._listRemove();this._height(o.height);this._width(o.width)}if(key==="inputMask"&&this._type===1){old=this.getValueByMode(0," ",1);this._setMask(val);this._setTxt(old,0)}o[key]=val;if(typeof val==="function"){return this}if(reg&&this._dp){dp=this._dpRegion();if(dp){v=o.datepickerOptions=$.extend(o.datepickerOptions,dp);this._dpOption(v)}}v="buttonTitle";if((loc||key===v)&&buts&&buts[0]){buts[0][0].title=this._optVal(v,1)}v="spinUpperTitle";if((loc||key===v)&&buts&&buts[1]){buts[1][0].title=this._optVal(v,3)}v="spinLowerTitle";if((loc||key===v)&&buts&&buts[2]){buts[2][0].title=this._optVal(v,3)}v="clearTitle";if((loc||key===v)&&buts&&buts[3]){buts[3][0].title=this._optVal(v,3)}if(key==="disabled"){field[0].disabled=val;this._fixCss()}if(key==="display"){this._element.css(key,val)}if(key==="textAlign"){field.css(key,val)}if(key==="readOnly"){field[0].readOnly=val?"readonly":""}if(key==="maxLength"||key==="tabIndex"){field[0][key]=val}if(key==="value"){this.value(val)}if(key==="width"){this._width(val)}if(key==="height"){this._height(val)}v=key==="required";if(key==="validatorOptions"||v){this._initValidator(false,v)}if(key==="nullText"){this._fixNull()}if(key==="type"){this._doType(val);reg=3}key=key.toLowerCase();v=key.indexOf("minv")===0?1:key.indexOf("maxv")===0?2:key.indexOf("maxd")>=0||key.indexOf("mind")>=0?-1:0;if(key.indexOf("list")===0){this._listRemove()}else if(key.indexOf("an")===0){if(this._dp&&key.indexOf("show")>7){this._dpOption(key.indexOf("eff")>7?"showAnim":"duration",val)}}else if(key.indexOf("kero")>0){if(this._dp){this._dpOption(val)}}else if(key.indexOf("data")>=0||v||reg||!_aNull(this.regional[key])||key.indexOf("date")===0||key.indexOf("pat")>=0||key.indexOf("roup")>0||key.indexOf("sep")>=0||key.indexOf("ymb")>0){if(v>0&&this._dp){dp=$.data(field[0],"datepicker");if(dp){dp.settings[v===1?"minDate":"maxDate"]=null}}this._setOpt=true;this._listRemove();this._fixMode(reg===3?3:0);this._repaint();this._lastText=this._val();this._setOpt=null}return this},_dpRegion:function(){var reg=this.options.regional;return $.datepicker&&typeof reg==="string"?$.datepicker.regional[reg==="defaults"||reg==="en-US"?"":reg]:null},_dpOption:function(val,p){var old=this._getVal(1);if(val&&val.changeYear&&$.ig.util.isOpera){val.changeYear=false}this._field.datepicker("option",val,p);this._setVal(old)},getRegionalOption:function(name){return this._optVal(name)},field:function(){return this._field},mainElement:function(){return this._element},dropDownElement:function(){var el=this._ddList;if(this._type===3){el=$.datepicker;if(el){el=el._ig_dp===this?el.dpDiv:null}}return el||null},show:function(){return this._vis(true)},hide:function(){return this._vis()},remove:function(){var p,e=this._element;p=e&&e[0]?e[0].parentNode:null;if(p&&p.tagName){this._doError();this._doDrop();this._stopTimer();this._hadFocus=null;this._vAct();this._noPaste=this._fcs=this._k0=this._hover=this._mouseDown=0;this._fixCss();p.removeChild(e[0])}return this},dropDownVisible:function(showHide){if(!arguments.length){return!!this._ddOn}if(!showHide){this._doDrop()}else if(!this._ddOn){this._doDrop(1)}return this},findListItemIndex:function(text,ignoreCase,partial,contains){var item=this._find(_str(text),0,1,ignoreCase,partial,contains);return item?item.id:-1},addListItems:function(items,index){return this._listChange(items,index,2)},addListItem:function(item,index){return this._listChange([item],index,2)},removeListItem:function(item){return this._listChange(item,-1,1)},removeListItemAt:function(index){return this._listChange(null,index,1)},clearListItems:function(){return this._listChange(null,-1,0)},selectedListIndex:function(index){if(!arguments.length){return this._listID}this._listSelect(index)},getSelectedListItem:function(){var list=this.options.listItems,id=this._listID;return list&&id>=0?list[id]:null},hasInvalidMessage:function(){return this._validator?this._validator.isMessageDisplayed():false},validator:function(){return this._validator||null},text:function(val,flag){if(val===undefined){return this._val()}if(this._type>0){this._sTxt=1;if(this._type===1){this._setTxt(val,_aNull(flag)?5:1e3+flag)}else{this._setVal(val,true)}this._sTxt=0}else{if(val){this._nullT=null}this._text=val;this._repaint()}if(this._fix===1){this._old=this._instant(1,null,1)}return this},_df:function(date,f,val,h,m,s,ms){var utc=this.options.enableUTCDates;if(f===-1){return date&&utc?new Date(date.getTime()+date.getTimezoneOffset()*6e4):date}if(!date){date=new Date;if(utc){date.setUTCMinutes(date.getUTCMinutes()-date.getTimezoneOffset())}return date}if(!_aNull(h)){return utc?new Date(Date.UTC(date,f,val,h,m,s,ms)):new Date(date,f,val,h,m,s,ms)}if(_aNull(val)){if(f===0){return utc?date.getUTCFullYear():date.getFullYear()}if(f===1){return utc?date.getUTCMonth():date.getMonth()}if(f===2){return utc?date.getUTCDate():date.getDate()}if(f===3){return utc?date.getUTCHours():date.getHours()}if(f===4){return utc?date.getUTCMinutes():date.getMinutes()}if(f===5){return utc?date.getUTCSeconds():date.getSeconds()}return utc?date.getUTCMilliseconds():date.getMilliseconds()}if(f===0){if(utc){date.setUTCFullYear(val)}else{date.setFullYear(val)}}if(f===1){if(utc){date.setUTCMonth(val)}else{date.setMonth(val)}}if(f===2){if(utc){date.setUTCDate(val)}else{date.setDate(val)}}if(f===3){if(utc){date.setUTCHours(val)}else{date.setHours(val)}}if(f===4){if(utc){date.setUTCMinutes(val)}else{date.setMinutes(val)}}if(f===5){if(utc){date.setUTCSeconds(val)}else{date.setSeconds(val)}}if(f===6){if(utc){date.setUTCMilliseconds(val)}else{date.setMilliseconds(val)}}},value:function(val){if(val===undefined){val=this._getVal();return val===undefined?null:val}this._setVal(val,true);this._lastText=this._val();return this},_getVal:function(numDate){var o=this.options,val=this._instant(numDate,1);if(this._type>3){if(_aNull(val)){val=o.nullValue;if(this._dataMode<=0){return _str(val)}return o.nullable||!_aNull(val)?val:NaN}}return val},_set_val:function(val,obj){this._fix=0;this._setVal(val,obj);this._fix=1},_setVal:function(val,obj){var txt,max,type=this._type;if(!this._field){return}if(this._box){if(val!==true){val=val==="true"}this._field[0].checked=val}else if(type===1){this._setTxt(_str(val),this._dataMode)}else if(type===2||type===3){if(!_aNull(val)&&!val.getTime){val=val.toString();val=obj=this._toDate(val,this._dataMode<2)||this._toDate(val,true)}obj=val;val=this._limits(val);if(_aNull(val)){val=obj}this._txt=this._mask;this._isNull=_aNull(val);if(!this._isNull){this._toTxt(val,true,"",true)}else{val=this._df()}this._date=val;if(this.options.useLastGoodDate){this._goodD=val}this._text=this._focusTxt(this._fcs>1);this._repaint()}else if(type>3){if(_aNull(val,1)){val=null}if(val&&typeof val==="number"&&this._fix!==0){val*=this._prop(7)}val=this._toNum(val,true);txt=this._toTxtNum(val,this._fcs===2);max=this._prop(12);if(obj===2&&max>0&&txt.length>max){return}this._focTxt(txt);this._text=txt;this._value=val;this._repaint();this._fixCss()}else{this.text(_str(val))}if(this._fix===1&&type>0){this._old=this._instant(1,null,1)}txt=this.options.value=this._getVal();this._doClear(txt);this._fixNull();this._dtt();this._fixList(txt)},_fixList:function(val){var i=-1,list=this.options.listItems,len=list?list.length:0;if(len<1||!this._fix||_aNull(this._lastText)){return}if(!_aNull(val)){while(++i<len){if(list[i]===val){break}}if(i>=len){list=this._findItem(this._val(),-1);i=list?list.id:-1}}this._listSelect(i)},_doClear:function(val){if(this._buttons&&this._buttons[3]){this._butVis(!val||this._type<4&&!this.getValueByMode(0,val))}},_vis:function(show){var e=this._element;e.css("display",show?this.options.display:"none");this._fixHeight();this._doError();return this},_elemWidth:function(elem,val){if(elem&&val>1&&elem[0]._wd!==val){elem[0]._wd=val;val=Math.max(1,val-_pad_bdr(elem,1));elem.css("width",val);return true}},_elemHeight:function(elem,val,but){if(elem&&val>1&&elem[0]._ht!==val){elem[0]._ht=val;val=Math.max(1,val-_pad_bdr(elem));elem.css("height",val);if(but){elem.find("SPAN").css("marginTop",Math.floor((val-16)/2))}}},_fixSize:function(){var o=this.options,elem=this._element,width=elem?elem[0].offsetWidth:0,height=elem?elem[0].offsetHeight:0;if(width||height){if(this._oWidth!==width){this._fixWidth(!this._oWidth&&!o.width)}if(this._oHeight!==height){this._fixHeight(!this._oHeight&&!o.height)}this._oWidth=width;this._oHeight=height}this._doTimer()},_doTimer:function(){var me=this,timer=me._timer1,ok=me._heightOk&&!me._heightPerc&&me._widthOk&&!me._widthPerc;if(ok&&timer){clearInterval(timer);delete me._timer1}else if(!timer){me._timer1=setInterval(function(){me._fixSize()},200)}},_fixHeight:function(zero){if(!this._field||this._1e||this._heightOk&&!this._heightPerc){return 1}var field=this._field,elem=this._element,i=4,height=this._td||zero?0:Math.max(elem[0].offsetHeight-_pad_bdr(elem),0),buts=this._buttons;height=height||field[0].offsetHeight;if(height>1){if(this._heightPerc){height++}this._elemHeight(field,height);if(buts){while(i-->0){this._elemHeight(buts[i],height,1)}}this._heightOk=1}this._doTimer()},_fixWidth:function(zero){if(!this._field||this._1e||this._widthOk&&!this._widthPerc){return 1}var v,left,but,field=this._field,clearHide=this._clearHide,buttonHide=this.options.buttonHidden,elem=this._element,i=4,width=this._td||zero?0:Math.max(elem[0].offsetWidth-_pad_bdr(elem,1),0),minWidth=width,minField=3,buts=this._buttons;width=width||field[0].offsetWidth;if(width>0){if(buts){zero=this._td||zero?Math.max(width,100):0;width=zero||width;if(this._widthPerc||this._td){width--}while(i-->0){but=buts[i];if(but){if(i===0&&buttonHide||i===3&&clearHide){but.show()}but[0]._w=v=but[0].offsetWidth;if(zero&&!left){width-=v;left=zero=zero-v}width-=v;if(width<minField&&!zero){minWidth+=minField-width;left=width=minField}if(i===0&&buttonHide||i===3&&clearHide){but.hide()}}}if(zero||left){elem.css("width",zero||minWidth+minField)}}else if(zero&&elem[0].offsetWidth>width+4){elem.css("width",width)}this._wF=width;if(this._elemWidth(field,width)){this._listRemove()}i=v=buts?Math.min(width,9):0;while(v-->1&&i>3){left=field[0].offsetTop;for(i=0;i<4;i++){if(buts[i]&&Math.abs(buts[i][0].offsetTop-left)>10){this._elemWidth(field,--this._wF);break}}}if(buts){v=$.ig.util.isFF||$.ig.util.isIE?3:1;this._wF-=v;this._elemWidth(field,this._wF)}this._widthOk=1;this._butVis(clearHide,buttonHide)}this._doTimer()},_butVis:function(clear,dropdown){var but,i=-1,o=this.options,width=this._wF,buts=this._buttons,field=this._field;if(_aNull(clear)){but=1;clear=this._clearHide}if(_aNull(dropdown)){but=1;dropdown=o.buttonHidden}if(!buts||but&&clear===this._clearHide&&dropdown===o.buttonHidden){return}o.buttonHidden=dropdown;this._clearHide=clear;while(++i<2){but=buts[i*3];if(but){if(!i&&dropdown||i&&clear){but.hide();width+=but[0]._w}else{but.show();width-=but[0]._w}}}this._elemWidth(field,width)},_width:function(width){var field=this._field,elem=this._1e||this._td?field:this._element,buts=this._buttons,i=buts?4:0,val=_int(width);if(!field){return}if(this._widthOk){delete this._widthOk;delete this._widthPerc;elem[0]._wd=null;field[0]._wd=null;elem.css("width","");field.css("width","");while(i-->0){if(buts[i]){buts[i][0]._wd=null;buts[i].css("width","")}}}if(width){if(width.indexOf&&width.indexOf("px")<0&&width!==val.toString()){elem.css("width",width);this._widthPerc=!this._td&&width.indexOf("%")>0}else{this._elemWidth(elem,val)}}this._fixWidth(!width)},_height:function(height){var field=this._field,elem=this._1e||this._td?field:this._element,buts=this._buttons,i=buts?4:0,val=_int(height);if(!field){return}if(this._heightOk){delete this._heightOk;delete this._heightPerc;elem[0]._ht=null;field[0]._ht=null;elem.css("height","");field.css("height","");while(i-->0){if(buts[i]){buts[i][0]._ht=null;buts[i].css("height","")}}}if(height){if(height.indexOf&&height.indexOf("px")<0&&height!==val.toString()){elem.css("height",height);this._heightPerc=!this._td&&height.indexOf("%")>0}else{this._elemHeight(elem,val)}}this._fixHeight(!height)},_spin:function(delta){var sel,fac,txt,nul=this._nullT,o=this.options;if(this._box||!this._field){return}if(this._fcs<1&&o.focusOnSpin){this.setFocus();if(this._fcs<1){this._focSpin=delta;return}}if(this._fire(14,null,delta)){return}if(nul){this._nullT=null;this._fixCss()}txt=this._val();this.spin(delta);if(this._val()===txt){if(nul){this._nullT=nul;this._fixCss();return}if(this._type>3&&o.spinWrapAround&&!_aNull(this._prop(10))&&!_aNull(this._prop(11))){sel=this._sel0;fac=this._prop(7);if(!fac){fac=1}delta=this._limits(this._getVal(true)*fac,true);this._setVal(delta/fac,this._fcs);this.select(sel)}}if(this._val()!==txt){this._fire(12)}},_item:function(item){if(item&&!_aNull(item.text)){item=item.text}if(typeof item==="function"){item=item()}return _aNull(item)?"":item},_spinList:function(delta){var val,id,roll,len,list,o=this.options;list=o.listItems;len=list?list.length:0;if(len<1){return 1}delta=delta<0?1:-1;id=this._listID+delta;roll=o.spinWrapAround;if(id>=len){if(!roll){return}id=0}if(id<0){if(!roll){return}id=len-1}val=this._instant(1,null,1);if(val===this._item(list[id])){id+=delta;if(id<0){if(!roll){return}id=len-1}if(id>=len){if(!roll){return}id=0}}val=this._item(list[id]);if(!this._listSelect(id)){delete this._lastY;this._set_val(val)}},_doKey:function(k,ch,txt,len,sel0,sel1,bad,e){var maxDec,iDot,d09,ok,dot,min,decSep,minus,mask,ePow,maxLen=this._prop(12),type=this._type;if(type>0&&type<4){mask=this._mask;len=mask?mask.length:0;if(len<1||k<7||k>8&&k<32){k=0}if(bad){if(k===0||!(mask.indexOf(ch)>0||this._optVal("am").indexOf(ch)>=0||this._optVal("pm").indexOf(ch)>=0||k>=48&&k<=57)){_stop(e)}return}if(k===0){return}txt=this._txt;if(sel0!==sel1){while(--sel1>=sel0){txt=txt.substring(0,sel1)+mask.charAt(sel1)+txt.substring(sel1+1)}sel1++}else if(k===7){while(sel1<len&&mask.charCodeAt(sel1)>=22){sel1++}if(sel1>=len){return}txt=txt.substring(0,sel1)+mask.charAt(sel1)+txt.substring(sel1+1);sel1++}else if(k===8){while(sel1>0&&mask.charCodeAt(sel1-1)>=22){sel1--}if(sel1--<1){return}txt=txt.substring(0,sel1)+mask.charAt(sel1)+txt.substring(sel1+1)}if(k>8&&sel1<len){if(sel1>=len){return}sel0=this._maskKey(k,ch,txt,len,sel1,mask);if(sel0>=0){txt=this._txt;sel1=sel0}else{if(sel0===-1){return}while(mask.charCodeAt(sel1)>=22){if(++sel1>=len){return}}ch=this._maskFilter(mask.charCodeAt(sel1),ch,0);if(_aNull(ch)){return}txt=txt.substring(0,sel1)+ch+txt.substring(sel1+1);sel1++}}this._txt=txt;this._selKey=sel1;txt=this._focusTxt(true);this.select(this._selKey,0,txt);this._selKey=99999;this._listSelect(-1);return}if(type>3){decSep=this._prop(4);minus=this._isMinus(k);d09=k>=48&&k<=57;if(minus&&sel0===0){min=this._prop(10);if(!_aNull(min)&&min>=0){return _stop(e)}}if(bad){if(!(k<9||minus||d09||k===decSep.charCodeAt(0))){_stop(e)}return}if(sel0!==sel1){txt=txt.substring(0,sel0)+txt.substring(sel1);sel1=sel0;len=txt.length}else if(k===7){if(sel1++>=len||len<1){return}}else if(k===8){if(sel0--<1){return}}if(k<9||maxLen===0||maxLen>len){dot=k===decSep.charCodeAt(0);iDot=txt.indexOf(decSep);maxDec=this._prop(8);ok=d09||sel0===0&&minus||dot&&maxDec>0;ePow=this._ePow();mask=ePow?txt.indexOf(ePow):-1;if(ePow&&sel0>0){if((k===69||k===101)&&mask<0){ok=ch=ePow}if(dot&&mask>=0&&mask<sel0){ok=false}}if(mask<0&&d09&&iDot>=0&&sel0>iDot&&iDot+maxDec<len){if(sel0===len){ok=false}else{txt=txt.substring(0,--len)}}if(sel0>0&&minus&&txt.charAt(sel0-1).toUpperCase()==="E"&&txt.substring(sel0-1).indexOf("-")<0){ok=true}if(len>0&&sel0===0){if(this._isMinus(txt.charCodeAt(0))){ok=false}}if(k>8&&!ok){return}if(dot){if(iDot>=0){if(iDot===sel0||iDot===sel0-1){return}len--;if(iDot<sel0){sel0=--sel1}txt=txt.substring(0,iDot)+txt.substring(iDot+1)}if(mask<0&&sel0+maxDec<len){len=sel0+maxDec;txt=txt.substring(0,len)}}if(k>8&&sel1>=len){txt+=ch}else{txt=txt.substring(0,sel0)+ch+txt.substring(sel1)}}else{k=0}this.select(k>10?sel1+1:sel0,0,txt);this._listSelect(-1);return}if(sel0!==sel1){txt=txt.substring(0,sel0)+txt.substring(sel1);sel1=sel0;len=txt.length}else if(k===7){if(sel1++>=len||len===0){return}if(this._ta&&txt.charCodeAt(sel1-1)===13&&txt.charCodeAt(sel1)===10){sel1++}}else if(k===8){if(sel0--<1){return}if(this._ta&&txt.charCodeAt(sel0)===10&&txt.charCodeAt(sel0-1)===13){sel0--}}if(k<9||maxLen===0||maxLen>len){if(k>8&&sel1>=len){txt+=ch}else{txt=txt.substring(0,sel0)+ch+txt.substring(sel1)}}else{k=0}this._matchList(txt,k,k>10?sel1+1:sel0)},_matchList:function(txt,key,sel){var item;if(!this._field||this._type>0||key<0&&!this.options.listAutoComplete){return txt}item=this._findItem(txt,key,sel);if(!item){return null}this._listSelect(item.id);txt=item.text;if(key>=0){this.select(item.sel,0,txt)}else{this._field[0].value=txt}return txt},_findItem:function(txt,key,sel){var o=this.options;return this._find(txt,key,o.listMatchOnly,o.listMatchIgnoreCase,true,o.listMatchContains,sel)},_find:function(txt,key,matchOnly,noCase,partial,contains,sel){var item,up,part,inside=null,i=-1,many=0,shift=0,id=-1,str=txt,len=txt.length,items=this.options.listItems,match=key>=0&&matchOnly;if(len>0&&items&&(match||key<0)){part=match=-1;up=noCase;if(up){str=str.toUpperCase()}while(++i<items.length){item=this._item(items[i]);if(_aNull(item)){continue}item=item.toString();if(up){item=item.toUpperCase()}shift=item.indexOf(str);if(shift===0){if(item===str){match=i;break}many++;if(part<0){part=i}}else if(shift>0&&contains){if(!inside){inside={i:i,shift:shift}}many++}}shift=0;if(part<0&&inside){part=inside.i;
shift=inside.shift}if(match<0){if(!partial){return null}if(key<0){match=part}else if(part<0){return key>10&&len===sel?null:this._find(txt.substring(0,--len),key,matchOnly,noCase,contains,sel)}if(key>10&&many===1){match=part}else if(key>=0){txt=this._item(items[part]).toString().substring(0,len+shift)}}if(match>=0){txt=this._item(items[match]).toString();if(match===part){sel=txt.length}}id=match>=0?match:part}return{text:txt,id:id,sel:(_aNull(sel,1)?len:sel)+shift}},_undo:function(redo){var old,val=this._old;if(redo){if(!this._canRedo){return}val=this._redo;this._canRedo=false}else{old=this._instant(1,null,1);if(old===val){return}this._canRedo=true;this._redo=old}this._set_val(val);this._text=this._focusTxt(false);this._doError(1,this._evt)},_doKey0:function(e,a){var ch,up,len,excl,incl,bad=this._validator,me=this,t0=this._text,t1=this._val(),k=this._key,o=this.options;if(o.excelNavigationMode&&a!==1&&(k===38||k===40)){return}if(!this._field){return}if(!e){if(t0!==t1){this.paste(t1)}return}if(a===1&&k===192&&e.altKey&&!e.ctrlKey){return}if(a===1&&this._bad&&this._k0===229){this.getSelectedText();this._bad=0}if(this._type>0&&$.ig.util.isOpera&&k>41&&k<48){if(a===0){this._noKey=k}else if(this._noKey===k){_stop(e)}}if(a!==1){this._noPaste=2-a}else if(this._noPaste!==2){this._noPaste=1}if(k===9){this._k0=a===2?0:9;if(a===0&&bad&&bad._lbl){bad._onTab(e)}}if(k===0||k===114&&a!==1||k===9){return}if(this._bad>2){if(a===0){this._bad=2}if(a===2){this._bad-=3}}if(a===0&&k===229){if(t0!==t1){this._bad=2}else{this._bad+=3}}if(k===13&&this._k0===229&&this._type===1){this._txt=this._setTxt(this._val(),5,true)}if(a===0&&e.ctrlKey&&!e.altKey&&(k===90||k===89)){this._undo(k===89);return}if(this._bad===2||a===1&&e.ctrlKey){return}if(a===0&&!e.ctrlKey&&!e.altKey&&!e.shiftKey){if(this._listKey(e,k)){this._kBad=k;return _stop(e)}}if(this._box){return}if(a===1&&k===this._kBad){return _stop(e)}this._kBad=null;if(a===0&&(e.ctrlKey&&(k===86||k===88)||e.shiftKey&&k===45)){setTimeout(function(){me._doKey0()},1)}if(a!==1&&(e.ctrlKey||e.altKey||k===17)){if(e.altKey){this._k0=-1}else if(t0!==t1&&(k===86||k===17&&a===2)){this.paste(t1);this._noPaste=1}else if(k===17){this.getSelectedText()}return}if(a===0){this._k0=k}if(a===2){if(this._k0>0){this._k0=0}this._spinField=-1}len=t1.length;bad=this._bad!==0;if(k<=46){switch(k){case 8:case 46:if(this._k0===k&&a===1){a=2}if(a===0){a=1;if(k===46){k=7}}break;case 27:_stop(e);if(a===0){this._undo();if(!this._escFix){this._escTxt=this._field[0].value}}else{if(this._escFix&&this._escTxt!==t1&&!_aNull(this._escTxt)){this._field[0].value=this._escTxt;delete this._escTxt}if(a===1){this._escFix=1}else{delete this._escFix}}return;case 13:if(o.hideEnterKey){if(!this._ta||!e.shiftKey||this._type>0&&this._ta&&e.shiftKey){_stop(e)}}else{me._update()}return;case 38:case 40:if(this._ta){break}if(a===0&&!e.shiftKey){this._spin(k===38?o.spinDelta:-o.spinDelta)}if(this._k0===k){a=2}break}}if(a===1&&k===this._k0&&(k<48&&k>9&&k!==32||k>90)){return}if(!bad){if(a!==0&&k!==9){_stop(e)}if(a===1&&this._k0===-1){this._k0=0;this.getSelectedText()}if(a===0||k<9){this.getSelectedText()}}if(a===1&&k>6){if(k>31){if(this._fire(1,e)){if(bad){_stop(e)}return}k=this._key;excl=o.excludeKeys;incl=o.includeKeys;if(o.toUpper||o.toLower||excl||incl){ch=String.fromCharCode(k);up=ch.toUpperCase();if(excl&&excl.toUpperCase().indexOf(up)>=0||incl&&incl.toUpperCase().indexOf(up)<0){return _stop(e)}if(o.toUpper){k=up.charCodeAt(0)}else if(o.toLower){k=ch.toLowerCase().charCodeAt(0)}this._key=k}}this._doKey(k,k<10?"":String.fromCharCode(k),t1,len,this._sel0,this._sel1,bad,e)}},paste:function(txt,flag){var prop,last=this._pasted,o=this.options;if(last&&_now()-last.now<10&&(last.txt===txt||last.val===txt)){return this}this._pasted=last=last||{};last.now=_now();last.txt=txt;if(this._nullT&&!flag||this._noPaste===1){return this}prop=this._prop(12);if(prop>0&&prop<txt.length){txt=txt.substring(0,prop)}prop=o.includeKeys;if(prop){prop=prop.toUpperCase().replace(/\[/gm,"\\[").replace(/\]/gm,"\\]").replace(/\^/gm,"\\^").replace(/\-/gm,"\\-");txt=txt.replace(new RegExp("[^"+prop+"]","igm"),"")}prop=o.excludeKeys;if(prop){prop=prop.toUpperCase().replace(/\[/gm,"\\[").replace(/\]/gm,"\\]").replace(/\^/gm,"\\^").replace(/\-/gm,"\\-");txt=txt.replace(new RegExp("["+prop+"]","igm"),"")}if(o.toUpper){txt=txt.toUpperCase()}else if(o.toLower){txt=txt.toLowerCase()}txt=this._matchList(txt,0);if(_aNull(txt)){txt=this._text}this._text="";this._fix=0;this.text(txt,flag?null:this._sel0);this._fix=1;this._fire(12);last.val=this._field[0].value;return this},_touch:function(act){var scroll,dd=this._ddList;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)}}},_fixCss:function(){var but,i,dis,csso,elem=this._element,old=this._hoverOld,hov=this._hover,down=this._mouseDown,foc=this._fcs>0,o=this.options,dd=this._ddList,css=this._css,border="";if(!this._field){return}dis=o.disabled;csso=this.css;if(foc){elem.addClass(csso.focus)}else{elem.removeClass(csso.focus)}if(hov){elem.addClass(csso.hover)}else{elem.removeClass(csso.hover)}this._hoverOld=hov;if(!old||old===hov){old=0}if(old>99){if(!dd){return}this._listCss(dd,old,csso.listItemHover)}if(hov>99&&!this._touch()){this._listCss(dd,hov,csso.listItemHover,1)}if(dis){css+=" "+csso.disabled}if(this._nullT){css+=" "+csso.nullValue}if(this._type>3&&csso.negative&&!this._nullT){if(this._instant(1)<0){css+=" "+csso.negative}}this._setCss(this._field,css);i=this._buttons?4:0;while(i-->0){but=this._buttons[i];if(!but){continue}csso=but[0]._css;css=csso[0];if(dis){css+=" "+csso[3]}if(hov===i+1){css+=" "+csso[1]}if(foc){css+=" "+this.css.buttonFocus}if(down===i+1){css+=" "+csso[2]}this._setCss(but,css+border);css=csso[4];if(dis){css+=" "+csso[7]}if(down===i+1){css+=" "+csso[6]}else if(hov===i+1){css+=" "+csso[5]}else if(hov||foc){css+=" "+this.css.buttonsImageStateOverride}this._setCss(but.find("SPAN"),css)}},_setCss:function(obj,css){var cur=obj[0].className,old=obj[0]._ig_oldCss;obj[0]._ig_oldCss=css;if(css===old){return}if(old&&cur&&old!==cur&&cur.indexOf(old)>=0){cur=cur.replace(old,"");css+=(cur.charAt(0)!==" "?" ":"")+cur}obj[0].className=css},_enterTxt:function(){var d,type=this._type;if(type===1){return this._getTxt(this._dataMode,"")}if(type===2||type===3){d=this._toDate(this._val(),true);return _aNull(d)?"":this._toTxt(d,true,"")}if(type>3){return this._toTxtNum(null,true,this._val(),"-",".")}return this._val()},_update:function(){var v,old=this._old;if(this._lock){return}this._lock=true;this._text=this._focusTxt(false,this._fcs===2||this._hadFocus?"":null);v=this._instant(1,null,1);if(!_aNull(v)&&!_aNull(old)){if(v.getTime&&old.getTime&&v.getTime()===old.getTime()){v=old}}if(v!==old||this._bad===2){this._val10=v;if(this._fire(10,null,v,old)){this._set_val(old);this._text=this._focusTxt(false)}else{if(v!==this._val10){this._setVal(this._val10)}this._repaint();this.options.value=v=this._instant(1,null,1);this._fire(11,null,v,old);if(this._k0!==13){this._old=this.options.value}this._dtt()}}this._lock=false},_dropTrigger:function(e,k){var len,ch,acts,o=this.options,on=this._ddOn;acts=o.dropDownTriggers;if(k===0||!acts||o.readOnly&&!o.dropDownOnReadOnly||k===-2&&acts.indexOf("button")<0||k===-1&&acts.indexOf("focus")<0){return}if(k===38&&!on||k===40&&on){return}if(k>0){ch=k===38||k===40?"arrow":String.fromCharCode(k);if(e.ctrlKey){ch="ctrl+"+ch}else if(e.altKey){ch="alt+"+ch}else if(e.shiftKey){ch="shift+"+ch}len=ch.length;ch=acts.indexOf(ch);if(ch<0||ch>0&&acts.charAt(ch-1)!==","||ch+len<acts.length&&acts.charAt(ch+len)!==","){return}}if(!on||k!==-1||_now()-on>900){return this._doDrop(1,e)}},_doDP:function(act,sel){var odp,dp,field,id,o=this.options,v=o.focusOnDropDownOpen;if(!this._field||this._type!==3){return}if(!this._dp&&act!==1){return 1}if(_aNull(this._mobile)){try{this._mobile=this.__touch||window.navigator.userAgent.toLowerCase().indexOf("mobile")>0}catch(ex){}}if(o.dropDownTriggers==="focus"){this._mobile=false}if(_aNull(v)){this._noFocus=this._mobile}else{this._noFocus=!v}if(sel){this._set_val(sel);this._fire(12)}dp=$.datepicker;field=this._field[0];id=field.id;if(!dp._old_selectDay){dp._old_selectDay=dp._selectDay;dp._old_parseDate=dp.parseDate;dp._old_updateDatepicker=dp._updateDatepicker;dp._old_checkOffset=dp._checkOffset;dp.dpDiv.bind("mousedown",function(evt){var dp=$.datepicker._ig_dp;if(dp){if(evt.target&&evt.target.nodeName==="SELECT"){dp._ddmd=_now();dp._ddnf=$.ig.util.isFF||dp.__touch}else{_stop(evt)}}});dp._selectDay=function(id,month,year,td){var me=this._ig_dp;if(!me){return this._old_selectDay(id,month,year,td)}id=$("a",td).html()||td.firstChild.innerHTML;me._doDrop(0,{type:"mousedown"},[year,month,_int(id)],1);me._xyCheck(true)};dp._updateDatepicker=function(inst){var field,me=this._ig_dp;if(me){this._ig_css=me.css.dropDown;this.dpDiv.addClass(this._ig_css);if(me._noFocus){field=me._field[0];if(field.disabled){field=null}}}else if(this._ig_css){this.dpDiv.removeClass(this._ig_css);delete this._ig_css}if(field){field.disabled=true}this._old_updateDatepicker(inst);if(field){field.disabled=false}if(me){this.dpDiv.find("*").attr("unselectable","on")}};dp.parseDate=function(a,b,c){return this._ig_dp?this._ig_dp._df(this._ig_dp._getVal(1),-1):this._old_parseDate(a,b,c)};dp._checkOffset=function(inst,offset,isFixed){var xy,me=this._ig_dp;offset=this._old_checkOffset(inst,offset,isFixed);if(me){offset.left-=me._leftShift();_offset(null,offset);xy=_offset(me._swap?me._field:me._element);me._xy={x:xy.left,y:xy.top,i:setInterval(function(){me._xyCheck()},300)}}return offset}}if(act===1){v=dp._ig_dp;if(v&&v!==this){delete dp._ig_dp;v._doDrop()}if(id.length<1){id=this.element[0].id+"_ig_dp_id";while(document.getElementById(id)){id+=Math.floor(Math.random()*10)}field.id=id}if(!this._dp){odp=$.extend(o.datepickerOptions,this._dpRegion())||{};v=o.animationShowDuration;if(v){odp.duration=v}v=o.animationShowEffect;if(v){odp.showAnim=v}odp.showOn="";odp.onClose=function(){var me=dp._ig_dp;if(me){if(me._fcs&&me._ddnf&&me._ddnf.type){me._onEvt(me._ddnf,9)}me._dpClosed=1;me._doDrop();delete me._dpClosed;delete dp._ig_dp}};this._dp=$(field).datepicker(odp)}odp=$.data(field,"datepicker").settings;odp.minDate=odp.minDate||o.minValue;odp.maxDate=odp.maxDate||o.maxValue;if($.ig.util.isOpera){odp.changeYear=false}dp._ig_dp=this;this._css+=" "+$.datepicker.markerClassName;if(this._noFocus){field.disabled=true}else if(this._fcs<1){this.setFocus(-1)}dp._showDatepicker(field);if(this._noFocus){field.disabled=false;try{dp._dummyFocus=dp._dummyFocus||(this._mobile?$("<button />").css("position","absolute").css("top","-100px").appendTo(document.body)[0]:dp.dpDiv[0]);dp._dummyFocus.focus()}catch(ex){}}}else if(act===2){dp._doKeyUp({target:field})}else{this._xyCheck(true);if(!this._dpClosed){dp._hideDatepicker(field)}if(act===3){dp._destroyDatepicker(field)}}return 1},_fixBC:function(src,e){src=src.css("backgroundColor");e.css("backgroundColor",!src||src==="transparent"||src.replace(/ /g,"").indexOf("(0,0,0,0")>0?"white":src)},_xyCheck:function(stop){var xy=this._xy,xyE=this._swap?this._field:this._element;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||!this._ddOn){delete this._xy;clearInterval(xy.i);this._doDrop()}},_vAct:function(act){return $.ui.igValidator&&$.ui.igValidator._act(this,act)},_doDrop:function(act,e,sel,dp){var borderClr,widthOuter,heightOuter,height,up,ht,y,b,row,col,cols,rows,dif,cell,max,end,el,xy,effect,width,dd,elem,body,len,items,heightEnd,par=this._ddParent,i=-1,val=sel,me=this,o=this.options;items=o.listItems;act=act===1?!this._ddOn:false;if(!act&&!this._ddOn&&!dp){return}if(!me._field||me._vAct(act?"drop":"hide")){return}len=items?items.length:0;if(this._type===3){if(sel&&!isNaN(sel[2])){val=this._getVal(1);if(!val){val=this._df(sel[0],sel[1],sel[2],0,0,0,0)}else{val=this._df(sel[0],sel[1],sel[2],this._df(val,3),this._df(val,4),this._df(val,5),this._df(val,6))}}}else{if(len<1){return}if(sel){val=this._item(items[sel-100])}}if(this._fire(act?16:17,e,act?null:{value:val})&&e){return}this._ddOn=act?_now():null;if(this._type===3){return this._doDP(act?1:0,val)}dd=me._ddList;elem=me._element;body=!o.listDropDownAsChild||elem===me._field;if(!dd){dd=me._ddList=$("<div/>").addClass(me.css.dropDown+" "+me.css.list).scroll(function(){me._lazy()});dd[0]._id=99;me._ddSel=-1;me._ddLen=len;dd.css({position:"absolute",visibility:"hidden"});width=o.listWidth;if(width<5){width=elem.outerWidth();if(width<5){width=100}}if(body){me._ddParent=par=o.theme?$("<span/>").addClass(o.theme).css("position","absolute").append(dd):dd;MSApp.execUnsafeLocalFunction(function(){par.css({left:"0px",top:"0px"}).appendTo($("body"))});dd.bind(me._mEvts)}else{me._ddParent=par=dd.prependTo(elem)}borderClr=dd.css("borderRightColor");cols=Math.max(1,o.listColumns);rows=me._rows=Math.ceil(len/cols);dif=dd.outerWidth()-dd.width();width=Math.ceil((width-dif)/cols-1);me._listLazy=[];for(col=0;col<cols;col++){for(row=0;row<rows;row++){if(++i>=len){break}cell='<div style="width:'+width+"px;position:absolute;white-space:nowrap;overflow:hidden;";val=me._item(items[i]);if(typeof val!=="string"){if(me._type>=4&&typeof val==="number"){val=me._toTxtNum(val)}else if(val&&me._type===2&&val.getMonth){val=me._toTxt(val)}else{val=_str(val)}}el=items[i];if(el&&typeof el.getHtml==="function"){el=el.getHtml()||val}else{el=val}if(i>0){cell+="height:"+height+"px;left:"+col*widthOuter+"px;top:"+row*heightOuter+"px;"}if(col+1<cols){cell+="border-right-color:"+borderClr}cell+='" title="'+me._item(items[i])+'" _id="'+(i+100)+'" class="'+me.css.listItem;if(col+1<cols){cell+=" "+me.css.listItemColumnBorder}cell+='">'+(el===""?"&nbsp;":el)+"</div>";if(i===0||i+1===len){MSApp.execUnsafeLocalFunction(function(){cell=$(cell).appendTo(dd)});cell[0]._id=i+100}else{me._listLazy[i]=cell}if(i===0){height=cell.height();if(height<5){height=18}dif=cell.outerWidth()-cell.width();if(dif>0){width-=dif;cell.css("width",width)}widthOuter=cell.outerWidth()+1;me._ddWidth=widthOuter*cols;me._ddHeight0=heightOuter=cell.outerHeight();me._ddHeight=me._ddHeight0*rows;me._fixBC(cell,dd);max=Math.max(0,o.listMaxHeight);if(max>0&&me._ddHeight>max){me._ddHeight=max;max=Math.ceil(16/cols);width-=max;cell.css("width",width);widthOuter-=max}else{max=0}dd.css("overflow",max>0?"auto":"hidden");cell.css({height:height,left:col*widthOuter,top:row*heightOuter})}}}me._page=Math.max(2,Math.floor(Math.min(me._ddHeight/height),len/3)-1)}if(sel){if(!me._listSelect(sel-100)){val=this._item(items[sel-100]);me._set_val(val);me._fire(12)}}if(!act){me._lastY=dd[0].scrollTop}else if(me._lastY){dd[0].scrollTop=me._lastY}me._listSelect(null,1);val=act?o.animationShowDuration:o.animationHideDuration;if(!val||typeof val==="number"&&val<5){val=null}else{effect=act?o.animationShowEffect:o.animationHideEffect;if(!$.effects||!$.effects[effect]){if(!act&&typeof val!=="number"){val=450}effect=null}}heightEnd=val&&!effect?0:me._ddHeight;end=function(){if(act){dd.css("filter","");if(!sel&&me._lastY){dd[0].scrollTop=me._lastY}else{me._listSelect()}i=dd[0].scrollWidth-dd[0].clientWidth;if(!me._ddFixW&&i>0&&i&&i<4){me._ddFixW=++i;me._ddWidth+=i;dd.css("width",me._ddWidth)}me._touch()}else{dd.css({display:"none",visibility:"hidden"});me._touch("_hide")}};if(act){this._lazy();if(me._fcs<1){me.setFocus()}ht=999;b=document.body;el=document.documentElement;i=window.innerHeight;if(i>50&&i){ht=i}else if(el.clientHeight>50&&el.clientHeight){ht=el.clientHeight}else if(b.clientHeight>50&&b.clientHeight){ht=b.clientHeight}y=Math.max(window.pageYOffset||0,Math.max(b.scrollTop,el.scrollTop));el=me._swap?me._field:elem;xy=_offset(el);me._xy=body?{x:xy.left,y:xy.top}:null;xy.h=el[0].offsetHeight;up=xy.top+xy.h+me._ddHeight-y-ht;if(up>0&&y-xy.top+me._ddHeight<up){up=me._ddHeight+2;if(xy.top-up<y){up=Math.max(xy.top-y,2)}xy.h=-up;xy.top+=xy.h;heightEnd=me._ddHeight;elem.addClass(me.css.noTopCorners);dd.addClass(me.css.noBottomCorners)}else{xy.top+=xy.h;elem.addClass(me.css.noBottomCorners);dd.addClass(me.css.noTopCorners)}dd.css({opacity:val&&!effect?0:1,height:heightEnd,width:Math.floor(me._ddWidth/(val&&!effect?2:1)),display:"",visibility:"visible"});if(body){if(me._swap){xy.left-=me._leftShift()}xy.left-=_int(elem.css("borderLeftWidth"));par.css({left:xy.left,top:xy.top});me._xy.i=setInterval(function(){me._xyCheck()},300)}else{i=me._left?"Right":"Left";par.css("margin"+i,-_int(elem.css("border"+i+"Width"))+"px");par.css("marginTop",xy.h);up=_offset(par).left-xy.left;if(up>30&&up<elem[0].offsetWidth+10){par.css("marginLeft",-up+"px")}}if(!val){end()}else if(effect){dd.show(effect,{},val,end)}else{dd.animate({opacity:1,height:me._ddHeight,width:me._ddWidth},val,null,end)}}else{me._xyCheck(true);elem.removeClass(me.css.noTopCorners).removeClass(me.css.noBottomCorners);dd.removeClass(me.css.noBottomCorners).removeClass(me.css.noTopCorners);if(!val){end()}else if(effect){dd.hide(effect,{},val,end)}else{dd.animate({opacity:.6},Math.floor(val*.34)).animate({opacity:0,height:heightEnd,width:Math.floor(me._ddWidth/2)},Math.floor(val*.66),null,end)}}return true},_lazy:function(i){var id,j,cols=Math.max(1,this.options.listColumns),items=this._listLazy,dd=this._ddOn?this._ddList:null;if(!dd){return}if(i){if(items[i]){MSApp.execUnsafeLocalFunction(function(){$(items[i]).appendTo(dd)[0]._id=i+100;delete items[i]})}return}id=Math.floor(dd[0].scrollTop/this._ddHeight0);while(cols-->0){for(i=0;i<this._page+8;i++){j=this._rows*cols+id+i;if(items[j]){MSApp.execUnsafeLocalFunction(function(){$(items[j]).appendTo(dd)[0]._id=j+100;delete items[j]})}}}},_listCss:function(dd,id,css,add){dd=$(dd.children("[_id="+id+"]"));if(add){dd.addClass(css)}else{dd.removeClass(css)}},_listSelect:function(id,on){var top,scroll,sel,arg=null,dd=on!==2&&(on||this._ddOn)?this._ddList:null,o=this.options;if(!o.listItems){return}if(!_aNull(id)&&this._listID!==id){arg={index:id,oldIndex:this._listID,item:o.listItems[id]};if(this._fire(18,null,arg)){return 1}this._listID=id}id=this._listID;if(dd){if(on&&id<0){on=this._findItem(this.text(),-1);if(!_aNull(on)&&id!==on.id){arg={index:on.id,oldIndex:id,item:o.listItems[on.id]};if(this._fire(18,null,arg)){return 1}this._listID=id=on.id}}sel=this._ddSel;if(sel!==id){this._lazy(id);this._listCss(dd,sel+100,this.css.listItemSelected);sel=this._ddSel=id;this._listCss(dd,sel+100,this.css.listItemSelected,1)}if(sel>=0){top=sel%this._rows*this._ddHeight0;scroll=dd[0].scrollTop;if(top>scroll){top+=this._ddHeight0-this._ddHeight;if(top<scroll){top=-9}}if(top!==-9){if($.ig.util.isSafari&&top>20&&dd[0].scrollTop===top&&!on){dd[0].scrollTop=top-1}dd[0].scrollTop=top}}}if(arg){this._fire(19,null,arg)}},_listKey:function(e,k){var i,len,dd=this._ddOn?this._ddList:null,id=this._listID,kc=$.ui.keyCode;if(!dd){return}if(k===kc.ENTER||k===kc.SPACE||k===kc.ESCAPE){this._doDrop(0,e,k===kc.ESCAPE?null:id+100);return true}if(k<33||k>40){return}len=this._ddLen-1;i=id;if(i<0){i=-1e3}if(k===kc.DOWN){i++}else if(k===kc.UP){i--}else if(k===kc.PAGE_DOWN){i+=this._page}else if(k===kc.PAGE_UP){i-=this._page}else if(k===kc.HOME){i=0}else if(k===kc.END){i=len}else if(k===kc.RIGHT){i+=this._rows;if(i>len){i=id}}else if(k===kc.LEFT){i-=this._rows;if(i<0){i=id}}else{return}this._listSelect(Math.max(0,Math.min(i,len)));return true},_listChange:function(list,i,act){var len,count,j,items=this.options.listItems;len=items?items.length:0;j=count=list?list.length:0;i=_aNull(i)||i<0?-1:i;if(act<2){if(len<1){return this}if(act>0&&i<0){if(list===null){i=len-1}else{while(++i<len){if(items[i]===list){break}}}}if(i<0){items.length=0}else if(i<len){items.splice(i,1)}}else if(!items){this.options.listItems=list}else{while(j-->0){if(i>=len||i<0){items.push(list[count-j-1])}else if(i===0){items.unshift(list[j])}else{items.splice(i,0,list[j])}}}this._listRemove();return this},_listRemove:function(){if(this._ddList){this._touch("destroy");this._element.removeClass(this.css.noTopCorners).removeClass(this.css.noBottomCorners);this._ddList.unbind();this._ddParent.remove();this._ddOn=this._ddList=this._ddParent=this._listLazy=null;this._listID=-1}},_initValidator:function(end,req){if(!this._field){return}var v=this._validator,o=this.options,vo=o.validatorOptions;if(end||!vo||!this.element.igValidator){if(v){v.destroy();delete this._validator}return}vo.ctl=this;vo.required=o.required=o.required||!req&&vo.required;this._field.igValidator(vo)},_doError:function(flag,e,mes){var val=this._validator;if(val&&this._field){if(!_aNull(mes)){return val._doError(mes,null,flag)!==1}if(flag){val._evt(e,null,flag===2);if(val._lbl){val._lbl._old={t:_now(),val:this._val(),sel0:this._sel0,sel1:this._sel1,lastTxt:this._lastText,last:this._last,txt:this._text}}}else{val.hide(null)}}},_doScrl:function(field,txt){var ch,e,fox=$.ig.util.isFF&&!this._dp,width=field.clientWidth,max=field.scrollWidth,len=txt.length,f=false,sel=this._sel0;if(!this._field||this._tr!==1||len<4){return}ch=max/len*1.1;len-=sel;if(this._ta){max=field.scrollHeight;if(field.clientHeight+2>max){return}txt=txt.split("\n");if(len*15<width&&(fox||txt[txt.length-1].length*15>width)){field.scrollTop=max;return}if(!fox){return}}else if(sel*15<width){return}if(!fox){if(max>width+2){if(len*ch*1.3<width){field.scrollLeft=max}else if(sel*ch>width+field.scrollLeft){field.scrollLeft=Math.floor(sel*ch-width-3)}}return}if(this._bad>2){return}this._scrl=1;try{ch=field.maxLength;e=this._mask;if(ch>0){field.maxLength=Math.max(ch,e?e.length:0)+2}e=document.createEvent("KeyboardEvent");e.initKeyEvent("keypress",!f,!f,null,f,f,f,f,0,32);field.dispatchEvent(e);e=document.createEvent("KeyboardEvent");e.initKeyEvent("keypress",!f,!f,null,f,f,f,f,8,0);field.dispatchEvent(e);if(ch>0){field.maxLength=ch}}catch(ignore){}delete this._scrl},_onEvt:function(e,type){var old,txt,field=this._field,me=this;field=field?field[0]:null;if(!field||me._scrl){return}me._evt=e;if(type!==11){me._doEvt(e,type,field);delete me._evt}else{if(me._pasting&&_now()-me._pasting<2e3){return}old=field.value;try{if(me._nullT&&e&&e.type==="drop"){txt=e.originalEvent.dataTransfer;if(!_aNull(txt)){txt=txt.getData("Text")}}}catch(ex){txt=null}me._pasting=_now();setTimeout(function(){if(!txt){if(!me._field){return}txt=field.value}if(old!==txt){me.paste(txt)}delete me._pasting},0)}},_doEvt:function(e,eType,field){var val,foc,skip,skip0,up,time,src,v=null,k=0,me=this,o=this.options;if(me._noWidth){me._fixWidth()}if(!e||o.disabled){return}if(eType===10){v=e.wheelDelta||e.detail;if(v){_stop(e);me._spin(v>0?o.spinDelta:-o.spinDelta)}return}if($.ig.util&&$.ig.util.evtButton(e)){return}if(eType===26){me._msOver=e.originalEvent.pointerType;return}if(me._msOver===2&&eType===6){delete me._msOver;return}val=src=e.target;v=val._id;while(val&&k++<5&&_aNull(v)){val=val.parentNode;if(val){v=val._id}}if(eType===7){me._hover=me._mouseDown=0;me._fixCss();me._fire(eType,e,v);return}if(!v){return}if(eType===6){if(v>0&&!src.unselectable){src.unselectable="on"}val=field.value;if(val===me._lastText||me._pasting){val=null}if(!me._fcs&&val&&me._nullT){if(val!==o.nullText){me._fixNull()}val=null}if(val){me.paste(val,1)}}if(v>4&&v<9){v-=4}if(eType===0&&me._fcs===0){me._onEvt({target:src,type:"focus"},8)}if(_aNull(me._evt0Spin1)&&!me._box){try{if(!($.ig.util.isIE&&$.ig.util.browserVersion<11&&!me._ta)&&!_aNull(field.selectionStart)){me._tr=1}}catch(ignore){}if(me._tr!==1){me._tr=field.createTextRange?field.createTextRange():null}me._bad=_aNull(me._tr)?1:0}me._evt0Spin1=0;if(eType===5&&me._fcs===2&&e.button===1){me.getSelectedText()}time=_now();if(eType<3){me._key=k=e.keyCode||e.which||0;me._time=time}if(eType!==1&&eType<8){if(me._fire(eType,e,v)){if(eType<4){_stop(e)}return}}if(eType<3){if(eType===0&&(me._fcs===2||o.dropDownOnReadOnly)&&me._dropTrigger(e,k)){return}if(me._fcs===1&&(e.shiftKey||eType===1||!(o.spinOnReadOnly||o.dropDownOnReadOnly&&me._ddOn)||k<9||k>40)){return}if(eType===2&&me._k0===0&&k>0&&k!==13&&k!==86&&me._text!==me._val()&&k!==32){field.value=me._text;return}}if(eType===3&&v>0){if(v===99){me._ddmd=time}_stop(e)}if(eType===3&&me._mouseDown!==v){if(v>1&&v<4){me._stopTimer(1);if(!o.readOnly||o.spinOnReadOnly){up=v===2?o.spinDelta:-o.spinDelta;if(me._fcs<1&&o.focusOnSpin){me._evt0Spin1=1;me.setFocus()}me._spin(up);skip=skip0=5;me._spinField=-1;me._timer=setInterval(function(){if(me._mouseDown<2){return me._stopTimer(1)}if(--skip<1){me._spin(up);skip=--skip0>8?--skip0:skip0}},60)}}me._hover=me._mouseDown=v;me._fixCss()}if((eType===5||eType===6)&&me._hover!==v){me._hover=v;me._fixCss()}if(eType===4&&me._mouseDown){if((v===1||v===4)&&v===me._mouseDown){if(!me._fire(15,e)){if(v===4){me._onEvt(null,11);me._set_val(null);me.select(0)}else{me._dropTrigger(e,-2)}}}if(v>99){me._doDrop(0,e,v)}me._mouseDown=0;me._fixCss()}if(v>0){return}foc=me._focTime;if(eType===4){if(foc&&foc+500>time){me._select()}me._focTime=0}if(eType<3){me._doKey0(e,eType)}if(!me._field){return}val=me._val();if(eType===2){me._last=val;if(me._key===13&&$.ig.util.isFF&&me._text!==val){me._fire(12,e);me._update();me.text(val)}}if(eType===1&&me._keyMod){delete me._keyMod;me._doScrl(field,val)}if(eType>=8){if(me._bad>2){me._bad=2}me._spinField=-1;foc=eType===8;if(foc){delete me._ddnf}v=me._fcs>0;if(foc===v){return}if(!foc&&time-me._ddmd<500){if(me._ddnf){me._ddnf=e}else{me.setFocus(-1)}return}me._noPaste=0;if(!foc&&me._lastText!==val){me.paste(val,1)}if(!foc&&me._type<2&&!val&&!o.nullable){val=me._old||(o.listItems?o.listItems[0]:"");if(val){me._set_val(val);val=me._text=me._focusTxt(false)}else{val=""}}me._fcs=foc?o.readOnly?1:2:0;if(me._vAct(foc)){return}me._hadFocus=!foc;v=me._validator;if(foc){me._k0=0;if(me._bad>1){me._bad=0}if(!o.readOnly){if(me._nullT){val=me._last=me._text=field.value=""}me._nullT=null;v=v&&v._lbl?v._lbl._old:null;if(v&&v.t+200>_now()){field.value=me._text=v.txt;me._lastText=v.lastTxt;me._last=v.last;me.select(v.sel0,v.sel1)}else{if(val!==me._text){me.getSelectedText();me.paste(val)}me._lastText=me._last=me._text=me._focusTxt(foc,e)}}me._focTime=time;me._dropTrigger(e,-1)}else{if(v){me._doError(2,e);setTimeout(function(){if(!me._fcs&&!me._doInvalid(e,9)){me._doError()}},100)}me._doDrop(0,e);val=me._matchList(val,-1);me._canRedo=null;if(!o.readOnly){v=me._ta?o.maxLength||0:0;if(v>0&&val.length>v){val=val.substring(0,v)}if(me._last!==val||me._bad!==0){v=me._fix;me._fix=0;me._fcs=2;me.text(val);me._fcs=0;me._fix=v}me._update()}}me._repaint();me._fixCss();if(foc&&this._prop(13)<2){me.select(this._prop(13)*1e4);me._select()}me._hadFocus=false;if(foc&&me._focSpin){me._spin(me._focSpin)}me._focSpin=null;me._fire(eType,e,-1);me._lastText=me._val();return}if(!(eType>3&&me._k0===0)&&!me._nullT&&val!==me._text){me._text=val;me._fire(12,e)}},_fire:function(id,e,arg,a2){if(!this._field){return}var evt,ee=this.events,args=id===13||id>16?arg:{};for(evt in ee){if(ee.hasOwnProperty(evt)&&ee[evt]===id){break}}if(id===14){args.delta=arg;args.value=this._instant(1,null,1)}if(id===12){args.oldText=this._lastText;arg=this._val();if(args.oldText===arg){return}this._doError(1,e);this._doClear(arg);args.text=this._lastText=this._text=arg;if(this._fcs<2&&this._evt0Spin1!==1){this._update()}this._doDP(2);if(this._type>3){this._fixCss()}}if(id<3){args.key=this._key}else if(id<8){args.elementType=arg===-1?"field":arg===1||arg===5?"button":arg===2||arg===6?"spinUpper":arg===3||arg===7?"spinLower":arg===99?"dropDown":arg>99?"item"+(arg-100):"";args.id=arg}if(id===10||id===11){args.value=arg;args.oldValue=a2}if(id===11&&this._fcs===2){this._update()}args.owner=this;if(!this._trigger(evt,e||this._evt,args)){return true}if(id<3){this._key=args.key}if(id===10){this._val10=args.value}},_select:function(x){var sel1,me=this,field=this._field[0],sel0=this._prop(13);if(this._tr!==1||sel0>1){return}if(!x){setTimeout(function(){try{me._select(1)}catch(ignore){}},0);return}sel1=field.value.length;if(sel0===0){sel1=0}else if(sel0<0){sel0=0}else{sel0=sel1}if(sel0!==field.selectionStart||sel1!==field.selectionEnd){this.select(sel0,sel1)}},select:function(sel0,sel1,val){var j,i,fix0=0,fix1=0,tr=this._tr,field=this._fcs===2?this._field[0]:null;if(!field||field.offsetWidth<2||this._box){return this}if(_aNull(val)){val=field.value}else{sel1=sel0;if(field&&field.value!==val){this._keyMod=field.value=val}}i=val.length;if(_aNull(sel1,1)){sel1=sel0;if(_aNull(sel0,1)||sel0<0){sel0=0;sel1=i}}if(sel1>=i){sel1=i}else if(sel1<sel0){sel1=sel0}if(sel0>sel1){sel0=sel1}this._sel0=sel0;this._sel1=sel1;try{if(tr===1){field.selectionStart=sel0;field.selectionEnd=sel1;return this}if(!tr){if(sel0!==sel1){field.select()}return this}if(this._ta){j=sel1;while(j-->0){if(val.charCodeAt(j)===10){if(j<sel0){fix0++}fix1++}}sel0-=fix0;sel1-=fix1}sel1-=sel0;if(this._ta){tr.moveToElementText(field)}else{tr.move("textedit",-1)}tr.move("character",sel0);if(sel1>0){tr.moveEnd("character",sel1)}tr.select()}catch(ignore){}return this},getSelectedText:function(){var i,range,val,txt="",field=this._field[0],tr=this._tr,sel0=0;this._sel0=this._sel1=0;if(_aNull(tr)){return txt}if(tr===1){this._sel0=field.selectionStart;this._sel1=field.selectionEnd;if(this._sel0<this._sel1){txt=field.value.substring(this._sel0,this._sel1)}return txt}try{range=document.selection.createRange();val=field.value;i=val.length;tr=range.duplicate();if(this._ta){tr.moveToElementText(field)}else{tr.move("textedit",-1)}try{while(tr.compareEndPoints("StartToStart",range)<0){tr.moveStart("character",1);sel0++;if(this._ta&&val.charCodeAt(sel0)===10){sel0++}if(sel0>i){break}}}catch(ignore){}txt=range.text}catch(ignore){}this._sel0=sel0;this._sel1=sel0+txt.length;return txt},getSelection:function(start){this.getSelectedText();return start?this._sel0:this._sel1},setFocus:function(delay){var me=this;if(me._field){if(delay===-1){try{me._field[0].focus()}catch(ignore){}}else{setTimeout(function(){if(me._fcs<1){me.setFocus(-1)}},delay||0)}}return this},hasFocus:function(){return this._fcs>0},_jpn:function(k,str){if(str){if(k===12290||k===65294){return"."}if(k===12289){return","}}else if(!this._sTxt){return k}if(k>65295&&k<65306){k-=65248}else if(k>1631&&k<1642){k-=1584}else if(k>1775&&k<1786){k-=1728}else{return str?null:k}return str?String.fromCharCode(k):k},_dtt:function(){var v,f,input,dt=this._oldAttr.title,o=this.options,name=o.inputName;if(name){f=o._vsFormat;v=this._getVal(1);if(_aNull(v,this._type>3)){v=""}else if(this._date){v=this._df(v,0)+"-"+(this._df(v,1)+1)+"-"+this._df(v,2)+" "+this._df(v,3)+":"+this._df(v,4)+":"+this._df(v,5)+"."+this._df(v,6)}else if(f&&this._type>3){v=v.toString().replace(".",f)}input=$('input[name="'+name+'"]');if(input[0]!==this.element[0]){if(input.length===0){MSApp.execUnsafeLocalFunction(function(){input=$('<input type="hidden" name="'+name+'" />').appendTo(this._element.parent())})}input.val(v)}}if(!dt||dt.indexOf("{0}")<0){return}v=this._val();if(v===""){v=this.options.nullText}this._element[0].title=this._field[0].title=this._field[0].alt=dt.replace("{0}",v)},_stopTimer:function(evt){if(this._timer){clearInterval(this._timer)}delete this._timer;if(!evt&&this._timer1){clearInterval(this._timer1);delete this._timer1}},_maskFlag:function(ch,upLow){switch(ch){case">":return-1;case"<":return-2;case"&":ch=1;break;case"C":ch=2;break;case"A":ch=7;break;case"a":ch=8;break;case"L":ch=13;break;case"?":ch=14;break;case"0":return 19;case"9":return 20;case"#":return 21;default:return 0}return ch+upLow*2},_maskFilter:function(flag,str,i,sf){var ch,f;if(i>=str.length){return sf}ch=str.charCodeAt(i);f=Math.floor((flag-1)/6);str=str.charAt(i);if(ch<22){return sf}if((f===1||f===3)&&ch>100){ch=this._jpn(ch);if(ch<100){str=String.fromCharCode(ch)}}if(f===3){return flag===21&&(str==="-"||str==="+")||ch>47&&ch<58?str:sf}if(f===1||f===2){if(f===1&&ch>47&&ch<58){return str}if(ch<256&&str.toUpperCase()===str.toLowerCase()){return sf}}flag=Math.floor((flag-1)/2)%3;if(flag===0){return str
}return flag===2?str.toLowerCase():str.toUpperCase()},_getTxt:function(vt,prompt,txt0,getVal){var i,len,flag,iLast=this._selKey,mask=this._mask,txt="",non=!_aNull(txt0),o=this.options;if(!non){txt0=this._bad!==0&&this._fcs>1?this._val():this._txt}if(non){non=this._type===1}if(_aNull(txt0)||_aNull(mask)){return txt}len=mask.length;iLast=this._fcs>1&&!getVal&&o.hideMaskOnFocus?iLast&&iLast<len?iLast-1:-1:len;for(i=0;i<len;i++){flag=mask.charCodeAt(i);if(flag<22){if(i<txt0.length&&txt0.charCodeAt(i)>=22){txt+=txt0.charAt(i);if(i>iLast){iLast=i}non=false}else if(vt%3===2||vt%3===1&&flag%2===1){txt+=flag===21&&prompt===""?o.padChar:prompt}}else if(vt>=3){txt+=mask.charAt(i);if(i===iLast+1){if(this._selKey===i){this._selKey++}iLast++}}}if(iLast++<len){txt=txt.substring(0,iLast)}return non?"":txt},_setTxt:function(v,vt,render){var ch,flag,j=0,i=-1,mask=this._mask,txt=this._mask;if(!_aNull(v)){while(++i<mask.length){if(vt===1e3+j){vt=this._dataMode}if(j>=v.length){break}flag=mask.charCodeAt(i);if(flag<22){ch=this._maskFilter(mask.charCodeAt(i),v,j);if(!_aNull(ch)){txt=txt.substring(0,i)+ch+txt.substring(i+1)}j++}else if(vt>=3){j++}}}if(render){return txt}this._txt=txt;this._text=this._focusTxt(this._fcs>1," ");this._repaint()},_setMask:function(str){var x,ch,i,i0=0,upLow=0,mask="",txt="",t0=this._getTxt(0);for(i=0;i<str.length;i++){ch=str.charAt(i);x=this._maskFlag(ch,upLow);if(x!==0){if(x<0){upLow=upLow===-x?0:-x;continue}ch=String.fromCharCode(x);mask+=ch;ch=this._maskFilter(x,t0,i0++,ch)}else if(ch==="\\"&&i+1<str.length&&this._maskFlag(str.charAt(i+1),0)!==0){ch=str.charAt(++i);mask+=ch}else{mask+=ch}txt+=ch}this._txt=txt;this._mask=mask},_getMask:function(fields,v,foc){var x,i,i0=0,flag=-1,txt="";if(!v){v=""}if(foc){v=v.replace("dddd","ddd").replace("ddd,","").replace("ddd ","").replace(" ddd","").replace("ddd","")}v=v.replace(/\x08/g," ").replace(/\x09/g," ");v=v.replace(/\\f/g,"").replace(/\\d/g,"").replace(/\\s/g,"").replace(/\\m/g,"").replace(/\\t/g,"").replace(/\\H/g,"").replace(/\\h/g,"").replace(/\\M/g,"\b").replace(/\\y/g,"	");v=v.replace("fff","24").replace("ff","23").replace("f","22");v=v.replace("dddd",foc?"":"21").replace("ddd",foc?"":"20").replace("dd","09").replace("d","08").replace("ss","19").replace("s","18").replace("mm","17").replace("m","16");v=v.replace("tt","15").replace("t","14").replace("HH","13").replace("H","12").replace("hh","11").replace("h","10");v=v.replace("MMMM",foc?"MM":"07").replace("MMM",foc?"MM":"06").replace("MM","05").replace("M","04").replace("yyyy","03").replace("yy","02").replace("y","01");v=v.replace(/\x01/g,"g").replace(/\x02/g,"d").replace(/\x03/g,"s").replace(/\x04/g,"m").replace(/\x05/g,"t").replace(/\x06/g,"H").replace(/\x07/g,"h").replace(/\x08/g,"M").replace(/\x09/g,"y");for(i=0;i<v.length;i++){x=v.charCodeAt(i);if(x<48||x>57){flag=v.charAt(i);if(!foc&&flag==="\\"&&i+1<v.length){x=v.charAt(++i);if(x==="\\"){continue}if(x==="0"||x==="9"){txt+=flag}txt+=x}else{txt+=v.charAt(i)}continue}flag=(x-48)*10+v.charCodeAt(++i)-48;if(!foc){fields[i0++]=flag;txt+="";continue}fields[i0++]=flag;if(flag===14){txt+="L"}else if(flag===15){txt+="LL"}else if(flag===22){txt+="0"}else{txt+="00";if(flag===3){txt+="00"}while(flag-->23){txt+="0"}}}return txt},getValueByMode:function(mode,v,getVal){var d,type=this._type,empty=this.options.emptyChar;mode=this._mode(mode,type);if(type===0||!this._field){return this._val()}if(type>3){d=this._dataMode;this._dataMode=mode;v=this.value();this._dataMode=d;return v}if(type===1){return this._getTxt(mode,v?"":empty,null,getVal)}d=this._fcs<2?this._isNull?null:this._date:this._toDate(this._val(),true,v);return mode===0?d:d?this._toTxt(d,mode===1,empty):""},_fieldVal:function(f,d,e,ch){var v,j,i=f%2*2,o=this.options;if(f<4){v=this._df(d,0)+o.yearShift;if(f===3){i=4}else{v%=100;i=f===2?2:0}}else if(f<8){this.d_s=2;v=this._df(d,1)+1;if(f>5){f=this._optVal(f===6?"monthNamesShort":"monthNames")[v-1];if(f.length>0){return f}}}else if(f<10){v=this._df(d,2)}else if(f<16){v=this._df(d,3);if(f>13){v=this._optVal(v<12?"am":"pm");f-=13;i=v.length;if(f===i){return v}if(i<f){v+=" "}return v.substring(0,f)}if(f<12){v%=12;if(v===0){v=12}}}else if(f<18){v=this._df(d,4)}else if(f<20){v=this._df(d,5)}else if(f>21){v=this._df(d,6);j=i=f-21;while(j-->3){v*=10}while(j++<2){v=Math.floor(v/10)}}else{return this._optVal(f===20?"dayNamesShort":"dayNames")[d.getDay()]}v=_str(v);if(f<20||f>22){f=v.length;if(e){if(i===0){i=2}else{e=false}}if(i>0){if(i<f){v=v.substring(0,i)}else{while(f++<i){v=(e?ch:"0")+v}}}}return v},_limits:function(val,roll){var time,min=this._prop(10),max=this._prop(11);if(this._type>3){if(_aNull(val,1)&&!this.options.nullable){val=this.options.nullValue;if(!val&&this._dataMode>2){val=0}}if(!_aNull(val,1)){if(!_aNull(min,1)&&val<=min){return roll?max:min}if(!_aNull(max,1)&&val>=max){return roll?min:max}}return val}if(_aNull(val)){return val}time=val.getTime();if(!_aNull(min)){min=min.getTime()}if(!_aNull(max)){max=max.getTime()}if(!_aNull(min)&&(time<min||roll&&time===min)){val.setTime(roll?max:min);return val}if(!_aNull(max)&&(time>max||roll&&time===max)){val.setTime(roll?min:max);return val}return null},_date7:function(val){var i;if(val.length<13){return null}val=val.replace(/[\. :]/g,"-").split("-");i=val.length;if(i!==7){return null}while(i-->0){val[i]=_int(val[i],-1);if(val[i]<0){return null}}return this._df(val[0],val[1]-1,val[2],val[3],val[4],val[5],val[6])},_toDate:function(txt,foc,limit,fire){var v,i0,c,iLen,invMes,mis=0,n=0,i=-1,j=-1,y=-1,mo=-1,day=-1,h=-2,m=-2,s=-2,ms=-2,pm=-1,any=false,inv=null,arg={},o=this.options,d=fire?null:this._date7(txt),fields=foc&&fire?this._fields0(txt):this._fields1(txt,foc);iLen=fields.length;if(!d){while(++i<iLen){j++;v=fields[i];i0=foc?this._field0IDs[i]:this._field1IDs[i];if(i0<4){if(v>100&&v>o.yearShift){v-=o.yearShift}arg.year=y=v;if(y<0){mis++}else{n++;c=o.centuryThreshold;if(v<100){if(i0<3&&c<0){c=29}if(c>=0){y+=v>c?1900:2e3}}}}else if(i0<8){if(v<1||v>12){mis++}else{arg.month=mo=v;n++}}else if(i0<10){arg.day=day=v;if(v<1||v>31){mis++}else{n++}}else if(i0<14){if(v===24){v=0}if(i0>11){pm=-4}else{if(v===12){v=0}if(v>12){mis++}}arg.hours=h=v;if(v>23||v<0){mis++}}else{if(i0<16){j--;if(v>0){pm++}continue}if(i0<18){arg.minutes=m=v;if(v>59||v<0){mis++}}else if(i0<20){arg.seconds=s=v;if(v>59||v<0){mis++}}else{if(i0<22){j--;continue}while(i0++<24){v*=10}while(i0-->25){v=Math.floor(v/10)}arg.milliseconds=ms=v;if(v>999||v<0){mis++}}}if(v>=0){any=true}if(j<o.minNumberOfDateFields&&mis>0){if(fire&&any){invMes=this._optVal("dateFields",2);inv="numberOfFields"}mis+=9}}}if(pm===0&&h>=0&&h<12){h+=12;arg.hours=h}if(!d&&(!o.nullable||mis<9)){if(n===3){d=this._df(y,mo-1,day,0,0,0,0);if(y<100){this._df(d,0,y)}}else{d=this._df();if(this._date){d.setTime(this._date.getTime())}if(day>0){this._df(d,2,10)}if(y>=0){this._df(d,0,y)}if(mo>0){this._df(d,1,mo-1)}if(day>0){this._df(d,2,day)}}}if(fire&&day>0&&d&&day!==this._df(d,2)){invMes=this._optVal("invalidDay",2);inv="dayOfMonth"}day=o.useLastGoodDate?this._goodD:null;if(fire&&!d&&!o.nullable){d=day;if(!d||!d.getTime){d=this._df()}else{invMes=this._optVal("required",2);inv="null"}}if(d){if(h>-2){this._df(d,3,h<0?0:h)}if(m>-2){this._df(d,4,m<0?0:m)}if(s>-2){this._df(d,5,s<0?0:s)}if(ms>-2){this._df(d,6,ms<0?0:ms)}if(limit){i=d;d=this._limits(d);if(_aNull(d)){d=i}else if(fire){if(!o.minValue){invMes=this._optVal("max",2).replace("{0}",this._toTxt(o.maxValue))}else if(!o.maxValue){invMes=this._optVal("min",2).replace("{0}",this._toTxt(o.minValue))}else{invMes=this._optVal("range",2).replace("{0}",this._toTxt(o.minValue)).replace("{1}",this._toTxt(o.maxValue))}inv="limit"}}}if(fire){if(any&&!d&&txt.length>0&&day){if(!inv){invMes=this._optVal("date",2);inv="invalid"}d=day}if(!any&&o.required){invMes=this._optVal("required",2);inv="null"}arg.value=d;if(inv&&(txt||!o.nullable)){if(o.reduceDayOfInvalidDate!==false&&d&&any&&this._df(d,2)<5&&arg.day>27){this._df(d,2,0);arg.value=d}arg.text=txt;arg.reason=inv;arg.message=invMes;this._inv=arg}}return d},_toTxt:function(d,foc,prompt,txt0){var ch,k,i=-1,f0=0,txt="",mask=foc?this._mask:this._mask1,ids=foc?this._field0IDs:this._field1IDs;if(_aNull(d)){if(!foc){return""}if(txt0){this._txt=mask}return this._getTxt(5,prompt,mask)}this.d_s=6;while(++i<mask.length){ch=mask.charAt(i);k=mask.charCodeAt(i);if(k<22){txt+=this._fieldVal(ids[f0++],d,foc,ch);if(foc){while(i+1<mask.length){if(mask.charCodeAt(i+1)===k){i++}else{break}}}}else{txt+=ch}}if(!foc){return txt}if(txt0){this._txt=txt}return this._getTxt(5,prompt,txt)},_isPM:function(t,i){var pm=this._optVal("pm").toUpperCase();return pm.charAt(0)===t.charAt(i)&&(pm.length<2||t.length<=i+1||pm.charAt(1)===t.charAt(i+1))},_fields1:function(txt,foc){var m,k,j,iLen,i=-1,v=-1,field=0,fields=[],ids=foc?this._field0IDs:this._field1IDs;iLen=ids.length;while(++i<iLen){fields[i]=-1}if(_aNull(txt)){return fields}txt=txt.toUpperCase();i=-1;while(++i<txt.length&&field<iLen){k=this._jpn(txt.charCodeAt(i))-48;j=ids[field];if(j===20||j===21){j=ids[++field]}if(j===14||j===15){if(k>=0&&k<=9){v=-1;field++;i--;continue}if(this._isPM(txt,i)){fields[field++]=1;v=-1}}else{if(k>=0&&k<=9){if(v<0){v=k}else{v=v*10+k}}else{if(v>=0){fields[field++]=v;v=-1}else if(j===6||j===7){while(v-->-3){for(k=0;k<12;k++){m=this._optVal(j===6?"monthNamesShort":"monthNames")[k];m=m.toUpperCase();j=m.length;if(j<1){continue}if(v===-3){if(j<4){continue}m=m.substring(0,3)}j=txt.indexOf(m)-1;if(j>-2){if(j<0||txt.charAt(j).toLowerCase()===txt.charAt(j)){break}}}if(k<12){fields[field++]=k+1;break}}}}}}if(field<iLen){fields[field]=v}return fields},_fields0:function(txt){var x,k,j=-1,i=-1,v=-1,field=-1,n=22,mask=this._mask,fields=[];if(!txt){txt=""}while(++i<mask.length){j++;x=mask.charCodeAt(i);if(x>21&&n>21){continue}if(x>21){if(field>=0){fields[field]=v}}else{if(n>21){v=-1;field++}if(j<txt.length){if(x>18){k=this._jpn(txt.charCodeAt(j))-48;if(k>=0&&k<=9){if(v<0){v=k}else{v=v*10+k}}else if(i+1<mask.length&&txt.charAt(j)===mask.charAt(i+1)){j--}}else if(n!==x&&this._isPM(txt.toUpperCase(),j)){v=1}}}n=x}fields[field]=v;return fields},_curField:function(s,mask){var i,x,n=22,field=-1;this._n0=this._n1=-1;for(i=0;i<mask.length;i++){x=mask.charCodeAt(i);if(x>21&&n>21||x<=21&&n<=21){continue}if(x>21){if(i>=s){break}}else{this._n0=i;field++}n=x}if(this._n0>=0){this._n1=i}field=this._field0IDs[field];if(_aNull(field)){return-1}if(field<8){return field<4?0:1}if(field<20){return Math.floor((field-4)/2)}return field>21?8:-1},_maskKey:function(k,ch,txt,i,s,mask){var field,n=0,v=-1;if(this._type<2){return-2}field=this._curField(s,mask);if(s>=this._n1){if(txt.charCodeAt(--s)>21){return this._maskKey(k,ch,txt,i,s+2,mask)}}if(field<0){return-1}if(field===5){if(s<=this._n0){v=this._optVal("am");ch=ch.toUpperCase();if(v.charAt(0).toUpperCase()!==ch){v=this._optVal("pm");if(v.charAt(0).toUpperCase()!==ch){return-1}}i=v.length;if(this._n1===this._n0+1){v=v.charAt(0)}else if(i<2){v+=" "}else if(i>2){v=v.substring(0,2)}this._txt=txt.substring(0,this._n0)+v+txt.substring(this._n1)}return this._n1}if(k<48||k>57){if(s===0||k!==47&&k!==58&&(k<44||k>57)){return-1}if(mask.charCodeAt(s-1)>=22||this._n1===i){return s}while(s<i){if(mask.charCodeAt(s++)>=22){break}txt=txt.substring(0,s-1)+mask.charAt(s-1)+txt.substring(s)}this._txt=txt;return s}k-=48;if(this._n0===s){v=txt.charCodeAt(s+1)-48;if(field===2){if(k>3){n=1}else if(k===3&&v>1){n=2}}else if(field===6||field===7){if(k>5){n=1}}else if(field>0&&field<5){if(field===4){k--;v-=2}if(k>1){n=1}else if(k===1&&v>2){n=2}}}if(this._n0+1===s){v=txt.charCodeAt(s-1)-48;if(field===2){if(v>3||v===3&&k>1){n=3}}else if(field===6||field===7){if(v>6||v===6&&k>0){n=3}}else if(field>0&&field<5){if(field===4){v--;k-=2}if(v>1||v===1&&k>2){n=3}}}if(n===1){txt=txt.substring(0,s)+mask.charAt(s)+txt.substring(s+1);s++}if(n===2){txt=txt.substring(0,s+1)+mask.charAt(s+1)+txt.substring(s+2)}if(n===3){while(++s<i){if(mask.charCodeAt(s)<22){break}}if(s>=i){return-1}return this._maskKey(k+48,ch,txt,i,s,mask)}this._txt=txt.substring(0,s)+ch+txt.substring(s+1);return++s},_add:function(v0,v){var dot0,dot1,dot2,s1,s2=v.toString(),s0=v0.toString(),v1=v0+v;s1=v1.toString();dot0=s0.indexOf(".");dot1=s1.indexOf(".");if(dot0<1||dot1<1){return v1}dot2=s2.indexOf(".");if(dot2>0){dot2=s2.length-dot2}dot0=Math.max(dot2,s0.length-dot0);if(s1.length-dot1<=dot0){return v1}v=10;while(dot0-->2){v*=10}return Math.round(v1*v)/v},spin:function(delta){var val,x,i,d,o=this.options;if(!this._spinList(delta)){return this}if(this._type<2){return this}if(this._type>3){val=this._toNum(this._val())||0;val=this._add(val,delta);delta=o.maxLength;if(!delta||delta<1||val.toString().length<=delta){this._set_val(val,this._fcs)}return this}i=this._spinField;d=this._df();d.setTime(this._date.getTime());if(i<0||i>8){if(this._fcs===2){this.getSelectedText();i=this._curField(this._sel0,this._mask);d=this._toDate(this._val(),true,true);if(_aNull(d)){d=this._df()}this._spinField=i}else{this._spinField=i=this.d_s}}if(i===5){delta=delta>0?12:-12}x=o.spin1Field;switch(i){case 0:delta+=this._df(d,0);this._df(d,0,delta);if(x&&delta!==this._df(d,0)){i=-1}break;case 1:delta+=this._df(d,1);this._df(d,1,delta);if(x&&delta!==this._df(d,1)){i=-1}break;case 2:delta+=this._df(d,2);this._df(d,2,delta);if(x&&delta!==this._df(d,2)){i=-1}break;case 3:case 4:case 5:i=this._df(d,2);delta+=this._df(d,3);this._df(d,3,delta);if(x&&i!==this._df(d,2)){i=-1}break;case 6:delta+=this._df(d,4);this._df(d,4,delta);if(x&&delta!==this._df(d,4)){i=-1}break;case 7:delta+=this._df(d,5);this._df(d,5,delta);if(x&&delta!==this._df(d,5)){i=-1}break;case 8:for(i=this._n1-this._n0;i<3;i++){delta*=10}delta+=this._df(d,6);this._df(d,6,delta);if(x&&delta!==this._df(d,6)){i=-1}break}if(i<0){return this}delta=this._limits(d);if(!_aNull(delta)){d=delta}this._text=this._toTxt(d,this._fcs===2,o.promptChar,true);this._date=d;this._isNull=false;this._repaint();this.select(this._sel0);if(this._fcs===2){this._last=this._val()}return this},_mode:function(mode,t){var mods;if(!mode||t<1){mode=_aNull(mode)?t>3?1:t===1?5:0:0}else if(typeof mode!=="number"){mode=mode.toString().toLowerCase();if(t>3){mods={text:-1,editmodetext:0,"double":1,"float":2,decimal:3,"long":4,ulong:5,"int":6,uint:7,"short":8,ushort:9,sbyte:10,"byte":11}}else if(t>1){mods={date:0,editmodetext:1,text:2}}else if(t>0){mods={rawtext:0,rawtextwithrequiredprompts:1,rawtextwithallprompts:2,rawtextwithliterals:3,rawtextwithrequiredpromptsandliterals:4,alltext:5}}mode=mods[mode];if(_aNull(mode)){mode=-2}}return mode<-1?t>3?1:0:mode},_fixMode:function(init){var len,format,mask,mask1,mode,t=this._type,o=this.options,val=this._value;this._dataMode=mode=this._mode(o.dataMode,t);this._maxLen=o.maxLength;if(t>0&&t<4){if(!o.promptChar){o.promptChar="_"}if(!o.padChar){o.padChar=" "}if(!o.emptyChar){o.emptyChar=" "}if(t===1&&init){t=o.inputMask;this._setMask(t||"CCCCCCCCCC")}}if(t<2){if(init===3){this._setVal(val)}return}if(t<4){format=o.dateInputFormat=o.dateInputFormat||"date";if(!o.yearShift){o.yearShift=0}if(_aNull(o.centuryThreshold)){o.centuryThreshold=29}if(_aNull(o.minNumberOfDateFields)){o.minNumberOfDateFields=3}mask=this._optVal(format+"Pattern")||format;format=o.dateDisplayFormat||format;mask1=this._optVal(format+"Pattern")||format||mask;this._field0IDs=[];mask=this._getMask(this._field0IDs,mask,1);this._field1IDs=[];this._mask1=this._getMask(this._field1IDs,mask1);if(init===1){this._date=this._df();this._isNull=false}this._spinField=-1;this.d_s=10;this._setMask(mask);if(init!==1&&!this._isNull){this._setVal(this._date,1)}return}if(mode>3&&this._maxLen<1){len=3;if(mode<6){len=19}else if(mode<8){len=10}else if(mode<10){len=5}this._field[0].maxLength=this._maxLen=len+(mode+1)%2}if(init===3){this._setVal(val,1)}if(!init&&(val||val===0)){this._setVal(val/this._prop(7))}},_toNum:function(txt,limit,fire){var val,min=null,max=null,invMes,o=this.options,num=txt,len=0;if(typeof txt!=="number"){txt=_str(txt);len=txt.length;num=parseFloat(this._txtAsNum(txt))}if(isNaN(num)){num=null}else if(!isFinite(num)){num=num===Number.NEGATIVE_INFINITY?-Number.MAX_VALUE:Number.MAX_VALUE}val=limit?this._limits(num):num;if(fire&&(val!==num||_aNull(val,1)&&len>0)){fire=_aNull(num,1)?len===0?"null":"format":"limit";if(_aNull(num,1)){if(len===0){fire="null";invMes=this._optVal("required",2)}else{fire="format";invMes=this._optVal("number",2)}}else{fire="limit";limit=null;min=o.minValue;if(_aNull(min,1)){min=this._prop(10);if(!_aNull(min,1)){if(min!==val){min=null}}}max=o.maxValue;if(_aNull(max,1)){max=this._prop(11);if(!_aNull(max,1)){if(max!==val){max=null}}}invMes=_aNull(max,1)?this._optVal("min",2).replace("{0}",min.toString(10)):_aNull(min,1)?this._optVal("max",2).replace("{0}",max.toString(10)):this._optVal("range",2).replace("{0}",min.toString(10)).replace("{1}",max.toString(10))}this._inv={value:val,text:txt,reason:fire,message:invMes}}return val},_txtAsNum:function(txt,dec,min){var ch,len=txt.length;if(!dec){dec=this._prop(4)}if(!min){min=this._prop(3)}while(len-->0){ch=this._jpn(txt.charCodeAt(len),true);if(ch){txt=txt.replace(new RegExp(txt.charAt(len),"g"),ch)}}txt=txt.replace("(",txt.indexOf(min)<0?"-":"").replace(this._prop(2),"").replace(new RegExp(min,"g"),"-");txt=txt.replace(dec,"");ch=txt.indexOf(dec);if(ch>0){txt=txt.substring(0,ch)}txt=txt.replace(/[^0-9\-eE\x01]/gm,"").replace("",".");len=txt.length;ch=txt.indexOf("-");if(ch>=0){ch=txt.indexOf("-",ch+1);if(ch+1<len&&ch>0){if(ch>0&&txt.toUpperCase().charAt(ch-1)!=="E"){txt=txt.substring(0,ch)}}len=txt.length;if(txt.toUpperCase().indexOf("E")<0&&ch+1===len){txt="-"+txt.substring(0,len-1)}}return txt==="-"||txt==="."?"":txt},_ePow:function(plus){var pow=this.options.scientificFormat,len=pow?pow.length:0,ch=len?pow.charAt(0):null;return(ch==="e"||ch==="E")&&(len===1||len===2&&pow.charAt(1)==="+")?plus?pow:ch:null},_toTxtNum:function(val,foc,txt,minus,dec,str){var grps,gr0,gr,ch,iL,ePow=this._ePow(),ig=0,iDec=0,i=-1,neg=val,maxDec=this._prop(8);if(_aNull(txt)){if(_aNull(val,1)){return""}neg=val<0;if(neg){val=-val}try{txt=ePow?val.toString(10):val.toFixed(maxDec)}catch(ex){str=txt=_str(val)}return this._toTxtNum(neg,foc,txt.toUpperCase(),_aNull(minus)?this._prop(3):minus,_aNull(dec)?this._prop(4):dec,str)}if(str){txt=this._txtAsNum(txt,dec)}txt=txt.replace("+","");iL=txt.indexOf("E");if(iL>0){ePow=ePow?this._ePow(!foc&&txt.charAt(iL+1)!=="-")+txt.substring(iL+1):txt.substring(iL);txt=txt.substring(0,iL)}else{ePow=""}iL=txt.length;if(_aNull(neg)){if(iL===0){return foc?txt:""}neg=this._isMinus(txt.charCodeAt(0));if(neg){txt=txt.substring(1);iL--}}while(++i<iL){ch=txt.charCodeAt(i);if(ch<48||ch>57){txt=txt.substring(0,i)+txt.substring(i+1);iL--;break}}while(i<iL){if(txt.charCodeAt(iL-1)!==48){break}txt=txt.substring(0,--iL)}iL=i;if(maxDec>0&&iL<txt.length){iDec=txt.length-iL;txt=txt.substring(0,iL)+dec+txt.substring(iL);iL+=dec.length+maxDec}if(iL<txt.length){txt=txt.substring(0,iL)}gr=txt.replace(/0/g,"");if(neg&&(!gr||gr===dec)){neg=false}iL=this._prop(9);if(iL>0){if(iDec===0){txt+=dec}while(iL-->iDec){txt+="0"}}if(foc){txt+=ePow;return neg?minus+txt:txt}grps=this._prop(6);gr=gr0=grps.length>0?grps[0]:0;while(gr>0&&--i>0){if(--gr===0){txt=txt.substring(0,i)+this._prop(5)+txt.substring(i);gr=grps[++ig];if(_aNull(gr)||gr<1){gr=gr0}else{gr0=gr}}}val=this._prop(neg?1:0).replace("n",txt+ePow);return val.replace("$",this._prop(2))},_prop:function(flag){var min,val,sign,o=this.options,t=this._type,mode=this._dataMode;if(flag===13){o=o.selectionOnFocus;return o===-1||o==="select"?-1:o===0||o==="start"?0:o===1||o==="end"?1:2}if(flag===12){return o.maxLength>0?o.maxLength:this._maxLen}if(flag===0){return o.positivePattern||(t===6?this._optVal("percentPositivePattern"):t===5?this._optVal("currencyPositivePattern"):"n")}if(flag===1){val=o.negativePattern||this._optVal(t===6?"percentNegativePattern":t===5?"currencyNegativePattern":"numericNegativePattern");return val.replace("-",this._prop(3))}if(flag===2){val=o.symbol;if(!_aNull(val)){return val}return t===6?this._optVal("percentSymbol"):t===5?this._optVal("currencySymbol"):""}if(flag===3){return this._optVal("negativeSign")||"-"}if(flag===4){return o.decimalSeparator||this._optVal(t===6?"percentDecimalSeparator":t===5?"currencyDecimalSeparator":"numericDecimalSeparator")}if(flag===5){val=o.groupSeparator;if(!_aNull(val)){return val}return this._optVal(t===6?"percentGroupSeparator":t===5?"currencyGroupSeparator":"numericGroupSeparator")}if(flag===6){return o.groups||this._optVal(t===6?"percentGroups":t===5?"currencyGroups":"numericGroups")}if(flag===7){val=o.displayFactor;if(!_aNull(val)){return val}return t===6?this._optVal("percentDisplayFactor"):1}if(flag===8){if(mode>3){return 0}val=o.maxDecimals;if(!_aNull(val)){return val}return this._optVal(t===6?"percentMaxDecimals":t===5?"currencyMaxDecimals":"numericMaxDecimals")}if(flag===9){if(mode>3){return 0}val=o.minDecimals;if(!_aNull(val)){return val}return this._optVal(t===6?"percentMinDecimals":t===5?"currencyMinDecimals":"numericMinDecimals")}min=flag===10;if(min||flag===11){val=min?o.minValue:o.maxValue;if(t>3&&typeof val==="string"){val=parseFloat(val)}if(!_aNull(val,1)||t<4||mode<2||mode===3||mode>11){return val}if(mode===2){return min?-3.40282347e38:3.40282347e38}val=127;sign=mode%2===0;if(!sign&&min){return 0}if(mode<6){val=0x8000000000000000}else if(mode<8){val=2147483647}else if(mode<10){val=32767}return sign?min?-(val+1):val:val*2+1}},_isMinus:function(k){return k===this._prop(3).charCodeAt(0)||k===45||k===40&&this._prop(1).indexOf("(")>=0||k===12540||k===65293||k===65288},destroy:function(){var par,e,b,elem=this._element,field=this._field,elem0=this.element,buts=this._buttons,i=buts?buts.length:0;e=elem?elem[0]:null;if(!field||!e){return this}this._stopTimer();this._doDP(3);this._initValidator(1);this._listRemove();field.unbind(this._evts);elem.unbind(this._mEvts);while(i-->0){if(buts[i]){buts[i].unbind(this._touchEvts)}}b=buts&&buts[0]?buts[0][0]:null;if(b&&b.parentNode===e){e.removeChild(b)}b=buts&&buts[1]?buts[1][0].parentNode:null;if(b&&b.parentNode===e){e.removeChild(b)}if(field[0].parentNode===e){e.removeChild(field[0])}if(this._selElem){elem.remove()}else if(this._swap){par=e.parentNode;par.insertBefore(elem0[0],e);par.removeChild(e)}par=this._oldCss;for(i in par){if(par.hasOwnProperty(i)){elem0.css(i,par[i])}}par=this._oldAttr;for(i in par){if(par.hasOwnProperty(i)){elem0[0][i]=par[i]}}elem0[0]._ig_oldCss=null;if(e._wd){e._wd=null}if(e._ht){e._ht=null}elem0=elem=field=this._dp=this._buttons=this._field=this._element=null;this._evts=this._mEvts=this._touchEvts=this._oldAttr=this._oldCss=this._validator=null;$.Widget.prototype.destroy.apply(this,arguments);return this}});$.extend($.ui.igEditor,{version:"13.1.20131.2523"});$.ui.igEditor.setDefaultCulture=function(regional){$.ig.regional=$.ig.regional||{};$.ig.regional.defaults=$.extend($.ig._regional,typeof regional==="string"?$.ig.regional[regional]:regional);if(regional==="en"||regional==="en-US"){regional=""}if($.datepicker&&$.datepicker.regional&&$.datepicker.regional[regional]){$.datepicker.setDefaults($.datepicker.regional[regional])}};$.widget("ui.igTextEditor",$.ui.igEditor,{options:{textMode:null,maxLength:0,includeKeys:null,excludeKeys:null,toUpper:false,toLower:false,listMatchIgnoreCase:true,listMatchOnly:false,listMatchContains:false,listAutoComplete:false},_create:function(){$.ui.igEditor.prototype._create.apply(this,[0])}});$.widget("ui.igMaskEditor",$.ui.igEditor,{options:{includeKeys:null,excludeKeys:null,toUpper:false,toLower:false,listMatchIgnoreCase:true,listMatchOnly:false,listMatchContains:false,listAutoComplete:false,inputMask:"CCCCCCCCCC",promptChar:"_",padChar:" ",emptyChar:" ",dataMode:"alltext",hideMaskOnFocus:false},_create:function(){$.ui.igEditor.prototype._create.apply(this,[1])}});$.widget("ui.igDateEditor",$.ui.igEditor,{options:{regional:null,spin1Field:false,minValue:null,maxValue:null,dateDisplayFormat:null,dateInputFormat:null,promptChar:"_",dataMode:"date",minNumberOfDateFields:3,useLastGoodDate:false,reduceDayOfInvalidDate:true,hideMaskOnFocus:false,centuryThreshold:29,enableUTCDates:false,spinDelta:1,nullable:true,yearShift:0},_create:function(){$.ui.igEditor.prototype._create.apply(this,[2])}});$.widget("ui.igDatePicker",$.ui.igDateEditor,{options:{button:"dropdown",focusOnDropDownOpen:null,datepickerOptions:null},_create:function(){$.ui.igEditor.prototype._create.apply(this,[3])}});$.widget("ui.igNumericEditor",$.ui.igEditor,{options:{regional:null,negativePattern:null,negativeSign:null,decimalSeparator:null,groupSeparator:null,groups:null,maxDecimals:null,minDecimals:null,minValue:null,maxValue:null,scientificFormat:null,nullValue:null,spinDelta:1,nullable:true,maxLength:0,dataMode:"double"},_create:function(){$.ui.igEditor.prototype._create.apply(this,[4])}});$.widget("ui.igCurrencyEditor",$.ui.igNumericEditor,{options:{positivePattern:null,negativePattern:null,symbol:null},_create:function(){$.ui.igEditor.prototype._create.apply(this,[5])}});$.widget("ui.igPercentEditor",$.ui.igNumericEditor,{options:{positivePattern:null,negativePattern:null,symbol:null,displayFactor:null},_create:function(){$.ui.igEditor.prototype._create.apply(this,[6])}})})(jQuery);