public MultiSelectorBehaviour(Element container, HtmlAutoCompleteBehaviour htmlAutoComplete, InputElement hiddenOutput)
		{
			this.container = container;
			this.hiddenOutput = hiddenOutput;
			this.HtmlAutoComplete = htmlAutoComplete;
			this.HtmlAutoComplete.ItemChosen = htmlAutoComplete_ItemChosen;
			selections = new PairListField(hiddenOutput);
			InitialiseInitialSelections();
			jQuery.FromElement(this.container).Click(this.OnClick);
			
		}
		public HtmlAutoCompleteBehaviour(InputElement input, InputElement hiddenInput, Element anchor, bool isSuggest, InputElement parametersHiddenField)
		{
			//ElementAttribute cometAtt = input.GetAttributeNode(HtmlAutoCompleteAttributes.CometServiceUrl);

			remoteSuggestionsGetter = new Js.ClientControls.HtmlAutoComplete.WebServiceRemoteSuggestionsGetter(
				input.GetAttributeNode(HtmlAutoCompleteAttributes.WebServiceUrl).Value,
				input.GetAttributeNode(HtmlAutoCompleteAttributes.WebServiceMethod).Value
			);
			
			this.mode = isSuggest == true ? HtmlAutoCompleteMode.Suggest : HtmlAutoCompleteMode.Complete;
			this.input = input;
			this.hiddenInput = hiddenInput;
			this.anchor = anchor == null ? input : anchor;
			jQuery.FromElement(input).Blur(delegate(jQueryEvent e) { Window.SetTimeout(DoBlur, 250); });
			jQuery.FromElement(input).Keydown(this.HandleKeyDown);
			jQuery.FromElement(input).Keyup(this.HandleKeyUp);
			jQuery.FromElement(input).Focus(CallOnFocus);

			ElementAttribute waterMarkNode = input.GetAttributeNode(HtmlAutoCompleteAttributes.Watermark);
			if (waterMarkNode != null)
			{
				watermarker = new WatermarkExtender(input, input.GetAttributeNode(HtmlAutoCompleteAttributes.Watermark).Value);
			}
			ElementAttribute popupLeftNode = input.GetAttributeNode(HtmlAutoCompleteAttributes.PopupLeftOffset);
			popupLeftOffset = popupLeftNode == null ? 0 : int.Parse(popupLeftNode.Value);
			ElementAttribute popupTopNode = input.GetAttributeNode(HtmlAutoCompleteAttributes.PopupTopOffset);
			popupTopOffset = popupTopNode == null ? 0 : int.Parse(popupTopNode.Value);
			ElementAttribute rightAlignNode = input.GetAttributeNode(HtmlAutoCompleteAttributes.RightAlign);
			rightAlign = rightAlignNode == null ? false : bool.Parse(rightAlignNode.Value);
			
			if (input.GetAttributeNode(HtmlAutoCompleteAttributes.PopupLeftOffset) != null)
			{
				popupLeftOffset = int.Parse(input.GetAttributeNode(HtmlAutoCompleteAttributes.PopupLeftOffset).Value);
			}
			Parameters = new PairListField(parametersHiddenField);
			Suggestions.OnSuggestionsChanged = delegate() { DisplaySuggestionsInPopupMenu(); };

			this.remoteSuggestionsGetter.OnAllSuggestionsReceived = delegate() 
			{ 
				RemoveLowPrioritySuggestionsAndSetRemainingSuggestionsToLowPriority();
				HideAjaxIcon();
			};
			this.remoteSuggestionsGetter.OnSuggestionsRequested = delegate()
			                                                      {
			                                                      	ShowAjaxIcon();
			                                                      };
			
			this.remoteSuggestionsGetter.OnSuggestionReceived = delegate(Suggestion[] newSuggestions) 
			{
				Trace.Write("Received" + newSuggestions.Length + "suggestions");
				if (TransformReceivedSuggestions != null)
				{
					AddSuggestions(TransformReceivedSuggestions(newSuggestions, maxNumberOfItemsToGet));
				}
				else
				{
					AddSuggestions(newSuggestions);
				}
			};
			this.remoteSuggestionsGetter.OnAbortCurrentRequest= delegate()
			                                                      {
			                                                      	HideAjaxIcon();

			                                                      };
			

		}