PageSourceSearch

https://www.nationalboard.org/ScriptResource.axd?d=1m5_awEOKCKdo6k…B6WHw8io4da_NbyxzR0myvKJCVVP5fZ0&t=7e0f85ee

js nationalboard.org collected 2026-10-02 06:26:27 UTC 59,935 bytes, 1,503 lines download raw bytes

1// (c) Copyright Microsoft Corporation.
2// This source is subject to the Microsoft Permissive License.
3// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
4// All other rights reserved.
5
6
7/// <reference name="MicrosoftAjax.debug.js" />
8/// <reference name="MicrosoftAjaxTimer.debug.js" />
9/// <reference name="MicrosoftAjaxWebForms.debug.js" />
10/// <reference path="../ExtenderBase/BaseScripts.js" />
11/// <reference path="../Common/Common.js" />
12/// <reference path="../Compat/Timer/Timer.js" />
13/// <reference path="../Animation/Animations.js" />
14/// <reference path="../Animation/AnimationBehavior.js" />
15/// <reference path="../PopupExtender/PopupBehavior.js" />
16
17
18Type.registerNamespace('AjaxControlToolkit');
19
20AjaxControlToolkit.AutoCompleteBehavior = function(element) {
21    /// <summary>
22    /// This behavior can be attached to a textbox to enable auto-complete/auto-suggest scenarios.
23    /// </summary>
24    /// <param name="element" type="Sys.UI.DomElement" DomElement="true" mayBeNull="false">
25    /// DOM Element the behavior is associated with
26    /// </param>
27    /// <returns />
28    AjaxControlToolkit.AutoCompleteBehavior.initializeBase(this, [element]);
29    
30    // Path to the web service, or null if a page method
31    this._servicePath = null;
32    
33    // Name of the web method
34    this._serviceMethod = null;
35    
36    // User/page specific context provided to the web method
37    this._contextKey = null;
38    
39    // Whether or not the the user/page specific context should be used
40    this._useContextKey = false;
41    this._minimumPrefixLength = 3;
42    this._completionSetCount = 10;
43    this._completionInterval = 1000;        
44    this._completionListElementID = null;
45    this._completionListElement = null;
46    this._textColor = 'windowtext';
47    this._textBackground = 'window';
48    this._popupBehavior = null;
49    this._popupBehaviorHiddenHandler = null;
50    this._onShowJson = null;
51    this._onHideJson = null;
52    this._timer = null;
53    this._cache = null;
54    this._currentPrefix = null;
55    this._selectIndex = -1;
56    this._focusHandler = null;
57    this._blurHandler = null;
58    this._bodyClickHandler = null;
59    this._completionListBlurHandler = null;        
60    this._keyDownHandler = null;
61    this._mouseDownHandler = null;
62    this._mouseUpHandler = null;
63    this._mouseOverHandler = null;
64    this._tickHandler = null;
65    this._enableCaching = true;
66    this._flyoutHasFocus = false;
67    this._textBoxHasFocus = false;
68    this._completionListCssClass = null;
69    this._completionListItemCssClass = null;
70    this._highlightedItemCssClass = null;
71    this._delimiterCharacters = null;
72    this._firstRowSelected = false;
73    this._showOnlyCurrentWordInCompletionListItem = false;
74    // WebRequest object returned from WebServiceProxy.invoke
75    this._webRequest = null;  
76    
77}
78AjaxControlToolkit.AutoCompleteBehavior.prototype = {
79    initialize: function() {
80        /// <summary>
81        /// Initializes the autocomplete behavior.
82        /// </summary>
83        /// <returns />
84        AjaxControlToolkit.AutoCompleteBehavior.callBaseMethod(this, 'initialize');
85        $common.prepareHiddenElementForATDeviceUpdate();
86        
87        this._popupBehaviorHiddenHandler = Function.createDelegate(this, this._popupHidden);
88        this._tickHandler = Function.createDelegate(this, this._onTimerTick);
89        this._focusHandler = Function.createDelegate(this, this._onGotFocus);
90        this._blurHandler = Function.createDelegate(this, this._onLostFocus);
91        this._keyDownHandler = Function.createDelegate(this, this._onKeyDown);
92        this._mouseDownHandler = Function.createDelegate(this, this._onListMouseDown);
93        this._mouseUpHandler = Function.createDelegate(this, this._onListMouseUp);
94        this._mouseOverHandler = Function.createDelegate(this, this._onListMouseOver);
95        this._completionListBlurHandler = Function.createDelegate(this, this._onCompletionListBlur);
96        this._bodyClickHandler = Function.createDelegate(this, this._onCompletionListBlur);
97        
98        
99        this._timer = new Sys.Timer();
100        this.initializeTimer(this._timer);
101        
102        var element = this.get_element();
103        this.initializeTextBox(element);
104        
105        if(this._completionListElementID !== null)
106            this._completionListElement = $get(this._completionListElementID);
107        if (this._completionListElement == null ) {
108            this._completionListElement = document.createElement('ul');
109            this._completionListElement.id = this.get_id() + '_completionListElem';
110
111            // Safari styles the element incorrectly if it's added to the desired location
112            if (Sys.Browser.agent === Sys.Browser.Safari) {
113                document.body.appendChild(this._completionListElement);
114            } else {
115                element.parentNode.insertBefore(this._completionListElement, element.nextSibling);
116            }
117        }
118        this.initializeCompletionList(this._completionListElement);
119        
120        this._popupBehavior = $create(AjaxControlToolkit.PopupBehavior, 
121                { 'id':this.get_id()+'PopupBehavior', 'parentElement':element, "positioningMode": AjaxControlToolkit.PositioningMode.BottomLeft }, null, null, this._completionListElement);
122        this._popupBehavior.add_hidden(this._popupBehaviorHiddenHandler);
123        
124        // Create the animations (if they were set before initialize was called)
125        if (this._onShowJson) {
126            this._popupBehavior.set_onShow(this._onShowJson);
127        }
128        if (this._onHideJson) {
129            this._popupBehavior.set_onHide(this._onHideJson);
130        }
131    },
132    
133    dispose: function() {
134        /// <summary>
135        /// Disposes the autocomplete behavior
136        /// </summary>
137        /// <returns />
138       
139        this._onShowJson = null;
140        this._onHideJson = null;
141        if (this._popupBehavior) {
142            if (this._popupBehaviorHiddenHandler) {
143                this._popupBehavior.remove_hidden(this._popupBehaviorHiddenHandler);
144            }
145            this._popupBehavior.dispose();
146            this._popupBehavior = null;
147        }
148        if (this._timer) {        
149            this._timer.dispose();
150            this._timer = null;
151        }
152
153        var element = this.get_element();
154        if (element) {
155            $removeHandler(element, "focus", this._focusHandler);
156            $removeHandler(element, "blur", this._blurHandler);
157            $removeHandler(element, "keydown", this._keyDownHandler);
158            $removeHandler(this._completionListElement, 'blur', this._completionListBlurHandler);
159            $removeHandler(this._completionListElement, 'mousedown', this._mouseDownHandler);
160            $removeHandler(this._completionListElement, 'mouseup', this._mouseUpHandler);
161            $removeHandler(this._completionListElement, 'mouseover', this._mouseOverHandler);
162        }
163        if (this._bodyClickHandler) {
164            $removeHandler(document.body, 'click', this._bodyClickHandler);
165            this._bodyClickHandler = null;
166        }
167        
168        this._popupBehaviorHiddenHandler = null;
169        this._tickHandler = null;
170        this._focusHandler = null;
171        this._blurHandler = null;
172        this._keyDownHandler = null;
173        this._completionListBlurHandler = null;
174        this._mouseDownHandler = null;
175        this._mouseUpHandler = null;
176        this._mouseOverHandler = null;
177        
178        AjaxControlToolkit.AutoCompleteBehavior.callBaseMethod(this, 'dispose');
179    },
180    
181    initializeTimer: function(timer) {
182        /// <summary>
183        /// Initializes the timer
184        /// </summary>
185        /// <param name="timer" type="Sys.UI.Timer" DomElement="false" mayBeNull="false" />
186        /// <returns />
187        timer.set_interval(this._completionInterval);
188        timer.add_tick(this._tickHandler);
189    },
190    
191    initializeTextBox: function(element) {
192        /// <summary>
193        /// Initializes the textbox
194        /// </summary>
195        /// <param name="element" type="Sys.UI.DomElement" DomElement="true" mayBeNull="false" />
196        /// <returns />    
197        element.autocomplete = "off";
198        $addHandler(element, "focus", this._focusHandler);        
199        $addHandler(element, "blur", this._blurHandler);
200        $addHandler(element, "keydown", this._keyDownHandler);
201    },
202    
203    initializeCompletionList: function(element) {
204        /// <summary>
205        /// Initializes the autocomplete list element
206        /// </summary>
207        /// <param name="element" type="Sys.UI.DomElement" DomElement="true" mayBeNull="false" />
208        /// <returns />        
209        
210        
211        if(this._completionListCssClass) {
212            Sys.UI.DomElement.addCssClass(element, this._completionListCssClass);
213        } else {
214            var completionListStyle = element.style;
215            completionListStyle.textAlign = 'left';
216            completionListStyle.visibility = 'hidden';
217            completionListStyle.cursor = 'default';
218            completionListStyle.listStyle = 'none';
219            completionListStyle.padding = '0px';
220            completionListStyle.margin = '0px! important';
221            if (Sys.Browser.agent === Sys.Browser.Safari) {
222                completionListStyle.border = 'solid 1px gray';    
223                completionListStyle.backgroundColor = 'white';
224                completionListStyle.color = 'black';                        
225            } else {
226                completionListStyle.border = 'solid 1px buttonshadow';            
227                completionListStyle.backgroundColor = this._textBackgroun
227d;
228                completionListStyle.color = this._textColor;                
229            }
230        }
231        $addHandler(element, "mousedown", this._mouseDownHandler);
232        $addHandler(element, "mouseup", this._mouseUpHandler);
233        $addHandler(element, "mouseover", this._mouseOverHandler);
234        $addHandler(element, "blur", this._completionListBlurHandler);   
235        $addHandler(document.body, 'click', this._bodyClickHandler);
236    },
237    
238    _currentCompletionWord: function() {
239        var element = this.get_element();
240        var elementValue = element.value;
241        var word = elementValue;
242        
243        if (this.get_isMultiWord()) {
244            var startIndex = this._getCurrentWordStartIndex();
245            var endIndex = this._getCurrentWordEndIndex(startIndex);
246            
247            if (endIndex <= startIndex) {
248                word = elementValue.substring(startIndex);
249            } else {
250                word = elementValue.substring(startIndex, endIndex);
251            }
252        }
253        
254        return word;
255    },
256    
257    _getCursorIndex: function() {
258        return this.get_element().selectionStart;
259    },
260    
261    _getCurrentWordStartIndex: function() {
262        var element = this.get_element();
263        var elementText = element.value.substring(0,this._getCursorIndex());
264        
265        var index = 0;
266        var lastIndex = -1;
267        
268        for (var i = 0; i < this._delimiterCharacters.length; ++i) {
269            var curIndex = elementText.lastIndexOf(this._delimiterCharacters.charAt(i));
270            if (curIndex > lastIndex) {
271                lastIndex = curIndex;
272            }
273        }    
274        
275        index = lastIndex;
276        if (index >= this._getCursorIndex()) {
277            index = 0;
278        }
279        
280        return index < 0 ? 0 : index + 1;    
281    },
282    
283    _getCurrentWordEndIndex: function(wordStartIndex) {
284        var element = this.get_element();
285        var elementText = element.value.substring(wordStartIndex);
286        var index = 0;
287        
288        for (var i = 0; i < this._delimiterCharacters.length; ++i) {
289            var curIndex = elementText.indexOf(this._delimiterCharacters.charAt(i));
290            if (curIndex > 0 && (curIndex < index || index == 0)) {
291                index = curIndex;
292            }
293        }
294               
295        return index <= 0 ? element.value.length : index + wordStartIndex;
296    },
297    
298    get_isMultiWord : function() {
299        /// <value type="Boolean" mayBeNull="false">
300        /// Whether the behavior is currently in multi-word mode
301        /// </value>
302        return (this._delimiterCharacters != null) && (this._delimiterCharacters != '');
303    },
304    
305    _getTextWithInsertedWord: function(wordToInsert) {
306        var text = wordToInsert;
307        var replaceIndex = 0;
308        var element = this.get_element();
309        var originalText = element.value;
310        
311        if (this.get_isMultiWord()) {
312            var startIndex = this._getCurrentWordStartIndex();
313            var endIndex = this._getCurrentWordEndIndex(startIndex);
314            var prefix = '';
315            var suffix = '';
316            
317            if (startIndex > 0) {
318                prefix = originalText.substring(0, startIndex);
319            }
320            if (endIndex > startIndex) {
321                suffix = originalText.substring(endIndex);
322            }
323            
324            text = prefix + wordToInsert + suffix;
325        }
326        
327        return text;
328    },
329    
330    _hideCompletionList: function() {
331        /// <summary>
332        /// Hides the autocomplete flyout list
333        /// </summary>
334        /// <returns />
335        
336        var eventArgs = new Sys.CancelEventArgs();
337        this.raiseHiding(eventArgs);
338        if (eventArgs.get_cancel()) {
339            return;
340        }
341        
342        // Actually hide the popup
343        this.hidePopup();
344    },
345    
346    showPopup : function() {
347        /// <summary>
348        /// Show the completion list popup
349        /// </summary>
350        /// <remarks>
351        /// If you cancel the showing event, you should still call
352        /// showPopup to ensure consistency of the internal state
353        /// </remarks>
354        this._popupBehavior.show();
355        this.raiseShown(Sys.EventArgs.Empty);
356    },
357    
358    hidePopup : function() {
359        /// <summary>
360        /// Hide the completion list popup
361        /// </summary>
362        /// <remarks>
363        /// If you cancel the hiding event, you should still
364        /// call hidePopup to ensure consistency of the internal
365        /// state
366        /// </remarks>
367
368        if (this._popupBehavior) {
369            this._popupBehavior.hide();
370        } else {
371            this._popupHidden();
372        }
373    },
374    
375    _popupHidden : function() {
376        /// <summary>
377        /// Clean up the completion list popup after it has been hidden
378        /// </summary>
379    
380        this._completionListElement.innerHTML = '';
381        this._selectIndex = -1;
382        this._flyoutHasFocus = false;
383        
384        this.raiseHidden(Sys.EventArgs.Empty);
385    },
386    
387    _highlightItem: function(item) {
388        /// <summary>
389        /// Highlights the specified item
390        /// </summary>
391        /// <param name="item" type="Sys.UI.DomElement" DomElement="true" mayBeNull="false" />
392        /// <returns />
393        
394        var children = this._completionListElement.childNodes;
395
396        // Unselect any previously highlighted item
397        for (var i = 0; i < children.length; i++) {
398            var child = children[i];
399            if (child._highlighted) {
400                if (this._completionListItemCssClass) {
401                    Sys.UI.DomElement.removeCssClass(child, this._highlightedItemCssClass);
402                    Sys.UI.DomElement.addCssClass(child, this._completionListItemCssClass);
403                } else {
404                    if (Sys.Browser.agent === Sys.Browser.Safari) {
405                        child.style.backgroundColor = 'white';
406                        child.style.color = 'black';
407                    } else {
408                        child.style.backgroundColor = this._textBackgroun
408d;
409                        child.style.color = this._textColor;
410                    }
411                }
412                this.raiseItemOut(new AjaxControlToolkit.AutoCompleteItemEventArgs(child, child.firstChild.nodeValue, child._value));
413            }
414        }
415        
416        // Highlight the new item
417        if(this._highlightedItemCssClass) {
418            Sys.UI.DomElement.removeCssClass(item, this._completionListItemCssClass);
419            Sys.UI.DomElement.addCssClass(item, this._highlightedItemCssClass);
420        } else {
421            if (Sys.Browser.agent === Sys.Browser.Safari) {
422                item.style.backgroundColor = 'lemonchiffon';
423            } else {
424                item.style.backgroundColor = 'highlight';
425                item.style.color = 'highlighttext';
426            }
427            
428        }
429        item._highlighted = true;
430        this.raiseItemOver(new AjaxControlToolkit.AutoCompleteItemEventArgs(item, item.firstChild.nodeValue, item._value));
431    },
432
433    /// <summary>
434    /// Handler for the blur event on the autocomplete flyout.
435    /// </summary>
436    /// <param name="ev" type="Sys.UI.DomEvent" DomElement="false" mayBeNull="false" />
437    /// <returns />    
438    _onCompletionListBlur: function(ev) {
439        this._hideCompletionList();
440    },
441    
442    _onListMouseDown: function(ev) {
443        /// <summary>
444        /// Handler for the mousedown event on the autocomplete flyout.
445        /// </summary>
446        /// <param name="ev" type="Sys.UI.DomEvent" DomElement="false" mayBeNull="false" />
447        /// <returns />     
448        if (ev.target !== this._completionListElement) {
449            this._setText(ev.target);
450            this._flyoutHasFocus = false;
451        } else { // focus is still on the flyout and we do not want to hide it
452            this._flyoutHasFocus = true;
453        }
454    },
455    
456    _onListMouseUp: function(ev) {
457        /// <summary>
458        /// Handler for the mouseup event on the autocomplete flyout.
459        /// </summary>
460        /// <param name="ev" type="Sys.UI.DomEvent" DomElement="false" mayBeNull="false" />
461        /// <returns />      
462        this.get_element().focus();
463    },
464    
465    _onListMouseOver: function(ev) {
466        /// <summary>
467        /// Handler for the mouseover event on the autocomplete flyout.
468        /// </summary>
469        /// <param name="ev" type="Sys.UI.DomEvent" DomElement="false" mayBeNull="false" />
470        /// <returns />      
471        var item = ev.target;
472        if(item !== this._completionListElement) {
473            var children = this._completionListElement.childNodes;
474            // make sure the selected index is updated
475            for (var i = 0; i < children.length; ++i) {
476                if (item === children[i]) {
477                    this._highlightItem(item);
478                    this._selectIndex = i;
479                    break;
480                }  
481            }
482        }
483    },
484
485    _onGotFocus: function(ev) {
486        /// <summary>
487        /// Handler for textbox focus event.
488        /// </summary>
489        /// <param name="ev" type="Sys.UI.DomEvent" DomElement="false" mayBeNull="false" />
490        /// <returns />      
491        this._textBoxHasFocus = true;
492        if (this._flyoutHasFocus) {
493            // hide the flyout now that the focus is back on the textbox
494            this._hideCompletionList();          
495        }
496        if ((this._minimumPrefixLength == 0) && (!this.get_element().value)) {
497            this._timer.set_enabled(true); 
498            // only start the timer if the minimumprefixlength is 0
499            // since we would like to retrieve results even if
500            // the user has not entered any text and the textbox is empty.
501        }
502    },
503    
504    _onKeyDown: function(ev) {
505        /// <summary>
506        /// Handler for the textbox keydown event.
507        /// </summary>
508        /// <param name="ev" type="Sys.UI.DomEvent" DomElement="false" mayBeNull="false" />
509        /// <returns />      
510        
511        this._timer.set_enabled(false); 
512        // the last key press occured so we need to "reset" the timer.
513        var k = ev.keyCode ? ev.keyCode : ev.rawEvent.keyCode;
514        if (k === Sys.UI.Key.esc) {
515            this._hideCompletionList();
516            ev.preventDefault();
517        }
518        else if (k === Sys.UI.Key.up) {
519            if (this._selectIndex > 0) {
520                this._selectIndex--;
521                this._handleScroll(this._completionListElement.childNodes[this._selectIndex], this._selectIndex);
522                this._highlightItem(this._completionListElement.childNodes[this._selectIndex]);
523                ev.stopPropagation();     
524                ev.preventDefault();
525            }
526        }
527        else if (k === Sys.UI.Key.down) {
528            if (this._selectIndex < (this._completionListElement.childNodes.length - 1)) {
529                this._selectIndex++;                        
530                this._handleScroll(this._completionListElement.childNodes[this._selectIndex], this._selectIndex);
531                this._highlightItem(this._completionListElement.childNodes[this._selectIndex]);              
532                ev.stopPropagation();                
533                ev.preventDefault();
534            }
535        }
536        else if (k === Sys.UI.Key.enter) {
537            if (this._selectIndex !== -1) {
538                this._setText(this._completionListElement.childNodes[this._selectIndex]);
539                ev.preventDefault();
540            } else {
541                // close the popup
542                this.hidePopup();
543            }
544        }
545        else if (k === Sys.UI.Key.tab) {
546            if (this._selectIndex !== -1) {
547                this._setText(this._completionListElement.childNodes[this._selectIndex]);
548            }
549        }
550        else {
551            this._timer.set_enabled(true);
552            // start the timer to retrieve results since now it is an actual key
553        }
554    },
555    
556    _handleScroll : function(element, index) {
557        /// <summary>
558        /// Method to determine if an item is in view or not
559        /// </summary>
560        /// <returns />
561        /// <param name="element" type="Sys.UI.DomElement" DomElement="true" mayBeNull="false" />
562        /// <param name="index" type="Number" DomElement="false" mayBeNull="true" />        
563        var flyout = this._completionListElement;
564        var elemBounds = $common.getBounds(element);
565        var numItems = this._completionListElement.childNodes.length;
566        if (((elemBounds.height * index) - (flyout.clientHeight + flyout.scrollTop)) >= 0) {
567            // you need to scroll down
568            flyout.scrollTop += (((elemBounds.height * index) - (flyout.clientHeight + flyout.scrollTop)) + elemBounds.height);
569        }
570        if (((elemBounds.height * (numItems - (index + 1))) - (flyout.scrollHeight - flyout.scrollTop)) >= 0) {
571            // you need to scroll up
572            flyout.scrollTop -= (((elemBounds.height * (numItems - (index + 1))) - (flyout.scrollHeight - flyout.scrollTop)) + elemBounds.height); 
573        }  
574        
575        if (flyout.scrollTop % elemBounds.height !== 0) { 
576            if (((elemBounds.height * (index + 1)) - (flyout.clientHeight + flyout.scrollTop)) >= 0) { 
577                // an element is partially displayed at the bottom
578                flyout.scrollTop -= (flyout.scrollTop % elemBounds.height);       
579            } else { // an element is partially displayed on the top 
580                flyout.scrollTop += (elemBounds.height - (flyout.scrollTop % elemBounds.height));
581            }
582        }  
583     
584    },
585    
586    _handleFlyoutFocus : function() {
587        /// <summary>
588        /// Method to handle flyout focus if textbox loses focus.
589        /// </summary>
590        /// <returns />   
591        if(!this._textBoxHasFocus) { 
592            if (!this._flyoutHasFocus) {
593                if (this._webRequest) {
594                    // abort the web service call if we are losing focus. no sense having it delay future web requests.
595                    this._webRequest.get_executor().abort();
596                    this._webRequest = null;
597                }
598                // the textbox lost focus and the flyout does not have it
599                this._hideCompletionList();
600            } else {
601                // keep the flyout around otherwise
602            }
603        }
604    },     
605    
606    _onLostFocus: function() {
607        /// <summary>
608        /// Handler textbox blur event.
609        /// </summary>
610        /// <returns />      
611        this._textBoxHasFocus = false;   
612        this._timer.set_enabled(false);
613        /* the rest of the onblur handling will be done in
614        this method after a minor delay to ensure we do not close the flyout 
615        if a user clicks on its scroll bars for example */  
616        window.setTimeout(Function.createDelegate(this, this._handleFlyoutFocus), 500);
617    },  
618    
619    _onMethodComplete: function(result, context) {
620        /// <summary>
621        /// Handler invoked when the webservice call is completed.
622        /// </summary>
623        /// <param name="result" type="Object" DomElement="false" mayBeNull="true" />
624        /// <param name="context" type="String" DomElement="false" mayBeNull="true" />        
625        /// <returns /> 
626        this._webRequest = null; // clear out our saved WebRequest object    
627        this._update(context, result, /* cacheResults */ true);
628    },
629    
630    _onMethodFailed: function(err, response, context) {
631        /// <summary>
632        /// Handler invoked when the webservice call fails, currently a noop
633        /// </summary>
634        /// <param name="err" type="Object" DomElement="false" mayBeNull="true" />        
635        /// <param name="result" type="Object" DomElement="false" mayBeNull="true" />
636        /// <param name="context" type="String" DomElement="false" mayBeNull="true" />
637        /// <returns />     
638        // clear out our saved WebRequest object
639        this._webRequest = null; 
640    },
641    
642    _onTimerTick: function(sender, eventArgs) {
643        /// <summary>
644        /// Handler invoked when a timer tick occurs
645        /// </summary>
646        /// <param name="sender" type="Object" mayBeNull="true"/>
647        /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="true" />        
648        /// <returns />
649        
650        // turn off the timer until another key is pressed.
651        this._timer.set_enabled(false);
652        if (this._servicePath && this._serviceMethod) {
653            var text = this._currentCompletionWord();
654            
655            if (text.trim().length < this._minimumPrefixLength) {
656                this._currentPrefix = null;
657                this._update('', null, /* cacheResults */ false);
658                return;
659            }
660            // there is new content in the textbox or the textbox is empty but the min prefix length is 0
661           if ((this._currentPrefix !== text) || ((text == "") && (this._minimumPrefixLength == 0))) {
662                this._currentPrefix = text;
663                if ((text != "") && this._cache && this._cache[text]) {
664                    this._update(text, this._cache[text], /* cacheResults */ false);
665                    return;
666                }
667                // Raise the populating event and optionally cancel the web service invocation
668                var eventArgs = new Sys.CancelEventArgs();
669                this.raisePopulating(eventArgs);
670                if (eventArgs.get_cancel()) {
671                    return;
672                }
673                
674                // Create the service parameters and optionally add the context parameter
675                // (thereby determining which method signature we're expecting...)
676                var params = { prefixText : this._currentPrefix, count: this._completionSetCount };
677                if (this._useContextKey) {
678                    params.contextKey = this._contextKey;
679                }
680                
681                if (this._webRequest) {
682                    // abort the previous web service call if we 
683                    // are issuing a new one and the previous one is 
684                    // active.
685                    this._webRequest.get_executor().abort();
686                    this._webRequest = null;
687                }
688                // Invoke the web service
689                this._webRequest = Sys.Net.WebServiceProxy.invoke(this.get_servicePath(), this.get_serviceMethod(), false, params,
690                                            Function.createDelegate(this, this._onMethodComplete),
691                                            Function.createDelegate(this, this._onMethodFailed),
692                                            text);
693                $common.updateFormToRefreshATDeviceBuffer();
694            }
695        }
696    },
697    
698    _setText: function(item) {
699        /// <summary>
700        /// Method to set the selected autocomplete option on the textbox
701        /// </summary>
702        /// <param name="item" type="Sys.UI.DomElement" DomElement="true" mayBeNull="true">
703        /// Item to select
704        /// </param>
705        /// <returns />
706        
707        var text = (item && item.firstChild) ? item.firstChild.nodeValue : null;
708        this._timer.set_enabled(false);
709
710        var element = this.get_element();
711        var control = element.control;
712        var newText = this._showOnlyCurrentWordInCompletionListItem ? this._getTextWithInsertedWord(text) : text;
713        if (control && control.set_text) {
714            control.set_text(newText);
715        } else {
716            element.value = newText;
717        }
718        $common.tryFireEvent(element, "change");
719
720        this.raiseItemSelected(new AjaxControlToolkit.AutoCompleteItemEventArgs(item, text, item ? item._value : null));
721
722        this._currentPrefix = this._currentCompletionWord();
723        this._hideCompletionList();
724    },
725    
726    _update: function(prefixText, completionItems, cacheResults) {
727        /// <summary>
728        /// Method to update the status of the autocomplete behavior
729        /// </summary>
730        /// <param name="prefixText" type="String" DomElement="false" mayBeNull="true" />
731        /// <param name="completionItems" type="Object" DomElement="false" mayBeNull="true" />
732        /// <param name="cacheResults" type="Object" DomElement="false" mayBeNull="true" />
733        /// <returns />       
734        if (cacheResults && this.get_enableCaching()) {
735            if (!this._cache) {
736                this._cache = {};
737            }
738            this._cache[prefixText] = completionItems;
739        }
740        
741        // If the target control loses focus or 
742        // if the value in textbox has changed before the webservice returned
743        // completion items we don't need to show popup 
744        if ((!this._textBoxHasFocus) || (prefixText != this._currentCompletionWord())) {
745            this._hideCompletionList();
746            return;
747        }  
748        
749        if (completionItems && completionItems.length) {
750            this._completionListElement.innerHTML = '';
751            this._selectIndex = -1;
752            var _firstChild = null;
753            var text = null;
754            var value = null;
755            
756            for (var i = 0; i < completionItems.length; i++) {
757                // Create the item                
758                var itemElement = null;
759                if (this._completionListElementID) { 
760                    // the completion element has been created by the user and li won't necessarily work
761                    itemElement = document.createElement('div');
762                } else {
763                    itemElement = document.createElement('li');
764                }
765                
766                // set the first child if it is null
767                if( _firstChild == null ){
768                    _firstChild = itemElement;
769                }
770                
771                // Get the text/value for the item
772                try {
773                    var pair = Sys.Serialization.JavaScriptSerializer.deserialize('(' + completionItems[i] + ')');
774                    if (pair && pair.First) {
775                        // Use the text and value pair returned from the web service
776                        text = pair.First;
777                        value = pair.Second;
778                    } else {
779                        // If the web service only returned a regular string, use it for
780                        // both the text and the value
781                        text = pair;
782                        value = pair; 
783                    } 
784                } catch (ex) {
785                    text = completionItems[i];
786                    value = completionItems[i];
787                }
788
789
790                // Set the text/value for the item
791                // ShowOnlyCurrentWordInCompletionListItem support
792                var optionText = this._showOnlyCurrentWordInCompletionListItem ? text : this._getTextWithInsertedWord(text);
793				itemElement.appendChild(document.createTextNode(optionText));
794                itemElement._value = value;
795                itemElement.__item = '';
796                
797                if (this._completionListItemCssClass) {
798                    Sys.UI.DomElement.addCssClass(itemElement, this._completionListItemCssClass);
799                } else {
800                    var itemElementStyle = itemElement.style;
801                    itemElementStyle.padding = '0px';
802                    itemElementStyle.textAlign = 'left';
803                    itemElementStyle.textOverflow = 'ellipsis';
804                    // workaround for safari since normal colors do not
805                    // show well there.
806                    if (Sys.Browser.agent === Sys.Browser.Safari) {
807                        itemElementStyle.backgroundColor = 'white';
808                        itemElementStyle.color = 'black';
809                    } else {
810                        itemElementStyle.backgroundColor = this._textBackgroun
810d;
811                        itemElementStyle.color = this._textColor;
812                    }
813                }
814                this._completionListElement.appendChild(itemElement);
815            }
816            var elementBounds = $common.getBounds(this.get_element());        
817            this._completionListElement.style.width = Math.max(1, elementBounds.width - 2) + 'px';
818            this._completionListElement.scrollTop = 0;
819            
820            this.raisePopulated(Sys.EventArgs.Empty);
821            
822            var eventArgs = new Sys.CancelEventArgs();
823            this.raiseShowing(eventArgs);
824            if (!eventArgs.get_cancel()) {
825                this.showPopup();
826                // Check if the first Row is to be selected by default and if yes highlight it and updated selectIndex.
827                if (this._firstRowSelected && (_firstChild != null)) {
828                    this._highlightItem( _firstChild );
829                    this._selectIndex = 0;
830                }
831            }            
832        } else {
833            this._hideCompletionList();
834        }
835    },
836    
837    get_onShow : function() {
838        /// <value type="String" mayBeNull="true">
839        /// Generic OnShow Animation's JSON definition
840        /// </value>
841        return this._popupBehavior ? this._popupBehavior.get_onShow() : this._onShowJson;
842    },
843    set_onShow : function(value) {
844        if (this._popupBehavior) {
845            this._popupBehavior.set_onShow(value)
846        } else {
847            this._onShowJson = value;
848        }
849        this.raisePropertyChanged('onShow');
850    },
851    get_onShowBehavior : function() {
852        /// <value type="AjaxControlToolkit.Animation.GenericAnimationBehavior">
853        /// Generic OnShow Animation's behavior
854        /// </value>
855        return this._popupBehavior ? this._popupBehavior.get_onShowBehavior() : null;
856    },
857    onShow : function() {
858        /// <summary>
859        /// Play the OnShow animation
860        /// </summary>
861        /// <returns />
862        if (this._popupBehavior) {
863            this._popupBehavior.onShow();
864        }
865    },
866        
867    get_onHide : function() {
868        /// <value type="String" mayBeNull="true">
869        /// Generic OnHide Animation's JSON definition
870        /// </value>
871        return this._popupBehavior ? this._popupBehavior.get_onHide() : this._onHideJson;
872    },
873    set_onHide : function(value) {
874        if (this._popupBehavior) {
875            this._popupBehavior.set_onHide(value)
876        } else {
877            this._onHideJson = value;
878        }
879        this.raisePropertyChanged('onHide');
880    },
881    get_onHideBehavior : function() {
882        /// <value type="AjaxControlToolkit.Animation.GenericAnimationBehavior">
883        /// Generic OnHide Animation's behavior
884        /// </value>
885        return this._popupBehavior ? this._popupBehavior.get_onHideBehavior() : null;
886    },
887    onHide : function() {
888        /// <summary>
889        /// Play the OnHide animation
890        /// </summary>
891        /// <returns />
892        if (this._popupBehavior) {
893            this._popupBehavior.onHide();
894        }
895    },
896    
897    get_completionInterval: function() {
898        /// <value type="Number" integer="true" maybeNull="true">
899        /// Auto completion timer interval in milliseconds.
900        /// </value>
901        return this._completionInterval;
902    },
903    set_completionInterval: function(value) {
904        if (this._completionInterval != value) {
905            this._completionInterval = value;
906            this.raisePropertyChanged('completionInterval');
907        }
908    },
909    
910    get_completionList: function() {
911        /// <value type="Sys.UI.DomElement" domElement="true" maybeNull="true">
912        /// List dom element.
913        /// </value>
914        return this._completionListElement;
915    },
916    set_completionList: function(value) {
917        if (this._completionListElement != value) {
918            this._completionListElement = value;
919            this.raisePropertyChanged('completionList');
920        }
921    },
922    
923    get_completionSetCount: function() {
924        /// <value type="Number" integer="true" maybeNull="true">
925        /// Maximum completion set size.
926        /// </value>
927        return this._completionSetCount;
928    },
929    set_completionSetCount: function(value) {
930        if (this._completionSetCount != value) {
931            this._completionSetCount = value;
932            this.raisePropertyChanged('completionSetCount');
933        }
934    },
935    
936    get_minimumPrefixLength: function() {
937        /// <value type="Number" integer="true" maybeNull="true">
938        /// Minimum text prefix length required to call the webservice.
939        /// </value>
940        return this._minimumPrefixLength;
941    },
942    set_minimumPrefixLength: function(value) {
943        if (this._minimumPrefixLength != value) {
944            this._minimumPrefixLength = value;
945            this.raisePropertyChanged('minimumPrefixLength');
946        }
947    },
948    
949    get_serviceMethod: function() {
950        /// <value type="String" maybeNull="false">
951        /// Web service method.
952        /// </value>
953        return this._serviceMethod;
954    },
955    set_serviceMethod: function(value) {
956        if (this._serviceMethod != value) {
957            this._serviceMethod = value;
958            this.raisePropertyChanged('serviceMethod');
959        }
960    },
961    
962    get_servicePath: function() {
963        /// <value type="String" maybeNull="true">
964        /// Web service url.
965        /// </value>
966        return this._servicePath;
967    },
968    set_servicePath: function(value) {
969        if (this._servicePath != value) {
970            this._servicePath = value;
971            this.raisePropertyChanged('servicePath');
972        }
973    },
974    
975    get_contextKey : function() {
976        /// <value type="String" mayBeNull="true">
977        /// User/page specific context provided to an optional overload of the
978        /// web method described by ServiceMethod/ServicePath.  If the context
979        /// key is used, it should have the same signature with an additional
980        /// parameter named contextKey of type string.
981        /// </value>
982        return this._contextKey;
983    },
984    set_contextKey : function(value) {
985        if (this._contextKey != value) {
986            this._contextKey = value;
987            this.set_useContextKey(true);
988            this.raisePropertyChanged('contextKey');
989        }
990    },
991    
992    get_useContextKey : function() {
993        /// <value type="Boolean">
994        /// Whether or not the ContextKey property should be used.  This will be
995        /// automatically enabled if the ContextKey property is ever set
996        /// (on either the client or the server).  If the context key is used,
997        /// it should have the same signature with an additional parameter
998        /// named contextKey of type string.
999        /// </value>
1000        return this._useContextKey;
1001    },
1002    set_useContextKey : function(value) {
1003        if (this._useContextKey != value) {
1004            this._useContextKey = value;
1005            this.raisePropertyChanged('useContextKey');
1006        }
1007    },
1008    
1009    get_enableCaching: function() {
1010        /// <value type="Boolean" maybeNull="true">
1011        /// Get or sets whether suggestions retrieved from the webservice
1012        /// should be cached.
1013        /// </value>
1014        return this._enableCaching;
1015    },
1016    set_enableCaching: function(value) {
1017        if (this._enableCaching != value) {
1018            this._enableCaching = value;
1019            this.raisePropertyChanged('enableCaching');
1020        }
1021    },
1022    
1023    get_completionListElementID: function() {
1024        /// <value type="String" maybeNull="true">
1025        /// ID of the completion div element.
1026        /// </value>
1027        return this._completionListElementID;
1028    },
1029    set_completionListElementID: function(value) {
1030        if (this._completionListElementID != value) {
1031            this._completionListElementID = value;
1032            this.raisePropertyChanged('completionListElementID');
1033        }
1034    },  
1035    
1036    get_completionListCssClass : function() {
1037        /// <value type="String" maybeNull="true">
1038        /// Css class name that will be used to style the completion list element.
1039        /// </value>
1040        return this._completionListCssClass;
1041    },
1042    set_completionListCssClass : function(value) {
1043        if (this._completionListCssClass != value) {
1044            this._completionListCssClass = value;    
1045            this.raisePropertyChanged('completionListCssClass');
1046        }
1047    },   
1048    
1049    get_completionListItemCssClass : function() {
1050        /// <value type="String" maybeNull="true">
1051        /// Css class name that will be used to style an item in the completion list.
1052        /// </value>
1053        return this._completionListItemCssClass;
1054    },
1055    set_completionListItemCssClass : function(value) {
1056        if (this._completionListItemCssClass != value) {
1057            this._completionListItemCssClass = value;    
1058            this.raisePropertyChanged('completionListItemCssClass');
1059        }
1060    },
1061    
1062    get_highlightedItemCssClass : function() {
1063        /// <value type="String" maybeNull="true">
1064        /// Css class name that will be used to style a highlighted item in the list.
1065        /// </value>
1066        return this._highlightedItemCssClass;
1067    },
1068    set_highlightedItemCssClass : function(value) {
1069        if(this._highlightedItemCssClass != value) {
1070            this._highlightedItemCssClass = value;
1071            this.raisePropertyChanged('highlightedItemCssClass');
1072        }
1073    },
1074    
1075    get_delimiterCharacters: function() {
1076        /// <value type="String">
1077        /// Gets or sets the character(s) used to seperate words for autocomplete.
1078        /// </value>
1079        return this._delimiterCharacters;
1080    },
1081    set_delimiterCharacters: function(value) {
1082        if (this._delimiterCharacters != value) {
1083            this._delimiterCharacters = value;
1084            this.raisePropertyChanged('delimiterCharacters');
1085        }
1086    },
1087    
1088    get_firstRowSelected:function() {
1089        /// <value type="Boolean" maybeNull="true">
1090        /// Flag to determine if the first option in the flyout is selected or not. 
1091        /// </value>
1092        return this._firstRowSelected;
1093    },
1094    set_firstRowSelected:function(value) {
1095        if(this._firstRowSelected != value) {
1096            this._firstRowSelected = value;
1097            this.raisePropertyChanged('firstRowSelected');
1098        }
1099    },
1100    
1101    get_showOnlyCurrentWordInCompletionListItem:function() {
1102        /// <value type="Boolean">
1103        /// If Delimiter characters are specified and showOnlyCurrentWordInCompletionListItem is 
1104        /// set to true, then the completion list displays suggestions just for the current word, 
1105        /// otherwise, it displays the whole string that will show up in the TextBox if that
1106        /// item is selected, which is the current default.
1107        /// </value>
1108        return this._showOnlyCurrentWordInCompletionListItem;
1109    },
1110    set_showOnlyCurrentWordInCompletionListItem:function(value) {
1111        if(this._showOnlyCurrentWordInCompletionListItem != value) {
1112            this._showOnlyCurrentWordInCompletionListItem = value;
1113            this.raisePropertyChanged('showOnlyCurrentWordInCompletionListItem');
1114        }
1115    },
1116
1117    add_populating : function(handler) {
1118        /// <summary>
1119        /// Add an event handler for the populating event
1120        /// </summary>
1121        /// <param name="handler" type="Function" mayBeNull="false">
1122        /// Event handler
1123        /// </param>
1124        /// <returns />
1125        this.get_events().addHandler('populating', handler);
1126    },
1127    remove_populating : function(handler) {
1128        /// <summary>
1129        /// Remove an event handler from the populating event
1130        /// </summary>
1131        /// <param name="handler" type="Function" mayBeNull="false">
1132        /// Event handler
1133        /// </param>
1134        /// <returns />
1135        this.get_events().removeHandler('populating', handler);
1136    },
1137    raisePopulating : function(eventArgs) {
1138        /// <summary>
1139        /// Raise the populating event
1140        /// </summary>
1141        /// <param name="eventArgs" type="Sys.CancelEventArgs" mayBeNull="false">
1142        /// Event arguments for the populating event
1143        /// </param>
1144        /// <returns />
1145        /// <remarks>
1146        /// The populating event can be used to provide custom data to AutoComplete
1147        /// instead of using a web service.  Just cancel the event (using the
1148        /// CancelEventArgs) and pass your own data to the _update method.
1149        /// </remarks>
1150        
1151        var handler = this.get_events().getHandler('populating');
1152        if (handler) {
1153            handler(this, eventArgs);
1154        }
1155    },
1156    
1157    add_populated : function(handler) {
1158        /// <summary>
1159        /// Add an event handler for the populated event
1160        /// </summary>
1161        /// <param name="handler" type="Function" mayBeNull="false">
1162        /// Event handler
1163        /// </param>
1164        /// <returns />
1165        this.get_events().addHandler('populated', handler);
1166    },
1167    remove_populated : function(handler) {
1168        /// <summary>
1169        /// Remove an event handler from the populated event
1170        /// </summary>
1171        /// <param name="handler" type="Function" mayBeNull="false">
1172        /// Event handler
1173        /// </param>
1174        /// <returns />
1175        this.get_events().removeHandler('populated', handler);
1176    },
1177    raisePopulated : function(eventArgs) {
1178        /// <summary>
1179        /// Raise the populated event
1180        /// </summary>
1181        /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="false">
1182        /// Event arguments for the populated event
1183        /// </param>
1184        /// <returns />
1185        
1186        var handler = this.get_events().getHandler('populated');
1187        if (handler) {
1188            handler(this, eventArgs);
1189        }
1190    },
1191    
1192    add_showing : function(handler) {
1193        /// <summary>
1194        /// Add an event handler for the showing event
1195        /// </summary>
1196        /// <param name="handler" type="Function" mayBeNull="false">
1197        /// Event handler
1198        /// </param>
1199        /// <returns />
1200        this.get_events().addHandler('showing', handler);
1201    },
1202    remove_showing : function(handler) {
1203        /// <summary>
1204        /// Remove an event handler from the showing event
1205        /// </summary>
1206        /// <param name="handler" type="Function" mayBeNull="false">
1207        /// Event handler
1208        /// </param>
1209        /// <returns />
1210        this.get_events().removeHandler('showing', handler);
1211    },
1212    raiseShowing : function(eventArgs) {
1213        /// <summary>
1214        /// Raise the showing event
1215        /// </summary>
1216        /// <param name="eventArgs" type="Sys.CancelEventArgs" mayBeNull="false">
1217        /// Event arguments for the showing event
1218        /// </param>
1219        /// <returns />
1220        
1221        var handler = this.get_events().getHandler('showing');
1222        if (handler) {
1223            handler(this, eventArgs);
1224        }
1225    },
1226    
1227    add_shown : function(handler) {
1228        /// <summary>
1229        /// Add an event handler for the shown event
1230        /// </summary>
1231        /// <param name="handler" type="Function" mayBeNull="false">
1232        /// Event handler
1233        /// </param>
1234        /// <returns />
1235        this.get_events().addHandler('shown', handler);
1236    },
1237    remove_shown : function(handler) {
1238        /// <summary>
1239        /// Remove an event handler from the shown event
1240        /// </summary>
1241        /// <param name="handler" type="Function" mayBeNull="false">
1242        /// Event handler
1243        /// </param>
1244        /// <returns />
1245        this.get_events().removeHandler('shown', handler);
1246    },
1247    raiseShown : function(eventArgs) {
1248        /// <summary>
1249        /// Raise the shown event
1250        /// </summary>
1251        /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="false">
1252        /// Event arguments for the shown event
1253        /// </param>
1254        /// <returns />
1255        
1256        var handler = this.get_events().getHandler('shown');
1257        if (handler) {
1258            handler(this, eventArgs);
1259        }
1260    },
1261    
1262    add_hiding : function(handler) {
1263        /// <summary>
1264        /// Add an event handler for the hiding event
1265        /// </summary>
1266        /// <param name="handler" type="Function" mayBeNull="false">
1267        /// Event handler
1268        /// </param>
1269        /// <returns />
1270        this.get_events().addHandler('hiding', handler);
1271    },
1272    remove_hiding : function(handler) {
1273        /// <summary>
1274        /// Remove an event handler from the hiding event
1275        /// </summary>
1276        /// <param name="handler" type="Function" mayBeNull="false">
1277        /// Event handler
1278        /// </param>
1279        /// <returns />
1280        this.get_events().removeHandler('hiding', handler);
1281    },
1282    raiseHiding : function(eventArgs) {
1283        /// <summary>
1284        /// Raise the hiding event
1285        /// </summary>
1286        /// <param name="eventArgs" type="Sys.CancelEventArgs" mayBeNull="false">
1287        /// Event arguments for the hiding event
1288        /// </param>
1289        /// <returns />
1290        
1291        var handler = this.get_events().getHandler('hiding');
1292        if (handler) {
1293            handler(this, eventArgs);
1294        }
1295    },
1296    
1297    add_hidden : function(handler) {
1298        /// <summary>
1299        /// Add an event handler for the hidden event
1300        /// </summary>
1301        /// <param name="handler" type="Function" mayBeNull="false">
1302        /// Event handler
1303        /// </param>
1304        /// <returns />
1305        this.get_events().addHandler('hidden', handler);
1306    },
1307    remove_hidden : function(handler) {
1308        /// <summary>
1309        /// Remove an event handler from the hidden event
1310        /// </summary>
1311        /// <param name="handler" type="Function" mayBeNull="false">
1312        /// Event handler
1313        /// </param>
1314        /// <returns />
1315        this.get_events().removeHandler('hidden', handler);
1316    },
1317    raiseHidden : function(eventArgs) {
1318        /// <summary>
1319        /// Raise the hidden event
1320        /// </summary>
1321        /// <param name="eventArgs" type="Sys.EventArgs" mayBeNull="false">
1322        /// Event arguments for the hidden event
1323        /// </param>
1324        /// <returns />
1325        
1326        var handler = this.get_events().getHandler('hidden');
1327        if (handler) {
1328            handler(this, eventArgs);
1329        }
1330    },
1331    
1332    add_itemSelected : function(handler) {
1333        /// <summary>
1334        /// Add an event handler for the itemSelected event
1335        /// </summary>
1336        /// <param name="handler" type="Function" mayBeNull="false">
1337        /// Event handler
1338        /// </param>
1339        /// <returns />
1340        this.get_events().addHandler('itemSelected', handler);
1341    },
1342    remove_itemSelected : function(handler) {
1343        /// <summary>
1344        /// Remove an event handler from the itemSelected event
1345        /// </summary>
1346        /// <param name="handler" type="Function" mayBeNull="false">
1347        /// Event handler
1348        /// </param>
1349        /// <returns />
1350        this.get_events().removeHandler('itemSelected', handler);
1351    },
1352    raiseItemSelected : function(eventArgs) {
1353        /// <summary>
1354        /// Raise the itemSelected event
1355        /// </summary>
1356        /// <param name="eventArgs" type="AjaxControlToolkit.AutoCompleteItemEventArgs" mayBeNull="false">
1357        /// Event arguments for the itemSelected event
1358        /// </param>
1359        /// <returns />
1360        
1361        var handler = this.get_events().getHandler('itemSelected');
1362        if (handler) {
1363            handler(this, eventArgs);
1364        }
1365    },
1366    
1367    add_itemOver : function(handler) {
1368        /// <summary>
1369        /// Add an event handler for the itemOver event
1370        /// </summary>
1371        /// <param name="handler" type="Function" mayBeNull="false">
1372        /// Event handler
1373        /// </param>
1374        /// <returns />
1375        this.get_events().addHandler('itemOver', handler);
1376    },
1377    remove_itemOver : function(handler) {
1378        /// <summary>
1379        /// Remove an event handler from the itemOver event
1380        /// </summary>
1381        /// <param name="handler" type="Function" mayBeNull="false">
1382        /// Event handler
1383        /// </param>
1384        /// <returns />
1385        this.get_events().removeHandler('itemOver', handler);
1386    },
1387    raiseItemOver : function(eventArgs) {
1388        /// <summary>
1389        /// Raise the itemOver event
1390        /// </summary>
1391        /// <param name="eventArgs" type="AjaxControlToolkit.AutoCompleteItemEventArgs" mayBeNull="false">
1392        /// Event arguments for the itemOver event
1393        /// </param>
1394        /// <returns />
1395        
1396        var handler = this.get_events().getHandler('itemOver');
1397        if (handler) {
1398            handler(this, eventArgs);
1399        }
1400    },
1401    
1402    add_itemOut : function(handler) {
1403        /// <summary>
1404        /// Add an event handler for the itemOut event
1405        /// </summary>
1406        /// <param name="handler" type="Function" mayBeNull="false">
1407        /// Event handler
1408        /// </param>
1409        /// <returns />
1410        this.get_events().addHandler('itemOut', handler);
1411    },
1412    remove_itemOut : function(handler) {
1413        /// <summary>
1414        /// Remove an event handler from the itemOut event
1415        /// </summary>
1416        /// <param name="handler" type="Function" mayBeNull="false">
1417        /// Event handler
1418        /// </param>
1419        /// <returns />
1420        this.get_events().removeHandler('itemOut', handler);
1421    },
1422    raiseItemOut : function(eventArgs) {
1423        /// <summary>
1424        /// Raise the itemOut event
1425        /// </summary>
1426        /// <param name="eventArgs" type="AjaxControlToolkit.AutoCompleteItemEventArgs" mayBeNull="false">
1427        /// Event arguments for the itemOut event
1428        /// </param>
1429        /// <returns />
1430        
1431        var handler = this.get_events().getHandler('itemOut');
1432        if (handler) {
1433            handler(this, eventArgs);
1434        }
1435    }
1436}
1437AjaxControlToolkit.AutoCompleteBehavior.registerClass('AjaxControlToolkit.AutoCompleteBehavior', AjaxControlToolkit.BehaviorBase);
1438AjaxControlToolkit.AutoCompleteBehavior.descriptor = {
1439    properties: [   {name: 'completionInterval', type: Number},
1440                    {name: 'completionList', isDomElement: true},
1441                    {name: 'completionListElementID', type: String},
1442                    {name: 'completionSetCount', type: Number},
1443                    {name: 'minimumPrefixLength', type: Number},
1444                    {name: 'serviceMethod', type: String},
1445                    {name: 'servicePath', type: String},
1446                    {name: 'enableCaching', type: Boolean},
1447                    {name: 'showOnlyCurrentWordInCompletionListItem', t
1447ype: Boolean} ]
1448}
1449
1450
1451AjaxControlToolkit.AutoCompleteItemEventArgs = function(item, text, value) {
1452    /// <summary>
1453    /// Event arguments used when the itemSelected event is raised
1454    /// </summary>
1455    /// <param name="item" type="Sys.UI.DomElement" DomElement="true" mayBeNull="true">
1456    /// Item
1457    /// </param>
1458    /// <param name="text" type="String" mayBeNull="true">
1459    /// Text of the item
1460    /// </param>
1461    /// <param name="value" type="String" mayBeNull="true" optional="true">
1462    /// Value of the item different from text if specifically returned by the webservice
1463    /// as autocomplete json text/value item(using AutoComplete.CreateAutoCompleteItem); otherwise same as text.
1464    /// </param>
1465    AjaxControlToolkit.AutoCompleteItemEventArgs.initializeBase(this);
1466    
1467    this._item = item;
1468    this._text = text;
1469    this._value = (value !== undefined) ? value : null;
1470}
1471AjaxControlToolkit.AutoCompleteItemEventArgs.prototype = {
1472    get_item : function() {
1473        /// <value type="Sys.UI.DomElement" DomElement="true" mayBeNull="true">
1474        /// Item
1475        /// </value>
1476        return this._item;
1477    },
1478    set_item : function(value) {
1479        this._item = value;
1480    },
1481    
1482    get_text : function() {
1483        /// <value type="String" maybeNull="true">
1484        /// Text of the item
1485        /// </value>
1486        return this._text;
1487    },
1488    set_text : function(value) {
1489        this._text = value;
1490    },
1491    
1492    get_value : function() {
1493        /// <value type="String" maybeNull="true">
1494        /// Value of the item different from text if specifically returned by the webservice
1495        /// as autocomplete json text/value item(using AutoComplete.CreateAutoCompleteItem); otherwise same as text.
1496        /// </value>
1497        return this._value;
1498    },
1499    set_value : function(value) {
1500        this._value = value;
1501    }
1502}
1503AjaxControlToolkit.AutoCompleteItemEventArgs.registerClass('AjaxControlToolkit.AutoCompleteItemEventArgs', Sys.EventArgs);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.