Files
rrene 927295c7ba Revert "-- corr"
This reverts commit 5315c47fcd.
2024-11-05 10:55:34 -07:00

1 line
30 KiB
JavaScript

Type.registerNamespace("Sys.Extended.UI");Sys.Extended.UI.ComboBoxAutoCompleteMode=function(){};Sys.Extended.UI.ComboBoxAutoCompleteMode.prototype={None:0,Append:1,Suggest:2,SuggestAppend:3};Sys.Extended.UI.ComboBoxAutoCompleteMode.registerEnum("Sys.Extended.UI.ComboBoxAutoCompleteMode",!1);Sys.Extended.UI.ComboBoxStyle=function(){};Sys.Extended.UI.ComboBoxStyle.prototype={DropDownList:0,DropDown:1,Simple:2};Sys.Extended.UI.ComboBoxStyle.registerEnum("Sys.Extended.UI.ComboBoxStyle",!1);Sys.Extended.UI.ComboBoxTextSelectionStrategy=function(){};Sys.Extended.UI.ComboBoxTextSelectionStrategy.prototype={Unknown:0,Microsoft:1,W3C:2};Sys.Extended.UI.ComboBoxTextSelectionStrategy.registerEnum("Sys.Extended.UI.ComboBoxTextSelectionStrategy",!1);Sys.Extended.UI.ComboBox=function(n){Sys.Extended.UI.ComboBox.initializeBase(this,[n]);this._comboTableControl=null;this._textBoxControl=null;this._optionListControl=null;this._buttonControl=null;this._hiddenFieldControl=null;this._autoPostBack=!1;this._autoCompleteMode=null;this._dropDownStyle=null;this._caseSensitive=!1;this._originalSelectedIndex=null;this._listItemHoverCssClass=null;this._popupBehavior=null;this._supressFocusHide=!0;this._doingPostBack=!1;this._textSelectionStrategy=null;this._highlightSuggestedItem=!1;this._highlightedIndex=null;this._optionListItems=null;this._optionListItemHeight=null;this._optionListHeight=null;this._optionListWidth=null;this.clearDelegates()};Sys.Extended.UI.ComboBox.prototype={initialize:function(){Sys.Extended.UI.ComboBox.callBaseMethod(this,"initialize");ComboBox_Elements[ComboBox_Elements.length]=this;var n=this._findHiddenParent(this.get_comboTableControl()),t,i;n!=null&&(t=n.style.display,i=n.style.visibility,n.style.visibility="visible",n.style.display="block");this.createDelegates();this.initializeTextBox();this.initializeButton();this.initializeOptionList();this.addHandlers();n!=null&&(n.style.visibility=i,n.style.display=t)},dispose:function(){this._popupBehavior&&(this._popupBehavior.remove_showing(this._popupShowingHandler),this._popupBehavior.remove_shown(this._popupShownHandler),this._popupBehavior.remove_hiding(this._popupHidingHandler),this._popupBehavior.dispose(),this._popupBehavior=null);this.clearHandlers();this.clearDelegates();Sys.Extended.UI.ComboBox.callBaseMethod(this,"dispose")},_findHiddenParent:function(n){var t=n.parentElement;return t==null||t.style.visibility=="hidden"||t.style.display=="none"?t:this._findHiddenParent(t)},createDelegates:function(){this._listMouseOverHandler=Function.createDelegate(this,this._onListMouseOver);this._listMouseOutHandler=Function.createDelegate(this,this._onListMouseOut);this._listMouseDownHandler=Function.createDelegate(this,this._onListMouseDown);this._listClickHandler=Function.createDelegate(this,this._onListClick);this._listDragHandler=Function.createDelegate(this,this._onListDrag);this._listSelectStartHandler=Function.createDelegate(this,this._onListSelectStart);this._listMouseWheelHandler=Function.createDelegate(this,this._onListMouseWheel);this._textBoxClickHandler=Function.createDelegate(this,this._onTextBoxClick);this._textBoxFocusHandler=Function.createDelegate(this,this._onTextBoxFocus);this._textBoxBlurHandler=Function.createDelegate(this,this._onTextBoxBlur);this._textBoxKeyPressHandler=Function.createDelegate(this,this._onTextBoxKeyPress);this._textBoxKeyDownHandler=Function.createDelegate(this,this._onTextBoxKeyDown);this._buttonClickHandler=Function.createDelegate(this,this._onButtonClick);this._buttonBlurHandler=Function.createDelegate(this,this._onButtonBlur);this._buttonKeyDownHandler=Function.createDelegate(this,this._onButtonKeyDown);this._buttonKeyPressHandler=Function.createDelegate(this,this._onButtonKeyPress);this._documentClickHandler=Function.createDelegate(this,this._onDocumentClick);this._documentMouseWheelHandler=Function.createDelegate(this,this._onDocumentMouseWheel);this._popupShowingHandler=Function.createDelegate(this,this._popupShowing);this._popupShownHandler=Function.createDelegate(this,this._popupShown);this._popupHidingHandler=Function.createDelegate(this,this._popupHiding)},clearDelegates:function(){this._listMouseOverHandler=null;this._listMouseOutHandler=null;this._listMouseDownHandler=null;this._listClickHandler=null;this._listDragHandler=null;this._listSelectStartHandler=null;this._listMouseWheelHandler=null;this._textBoxClickHandler=null;this._textBoxFocusHandler=null;this._textBoxBlurHandler=null;this._textBoxKeyPressHandler=null;this._textBoxKeyDownHandler=null;this._buttonClickHandler=null;this._buttonBlurHandler=null;this._buttonKeyDownHandler=null;this._buttonKeyPressHandler=null;this._documentClickHandler=null;this._documentMouseWheelHandler=null;this._popupShowingHandler=null;this._popupShownHandler=null;this._popupHidingHandler=null},addHandlers:function(){var n=this.get_optionListControl();$addHandlers(n,{mouseover:this._listMouseOverHandler,mouseout:this._listMouseOutHandler,mousedown:this._listMouseDownHandler,click:this._listClickHandler,drag:this._listDragHandler,selectstart:this._listSelectStartHandler},this);$addHandlers(this.get_textBoxControl(),{click:this._textBoxClickHandler,focus:this._textBoxFocusHandler,blur:this._textBoxBlurHandler,keypress:this._textBoxKeyPressHandler},this);(Sys.Browser.agent==Sys.Browser.InternetExplorer||Sys.Browser.agent===Sys.Browser.Safari||Sys.Browser.agent===Sys.Browser.WebKit)&&$addHandler(this.get_textBoxControl(),"keydown",this._textBoxKeyDownHandler);$addHandlers(this.get_buttonControl(),{click:this._buttonClickHandler,blur:this._buttonBlurHandler,keydown:this._buttonKeyDownHandler,keypress:this._buttonKeyPressHandler},this);$addHandler(document,"click",this._documentClickHandler);typeof n.onmousewheel=="undefined"?($addHandler(n,"DOMMouseScroll",this._listMouseWheelHandler),$addHandler(document,"DOMMouseScroll",this._documentMouseWheelHandler)):($addHandler(n,"mousewheel",this._listMouseWheelHandler),$addHandler(document,"mousewheel",this._documentMouseWheelHandler))},clearHandlers:function(){$clearHandlers(this.get_optionListControl());$clearHandlers(this.get_textBoxControl());$clearHandlers(this.get_buttonControl());$clearHandlers(document)},initializeTextBox:function(){var n=this.get_textBoxControl().style;n.margin==""&&(n.margin="0px")},initializeButton:function(){var n=this.get_buttonControl().style;n.height==""&&this.get_textBoxControl().offsetHeight>=0&&(n.height=this.get_textBoxControl().offsetHeight+"px");n.width==""&&(n.width=n.height);n.padding==""&&(n.padding="0px");this._buttonControl.style.visibility="visible"},initializeOptionList:function(){var h,t,c,r,o,u,l,f,i,e;if(this.get_optionListControl()==null&&(h=document.createElement("ul"),this.get_element().appendChild(h),this.set_optionListControl(h)),t=this.get_optionListControl(),Sys.Browser.agent===Sys.Browser.Safari||Sys.Browser.agent===Sys.Browser.WebKit){for(c=t.parentNode,c!=null&&c.removeChild(t),r=this.get_element().parentNode;typeof r!=typeof document.forms[0];)r=r.parentNode;o=document.createElement("div");o.className=this.get_element().className;o.appendChild(t);r.appendChild(o)}for(u=t.style,u.display="block",u.zIndex=Sys.Extended.UI.zIndex.ComboBoxList,this._optionListItems=[],l=t.childNodes,f=0;f<l.length;f++){if(i=l[f],i.tagName==undefined||i.tagName.toUpperCase()!="LI"){t.removeChild(i);f--;continue}for(var a={},n=i.innerHTML.trim(),s=n.indexOf("\r");s>=0;)n=n.substring(0,s).trim()+" "+n.substring(s+1,n.length).trim(),s=n.indexOf("\r");for(e=n.indexOf("\n");e>=0;)n=n.substring(0,e).trim()+" "+n.substring(e+1,n.length).trim(),e=n.indexOf("\n");n=n.replace(/\&amp;/g,"&").replace(/\&quot;/g,'"').replace(/\&gt;/g,">").replace(/\&lt;/g,"<");a.text=n.trim();Array.add(this._optionListItems,a);this.initializeOptionListItem(i)}u.width=this._getOptionListBounds().width+"px";u.width="0px";this._popupBehavior=$create(Sys.Extended.UI.PopupBehavior,{id:this.get_id()+"_PopupBehavior",parentElement:this.get_textBoxControl(),positioningMode:Sys.Extended.UI.PositioningMode.BottomLeft},null,null,t);this._popupBehavior.add_showing(this._popupShowingHandler);this._popupBehavior.add_shown(this._popupShownHandler);this._popupBehavior.add_hiding(this._popupHidingHandler);this.get_selectedIndex()>=0?(this._highlightListItem(this.get_selectedIndex()),this.get_textBoxControl().value=this._optionListItems[this.get_selectedIndex()].text):this.get_textBoxControl().value="";this._popupShowing();t.style.display="none"},initializeOptionListItem:function(n){n._textIsEmpty=!1;n.innerHTML.length<1&&(n.innerHTML="&nbsp;",n._textIsEmpty=!0)},_popupShowing:function(){var t=this._getWindowBounds(),i=Sys.UI.DomElement.getBounds(this.get_comboTableControl()),c=this._getOptionListBounds(),a=t.y+t.height/2,v=i.y+i.height,y=t.x+t.width/2,p=i.x+i.width/2,r=i.y-t.y,s="Top",h,n,e,f,u,o;v<=a&&(s="Bottom",r=t.height-i.height-r);h=this._getOptionListItemHeight();r=r>=c.height?c.height:h*(Math.floor(r/h)-2);var w=r/h,l=w<this._optionListItems.length;s=="Top"&&r<t.height-i.y&&(s="Bottom");n=i.x-t.x;e="Left";p<=y?n=t.width-n:(e="Right",n=i.width+n);n-=30;f=c.width;l?(f+=20,n>=f&&(n=f)):n>=f&&(n=f);e=="Right"&&n<t.width-i.x&&(e="Left");r<0&&(r=0);n<0&&(n=0);u=this.get_optionListControl().style;u.height=r+"px";u.width=n+"px";l?(u.overflow="auto",u.overflowX="hidden"):u.overflow="hidden";o=s+e;o=="BottomLeft"?this._popupBehavior.set_positioningMode(Sys.Extended.UI.PositioningMode.BottomLeft):o=="BottomRight"?this._popupBehavior.set_positioningMode(Sys.Extended.UI.PositioningMode.BottomRight):o=="TopLeft"?this._popupBehavior.set_positioningMode(Sys.Extended.UI.PositioningMode.TopLeft):o=="TopRight"&&this._popupBehavior.set_positioningMode(Sys.Extended.UI.PositioningMode.TopRight);u.visibility="hidden"},_popupShown:function(){var n=this.get_optionListControl();n.style.display="block";var f=Sys.UI.DomElement.getBounds(this.get_comboTableControl()),r=Sys.UI.DomElement.getBounds(n),t=Sys.UI.DomElement.getBounds(this.get_textBoxControl()),u=r.y,i;this._popupBehavior.get_positioningMode()===Sys.Extended.UI.PositioningMode.BottomLeft||this._popupBehavior.get_positioningMode()===Sys.Extended.UI.PositioningMode.TopLeft?i=t.x:(this._popupBehavior.get_positioningMode()===Sys.Extended.UI.PositioningMode.BottomRight||this._popupBehavior.get_positioningMode()===Sys.Extended.UI.PositioningMode.TopRight)&&(i=t.x-(r.width-t.width));Sys.UI.DomElement.setLocation(n,i,u);this._ensureHighlightedIndex();this._ensureScrollTop();n.style.visibility="visible"},_popupHiding:function(){this._highlightSuggestedItem=!1;var n=this.get_optionListControl().style;n.display="none";n.visibility="hidden"},_onButtonClick:function(n){return Sys.Extended.UI.ComboBox.IsOpen(this),this.get_dropDownStyle()==Sys.Extended.UI.ComboBoxStyle.Simple?this._popupBehavior.show():this._popupBehavior._visible?this._popupBehavior.hide():this._popupBehavior.show(),n.preventDefault(),n.stopPropagation(),!1},_onButtonBlur:function(){this.get_autoPostBack()!=!0||this._doingPostBack||this._originalSelectedIndex==this.get_selectedIndex()||(this._doingPostBack=!0,__doPostBack(this.get_element().id,""))},_onButtonKeyDown:function(n){if(n.keyCode==Sys.UI.Key.tab||n.keyCode==16)return!0;this._popupBehavior._visible||n.keyCode!=Sys.UI.Key.enter&&n.keyCode!=Sys.UI.Key.down?this._popupBehavior._visible&&(n.keyCode==Sys.UI.Key.enter||n.keyCode==Sys.UI.Key.up)&&this._popupBehavior.hide():this._popupBehavior.show();n.stopPropagation();n.preventDefault();var t=this.get_textBoxControl().id;return setTimeout(function(){document.getElementById(t).focus()},0),!1},_onButtonKeyPress:function(n){return n.charCode==Sys.UI.Key.tab||n.charCode==16?!0:(n.stopPropagation(),n.preventDefault(),!1)},_onListMouseWheel:function(n){var t;return t=typeof n.rawEvent.wheelDelta=="undefined"?n.rawEvent.detail>=1?1:-1:n.rawEvent.wheelDelta>1?-1:1,this.get_optionListControl().scrollTop+=this._getOptionListItemHeight()*t,n.stopPropagation(),n.preventDefault(),!1},_onListMouseOver:function(n){var r=this.get_optionListControl(),u,i,t;if(n.target!==r)for(u=n.target,i=r.childNodes,t=0;t<i.length;++t)if(u===i[t]){this._highlightListItem(t,!0);break}},_onListMouseOut:function(){this._popupBehavior._visible&&this.get_autoCompleteMode()==Sys.Extended.UI.ComboBoxAutoCompleteMode.SuggestAppend&&this._highlightListItem(this._highlightedIndex,!1)},_onListMouseDown:function(n){var t=this.get_optionListControl(),r,i;if(n.target==t||n.target.tagName=="scrollbar")return!0;if(n.target!==t)r=t.childNodes[this._highlightedIndex],i=this._optionListItems[this._highlightedIndex].text,this.get_textBoxControl().value=i,this.set_selectedIndex(this._highlightedIndex),this._supressFocusHide=!1,this._handleTextBoxFocus(null);else return!0;return n.preventDefault(),n.stopPropagation(),!1},_onListClick:function(n){return n.target==this.get_optionListControl()?!0:(n.preventDefault(),n.stopPropagation(),!1)},_onListDrag:function(n){return n.preventDefault(),n.stopPropagation(),!1},_onListSelectStart:function(n){return n.preventDefault(),n.stopPropagation(),!1},_onTextBoxClick:function(n){return this.get_dropDownStyle()==Sys.Extended.UI.ComboBoxStyle.Simple&&this._popupBehavior.show(),n.preventDefault(),n.stopPropagation(),!1},_onTextBoxFocus:function(n){Sys.Extended.UI.ComboBox.IsOpen(this);this._handleTextBoxFocus(n)},_onTextBoxBlur:function(){for(var r,i=this.get_textBoxControl().value.trim(),n=-3,t=0;t<this._optionListItems.length;t++)if(r=this._optionListItems[t],this._isExactMatch(r.text,i)){n=t;break}this._highlightSuggestedItem==!0&&this._highlightedIndex!=null&&this._highlightedIndex>=0?(this.set_selectedIndex(this._highlightedIndex),this.get_textBoxControl().value=this._optionListItems[this.get_selectedIndex()].text):n==-3&&i.length>0&&this.get_dropDownStyle()!=Sys.Extended.UI.ComboBoxStyle.DropDownList?this.set_selectedIndex(-2):this._optionListItems.length<1&&(i==""||this.get_dropDownStyle()==Sys.Extended.UI.ComboBoxStyle.DropDownList)?(this.set_selectedIndex(-1),this.get_textBoxControl().value=""):this._optionListItems.length>=0&&n==-3&&this.get_dropDownStyle()==Sys.Extended.UI.ComboBoxStyle.DropDownList?(this.set_selectedIndex(0),this.get_textBoxControl().value=this._optionListItems[0].text):n>=0&&(this.set_selectedIndex(n),this.get_textBoxControl().value=this._optionListItems[n].text);this._popupBehavior.hide();this.get_autoPostBack()!=!0||this._doingPostBack||this._originalSelectedIndex==this.get_selectedIndex()||(this._doingPostBack=!0,__doPostBack(this.get_element().id,""))},_onTextBoxKeyDown:function(n){var i=this._handleEnterKey(n),t;return i!=null?i:(this._handleArrowKey(n),t=this._handleErasureKeys(n),t!=null)?t:!0},_onTextBoxKeyPress:function(n){var c=this._handleEnterKey(n),e,o,f,h;if(c!=null)return c;if(e=this._handleArrowKey(n),e!=null)return e;if(o=this._handleNonCharacterKey(n),o!=null)return o;if(this.get_dropDownStyle()!=Sys.Extended.UI.ComboBoxStyle.Simple||this._popupBehavior._visible||this._popupBehavior.show(),this.get_selectedIndex()==-1&&this.get_dropDownStyle()==Sys.Extended.UI.ComboBoxStyle.DropDownList&&this._optionListItems.length==0)return this.get_textBoxControl().value="",n.preventDefault(),n.stopPropagation(),!1;var t=this._getTextSelectionInfo(this.get_textBoxControl(),n),r=t.selectionStart,u=t.selectionEnd,l=t.selectionPrefix+t.typedCharacter+t.selectionText.substring(1)+t.selectionSuffix,i=t.selectionPrefix+t.typedCharacter,s=this.get_textBoxControl().maxLength;return(s<0&&(s=Number.MAX_VALUE),i.length>s&&(i=i.substring(0,this.get_textBoxControl().maxLength)),f=this._suggestIndex(l,i),(this.get_autoCompleteMode()==Sys.Extended.UI.ComboBoxAutoCompleteMode.Suggest||this.get_autoCompleteMode()==Sys.Extended.UI.ComboBoxAutoCompleteMode.SuggestAppend)&&(this._highlightSuggestedItem=!0,this._popupBehavior._visible||this._popupBehavior.show()),f>=0?this.get_autoCompleteMode()==Sys.Extended.UI.ComboBoxAutoCompleteMode.Append||this.get_autoCompleteMode()==Sys.Extended.UI.ComboBoxAutoCompleteMode.SuggestAppend?(this.get_textBoxControl().value=this._optionListItems[f].text,r=t.selectionStart+1,u=this.get_textBoxControl().value.length):(this.get_textBoxControl().value=this._optionListItems[f].text.substring(0,i.length),r=this.get_textBoxControl().value.length,u=this.get_textBoxControl().value.length):(this.get_dropDownStyle()==Sys.Extended.UI.ComboBoxStyle.Simple||this.get_dropDownStyle()==Sys.Extended.UI.ComboBoxStyle.DropDown)&&(this.get_textBoxControl().value=i,r=i.length,u=i.length),h=this._handleErasureKeys(n),h!=null)?h:(this._ensureHighlightedIndex(),this._ensureScrollTop(),this._setTextSelectionRange(this.get_textBoxControl(),r,u),n.preventDefault(),n.stopPropagation(),!1)},_onDocumentClick:function(){this._popupBehavior._visible&&this._popupBehavior.hide()},_onDocumentMouseWheel:function(){return this._popupBehavior&&this._popupBehavior.hide(),!0},_handleTextBoxFocus:function(n){!this._supressFocusHide&&this._popupBehavior._visible&&(this._popupBehavior.hide(),this._supressFocusHide=!0,this.get_autoPostBack()&&!this._doingPostBack&&this._originalSelectedIndex!=this.get_selectedIndex()&&(this._doingPostBack=!0,__doPostBack(this.get_element().id,"")));this.get_dropDownStyle()==Sys.Extended.UI.ComboBoxStyle.Simple&&this._popupBehavior.show();this._setTextSelectionRange(this.get_textBoxControl(),0,this.get_textBoxControl().value.length);n!=null&&(n.preventDefault(),n.stopPropagation())},_highlightListItem:function(n,t){if(n==undefined||n<0){this._highlightedIndex!=undefined&&this._highlightedIndex>=0&&this._highlightListItem(this._highlightedIndex,!1);return}var r=this.get_optionListControl().childNodes,i=r[n];if(t==!0){if(this._highlightedIndex==n)return;n>=0&&(this.get_listItemHoverCssClass()==undefined||this.get_listItemHoverCssClass()==""?(i.style.backgroundColor="Highlight",i.style.color="HighlightText"):i.className=this.get_listItemHoverCssClass);this._highlightedIndex!=null&&this._highlightedIndex!=n&&this._highlightedIndex>=0&&this._highlightListItem(this._highlightedIndex,!1);this._highlightedIndex=n}else this.get_listItemHoverCssClass()==undefined||this.get_listItemHoverCssClass()==""?(i.style.backgroundColor="",i.style.color=""):i.className="",n==this._highlightedIndex&&(this._highlightedIndex=-1)},_suggestIndex:function(n,t){for(var e,o,f=-1,i=!1,u=!1,r=0;r<this._optionListItems.length;r++)if((itemText=this._optionListItems[r].text,!(itemText.length<1))&&itemText.substring(0,1).toLowerCase()==t.substring(0,1).toLowerCase())if(e=itemText.substring(0,n.length),u=e==n,u||this.get_caseSensitive()||(u=e.toLowerCase()==n.toLowerCase()),u){f=r;break}else i||(o=itemText.substring(0,t.length),i=o==t,i||this.get_caseSensitive()||(i=o.toLowerCase()==t.toLowerCase()),i&&(f=r));return f},_getKeyboardCode:function(n){return n.type=="keypress"?n.charCode:n.type=="keydown"?n.keyCode:undefined},_handleArrowKey:function(n){var t,i,r;return n.shiftKey==!0?null:(t=this._getKeyboardCode(n),t==Sys.UI.Key.up||t==Sys.UI.Key.down)?(this._popupBehavior._visible||(this._popupBehavior.show(),this._highlightedIndex=this._highlightedIndex||-1),i=t-39,(i==-1&&this._highlightedIndex>0||i==1&&this._highlightedIndex<this._optionListItems.length-1)&&(r=this._highlightedIndex+i,this.get_textBoxControl().value=this._optionListItems[r].text,this._highlightListItem(r,!0),this.set_selectedIndex(r),this._ensureScrollTop()),n.type=="keypress")?(n.preventDefault(),n.stopPropagation(),!1):!0:null},_handleEnterKey:function(n){var t=this._getKeyboardCode(n);return t==Sys.UI.Key.enter?this._popupBehavior._visible?(this._highlightedIndex>=0&&(this.get_textBoxControl().value=this._optionListItems[this._highlightedIndex].text,this.set_selectedIndex(this._highlightedIndex),__doPostBack(this.get_element().id,"")),this._popupBehavior.hide(),n.preventDefault(),n.stopPropagation(),!1):this.get_dropDownStyle()==Sys.Extended.UI.ComboBoxStyle.Simple||this.get_dropDownStyle()==Sys.Extended.UI.ComboBoxStyle.DropDown||this._highlightedIndex==this.get_selectedIndex()?!0:(n.preventDefault(),n.stopPropagation(),!1):null},_handleErasureKeys:function(n){var o=this._getKeyboardCode(n),s=o==Sys.UI.Key.backspace,f=o==Sys.UI.Key.del,t,r,u,i,e,h;return(typeof event=="undefined"&&n.type=="keypress"&&(f=n.rawEvent.keyCode==46),s||f)?(t=this._getTextSelectionInfo(this.get_textBoxControl(),n),t.selectionStart<t.selectionEnd?(this.get_textBoxControl().value=t.selectionPrefix+t.selectionSuffix,r=t.selectionStart,u=t.selectionStart):t.selectionStart==t.selectionEnd&&(s&&t.selectionStart>0?(e=1,t.selectionPrefix.charCodeAt(t.selectionPrefix.length-1)==8&&(e=2),i=t.selectionPrefix.substr(0,t.selectionPrefix.length-e),i+=t.selectionSuffix,this.get_textBoxControl().value=i,r=t.selectionStart-1,u=t.selectionStart-1):f&&t.selectionStart<t.textBoxValue.length&&(i=t.selectionSuffix,i=t.selectionPrefix+i.substr(1,t.selectionSuffix.length-1),this.get_textBoxControl().value=i,r=t.selectionStart,u=t.selectionStart,this._setTextSelectionRange(this.get_textBoxControl(),t.selectionStart,t.selectionStart))),this._ensureHighlightedIndex(),this._ensureScrollTop(),this._setTextSelectionRange(this.get_textBoxControl(),r,u),(this.get_dropDownStyle()==Sys.Extended.UI.ComboBoxStyle.Simple||this.get_dropDownStyle()==Sys.Extended.UI.ComboBoxStyle.DropDown)&&(this.get_autoCompleteMode()==Sys.Extended.UI.ComboBoxAutoCompleteMode.Suggest||this.get_autoCompleteMode()==Sys.Extended.UI.ComboBoxAutoCompleteMode.SuggestAppend)&&this._highlightedIndex!=null&&this._highlightedIndex>=0&&(h=this._isExactMatch(this._optionListItems[this._highlightedIndex].text,this.get_textBoxControl().value),h||this._highlightListItem(this._highlightedIndex,!1)),n.preventDefault(),n.stopPropagation(),!1):null},_handleNonCharacterKey:function(n){var t=this._getKeyboardCode(n),r=t==Sys.UI.Key.backspace,i=t==Sys.UI.Key.del;return(n.type=="keypress"&&(i=n.rawEvent.code==46),r||i)?null:this._isNonCharacterKey(n)?t==Sys.UI.Key.esc?(this._popupBehavior.hide(),this.get_textBoxControl().blur(),n.preventDefault(),n.stopPropagation(),!1):!0:null},_isNonCharacterKey:function(n){var t=this._getKeyboardCode(n);if(t==Sys.UI.Key.enter||t==Sys.UI.Key.esc)return!0;if(Sys.Browser.agent==Sys.Browser.Safari&&Sys.Browser.version<500){if(t==8||t==9||t==63272||t==63276||t==63277||t==63275||t==63273||t==63234||t==63235||t>=63236&&t<=63243||t==63248)return!0}else if(Sys.Browser.agent==Sys.Browser.WebKit){if(t==8||t==9||t==19||t==33||t==34||t==35||t==36||t==37||t==39||t==45||t==46||t==91||t==92||t==93||t==113||t==115||t==118||t==119||t==120||t==122||t==145)return!0}else if(Sys.Browser.agent!=Sys.Browser.InternetExplorer)if(t==8||t==9||t==33||t==34||t==35||t==36||t==37||t==39||t==45||t==46){if(!n.shiftKey)return!0}else{if(t==145||t==19)return!0;if(Sys.Browser.agent==Sys.Browser.Opera){if(t==0||t==16||t==17)return!0}else if(Sys.Browser.agent==Sys.Browser.Firefox&&(t==91||t==92||t==93))return!0}else if(Sys.Browser.agent==Sys.Browser.InternetExplorer&&t==46)return!0;return!1},_ensureScrollTop:function(){var n=this.get_optionListControl();if(this._highlightedIndex>=0){var t=this._getOptionListItemHeight(),i=t*this._highlightedIndex,r=n.scrollTop+n.clientHeight;(i<=n.scrollTop||i>=r)&&(n.scrollTop=this._highlightedIndex*t)}},_ensureSelectedIndex:function(){var n=this.get_hiddenFieldControl().value;n==""&&(n=this._optionListItems.length>0?0:-1,this.get_hiddenFieldControl().value=n.toString());this._originalSelectedIndex==null&&(this._originalSelectedIndex=parseInt(n))},_ensureHighlightedIndex:function(){var i=this.get_textBoxControl().value,t,r,n,u;if(this._highlightedIndex==null||!(this._highlightedIndex>=0)||!this._isExactMatch(this._optionListItems[this._highlightedIndex].text,i)){for(t=-1,r=!1,n=0;n<this._optionListItems.length;n++)if(u=this._optionListItems[n].text,this._isExactMatch(u,i)){this._highlightListItem(n,!0);r=!0;break}else t<0&&this._highlightSuggestedItem&&this._isPrefixMatch(u,i)&&(t=n);r||this._highlightListItem(t,!0)}},_isExactMatch:function(n,t){var i=n==t;return i||this.get_caseSensitive()||(i=n.toLowerCase()==t.toLowerCase()),i},_isPrefixMatch:function(n,t){return this._isExactMatch(n.substring(0,t.length),t)},_setTextSelectionRange:function(n,t,i){var u=this._getTextSelectionStrategy(),r;u==Sys.Extended.UI.ComboBoxTextSelectionStrategy.Microsoft?(r=n.createTextRange(),r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r.select(),Sys.Browser.agent==Sys.Browser.Opera&&n.setSelectionRange(t,i)):u==Sys.Extended.UI.ComboBoxTextSelectionStrategy.W3C&&n.setSelectionRange(t,i)},_getTextSelectionStrategy:function(){return this._textSelectionStrategy==null&&(this._textSelectionStrategy=Sys.Browser.agent===Sys.Browser.InternetExplorer&&Sys.Browser.version<=8?Sys.Extended.UI.ComboBoxTextSelectionStrategy.Microsoft:this.get_textBoxControl().setSelectionRange?Sys.Extended.UI.ComboBoxTextSelectionStrategy.W3C:Sys.Extended.UI.ComboBoxTextSelectionStrategy.Unknown),this._textSelectionStrategy},_getTextSelectionInfo:function(n,t){var i={},r;if(i.strategy=this._getTextSelectionStrategy(),i.strategy==Sys.Extended.UI.ComboBoxTextSelectionStrategy.Microsoft){for(r=document.selection.createRange(),i.selectionStart=0,i.selectionEnd=n.value.length;r.moveStart("character",-1)!=0;)i.selectionStart++;while(r.moveEnd("character",1)!=0)i.selectionEnd--}else i.strategy==Sys.Extended.UI.ComboBoxTextSelectionStrategy.W3C&&(i.selectionStart=n.selectionStart,i.selectionEnd=n.selectionEnd);return i.typedCharacter=String.fromCharCode(t.charCode),i.textBoxValue=n.value,i.selectionPrefix=i.textBoxValue.length>=i.selectionStart?i.textBoxValue.substring(0,i.selectionStart):"",i.selectionText=i.textBoxValue.length>=i.selectionEnd?i.textBoxValue.substring(i.selectionStart,i.selectionEnd):"",i.selectionSuffix=i.textBoxValue.length>=i.selectionEnd?i.textBoxValue.substring(i.selectionEnd,i.textBoxValue.length):"",i.selectionTextFirst=i.selectionText.substring(0,1),i},_getOptionListItemHeight:function(){var n=this.get_optionListControl();return this._optionListItemHeight==null&&n.scrollHeight>0?this._optionListItemHeight=Math.round(n.scrollHeight/this._optionListItems.length):Sys.Browser.agent===Sys.Browser.InternetExplorer&&Sys.Browser.version<7&&Math.round(n.scrollHeight/this._optionListItems.length)<this._optionListItemHeight&&(this._optionListItemHeight=Math.round(n.scrollHeight/this._optionListItems.length)),this._optionListItemHeight},_getOptionListBounds:function(){return{width:this._getOptionListWidth(),height:this._getOptionListHeight()}},_getOptionListHeight:function(){return(this._optionListHeight==null||this._getOptionListItemHeight()*this._optionListItems.length<this._optionListHeight)&&(this._optionListHeight=this._getOptionListItemHeight()*this._optionListItems.length),this._optionListHeight<0&&(this._optionListHeight=0),this._optionListHeight},_getOptionListWidth:function(){var i=this.get_optionListControl(),n,r;if(this._optionListWidth==null){var t=i.style;t.overflow="auto";n=this.get_comboTableControl().offsetWidth;n-=2;n<0&&(n=0);r=t.width;t.width=n+"px";this.get_comboTableControl().offsetWidth<i.scrollWidth&&(n=i.scrollWidth+0+0);t.overflow="hidden";t.width=r;this._optionListWidth=n}return this._optionListWidth<0&&(this._optionListWidth=0),this._optionListWidth},_getWindowBounds:function(){return{x:this._getScrollLeft(),y:this._getScrollTop(),width:this._getWindowWidth(),height:this._getWindowHeight()}},_getWindowHeight:function(){var n=0;return typeof innerHeight=="number"?n=window.innerHeight:document.documentElement&&document.documentElement.clientHeight?n=document.documentElement.clientHeight:document.body&&document.body.clientHeight&&(n=document.body.clientHeight),n},_getWindowWidth:function(){var n=0;return typeof innerWidth=="number"?n=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?n=document.documentElement.clientWidth:document.body&&document.body.clientWidth&&(n=document.body.clientWidth),n},_getScrollTop:function(){var n=0;return typeof pageYOffset=="number"&&(n=window.pageYOffset),document.body&&document.body.scrollTop?n=document.body.scrollTop:document.documentElement&&document.documentElement.scrollTop&&(n=document.documentElement.scrollTop),n},_getScrollLeft:function(){var n=0;return typeof pageXOffset=="number"?n=window.pageXOffset:document.body&&document.body.scrollLeft?n=document.body.scrollLeft:document.documentElement&&document.documentElement.scrollLeft&&(n=document.documentElement.scrollLeft),n},get_comboTableControl:function(){return this._comboTableControl},set_comboTableControl:function(n){this._comboTableControl!==n&&(this._comboTableControl=n,this.raisePropertyChanged("comboTableControl"))},get_textBoxControl:function(){return this._textBoxControl},set_textBoxControl:function(n){this._textBoxControl!==n&&(this._textBoxControl=n,this.raisePropertyChanged("textBoxControl"))},get_buttonControl:function(){return this._buttonControl},set_buttonControl:function(n){this._buttonControl!==n&&(this._buttonControl=n,this.raisePropertyChanged("buttonControl"))},get_optionListControl:function(){return this._optionListControl},set_optionListControl:function(n){this._optionListControl!==n&&(this._optionListControl=n,this.raisePropertyChanged("optionListControl"))},get_hiddenFieldControl:function(){return this._hiddenFieldControl},set_hiddenFieldControl:function(n){this._hiddenFieldControl!==n&&(this._hiddenFieldControl=n,this.raisePropertyChanged("hiddenFieldControl"))},get_selectedIndex:function(){this._ensureSelectedIndex();var n=this.get_hiddenFieldControl().value;return parseInt(n)},set_selectedIndex:function(n){this.get_hiddenFieldControl().value!==n.toString()&&(this.get_hiddenFieldControl().value=n.toString(),this._ensureSelectedIndex(),this.raisePropertyChanged("selectedIndex"))},get_autoPostBack:function(){return this._autoPostBack},set_autoPostBack:function(n){this._autoPostBack!==n&&(this._autoPostBack=n,this.raisePropertyChanged("autoPostBack"))},get_autoCompleteMode:function(){return this._autoCompleteMode},set_autoCompleteMode:function(n){this._autoCompleteMode!==n&&(this._autoCompleteMode=n,this.raisePropertyChanged("autoCompleteMode"))},get_dropDownStyle:function(){return this._dropDownStyle},set_dropDownStyle:function(n){this._dropDownStyle!==n&&(this._dropDownStyle=n,this.raisePropertyChanged("dropDownStyle"))},get_caseSensitive:function(){return this._caseSensitive},set_caseSensitive:function(n){this._caseSensitive!==n&&(this._caseSensitive=n,this.raisePropertyChanged("caseSensitive"))},get_listItemHoverCssClass:function(){return this._listItemHoverCssClass},set_listItemHoverCssClass:function(n){this._listItemHoverCssClass!==n&&(this._listItemHoverCssClass=n,this.raisePropertyChanged("listItemHoverCssClass"))}};Sys.Extended.UI.ComboBox.registerClass("Sys.Extended.UI.ComboBox",Sys.UI.Control);var ComboBox_Elements=[];Sys.Extended.UI.ComboBox.IsOpen=function(n){for(var t,r=Sys.Application.getComponents(),i=0;i<r.length;i++)t=r[i],Sys.Extended.UI.ComboBox.isInstanceOfType(t)&&t!=n&&t._popupBehavior._visible&&t._popupBehavior.hide()};