addToListbox = function(oLb, aValues, iMax, bSeparatorBefore) {
				aValues = aValues ? aValues : [];
				var iCount = Math.min(aValues.length, iMax);

				if (bSeparatorBefore && iCount > 0) {
					oLb.addItem(new SeparatorItem());
				}

				for (var i = 0; i < iCount; i++) {
					// oLb.addAggregation("items", new sap.ui.core.ListItem({text: aSug[i]}), true);
					oLb.addItem(new ListItem({
						text: aValues[i]
					}));
				}
				return iCount;
			}
********************************************
	// Private helper functions
	//***********************************************

	var _setClearTooltip = function(oThis){
		var $this = oThis.$(),
			$ico = oThis._ctrl.$("searchico");

		if ($this.hasClass("sapUiSearchFieldClear") && $this.hasClass("sapUiSearchFieldVal")) {
			$ico.attr("title", oThis._clearTooltipText);
		} else {
			$ico.removeAttr("title");
		}
	};

	var _set = function(oThis, sMutator, oVal, bSuppressRerendering, bUpdateModelProperty) {
		var oOldVal = _get(oThis, sMutator);
		oThis._ctrl["set" + sMutator](oVal);
		if (!bSuppressRerendering) {
			oThis.invalidate();
		}
		if (bUpdateModelProperty) {
			oThis.updateModelProperty(sMutator.toLowerCase(), oVal, oOldVal);
		}
		return oThis;
	};


	var _get = function(oThis, sGetter) {
		return oThis._ctrl["get" + sGetter]();
	};


	var _initChildControls = function(oThis, bEnableListSuggest) {
		if (!oThis._lb) {
			oThis._lb = new ListBox(oThis.getId() + "-lb");
		}

		var oOldControl = oThis._ctrl;
		var oNewControl = null;
		if (bEnableListSuggest) {
			oNewControl = new SearchField.CB(oThis.getId() + "-cb", {listBox: oThis._lb, maxPopupItems: _DEFAULT_VISIBLE_ITEM_COUNT});
			oNewControl.addDependent(oThis._lb);
		} else {
			oNewControl = new SearchField.TF(oThis.getId() + "-tf");
		}
		oNewControl.setParent(oThis);
		oNewControl.addEventDelegate({
			onAfterRendering: function(){
				_setClearTooltip(oThis);
				var $Focus = jQuery(oNewControl.getFocusDomRef());
				var sLabelledBy = $Focus.attr("aria-labelledby") || "";
				if (sLabelledBy) {
					sLabelledBy = " " + sLabelledBy;
				}
				$Focus.attr("aria-labelledby", oThis.getId() + "-label" + sLabelledBy);
			}
		});
		if (oOldControl) {
			oNewControl.setValue(oOldControl.getValue());
			oNewControl.setEnabled(oOldControl.getEnabled());
			oNewControl.setEditable(oOldControl.getEditable());
			oNewControl.setMaxLength(oOldControl.getMaxLength());
			oNewControl.setValueState(oOldControl.getValueState());
			oNewControl.setPlaceholder(oOldControl.getPlaceholder());
			oNewControl.setTextAlign(oOldControl.getTextAlign());
			oNewControl.setTooltip(oOldControl.getTooltip());
			oNewControl.setMaxPopupItems(oOldControl.getMaxPopupItems());

			var aAsso = oOldControl.getAriaDescribedBy();
			for (var i = 0; i < aAsso.length; i++) {
				oNewControl.addAriaDescribedBy(aAsso[i]);
			}
			oOldControl.removeAllAriaDescribedBy();

			aAsso = oOldControl.getAriaLabelledBy();
			for (var i = 0; i < aAsso.length; i++) {
				oNewControl.addAriaLabelledBy(aAsso[i]);
			}
			oOldControl.removeAllAriaLabelledBy();
			oOldControl.removeAllDependents();

			oOldControl.destroy();
		}
		oThis._ctrl = oNewControl;
	};


	var getText = function(sKey, aArgs) {
		var rb = sap.ui.getCore().getLibraryResourceBundle("sap.ui.commons");
		if (rb) {
			return rb.getText(sKey, aArgs);
		}
		return sKey;
	};


	var isMobile = function() {
		return Device.browser.mobile && !Device.system.desktop;
	};


	//***********************************************
	//***********************************************
	// Inner Controls
	//***********************************************

	var _renderSearchIcon = function(oRM, oCtrl){
		oRM.write("<div");
		oRM.writeAttributeEscaped('id', oCtrl.getId() + '-searchico');
		oRM.writeAttribute('unselectable', 'on');
		if (Configuration.getAccessibility()) {
			oRM.writeAttribute("role", "presentation");
		}
		oRM.addClass("sapUiSearchFieldIco");
		oRM.writeClasses();
		oRM.write("></div>");
	};


	//***********************************************
	// Inner Control "Search Textfield"
	//***********************************************

	TextField.extend("sap.ui.commons.SearchField.TF", {

		metadata : {
			library: "sap.ui.commons"
		},

	  constructor : function (sId, mSettings) {
			TextField.apply(this, arguments);
	  },

	  getInputDomRef : function() {
			return this.getDomRef("input");
	  },

	  onkeyup : function(oEvent) {
			SearchField.CB.prototype.onkeyup.apply(this, arguments);
	  },

	  _triggerSuggest : function(sCurrentValue) {
			this._sSuggest = null;
			if ((sCurrentValue && sCurrentValue.length >= this.getParent().getStartSuggestion()) || (!sCurrentValue && this.getParent().getStartSuggestion() == 0)) {
				this.getParent().fireSuggest({value: sCurrentValue});
			}
	  },

	  _checkChange : function(oEvent, bDoNotFireSearch) {
			this.getParent().fireSearch({noFocus:bDoNotFireSearch});
	  },

	  onsapfocusleave : function(oEvent) {
			if (this.getEditable() && this.getEnabled() && this.getRenderer().onblur && oEvent.relatedControlId != this.getId()) {
				this.getRenderer().onblur(this);
			}
			this._checkChange(oEvent, true);
	  },

	  onclick : function(oEvent){
			if (oEvent.target === this.getDomRef("searchico")) {
				if (this.oPopup && this.oPopup.isOpen()) {
					this.oPopup.close();
				}
				if (this.getEditable() && this.getEnabled()) {
					this.focus();
				}
				if (!this.getParent().getEnableClear()) {
					this._checkChange(oEvent);
				} else {
					if (!jQuery(this.getInputDomRef()).val() || !this.getEditable() || !this.getEnabled()) {
					return;
				}
					this.setValue("");
					this._triggerValueHelp = true;
					this.onkeyup();
					if (this.getParent().getEnableFilterMode()) {
						jQuery(this.getInputDomRef()).val("");
						this.getParent().fireSearch();
					}
				}
			}
	  },

	  getMaxPopupItems : function(){
			return this._iVisibleItemCount ? this._iVisibleItemCount : _DEFAULT_VISIBLE_ITEM_COUNT;
	  },

	  setMaxPopupItems : function(iMaxPopupItems){
			this._iVisibleItemCount = iMaxPopupItems;
	  },

	  //  extend TextFieldRenderer
	  renderer : {

	    renderOuterContentBefore :_renderSearchIcon,

	    renderOuterAttributes : function(oRM, oCtrl) {
	      oRM.addClass("sapUiSearchFieldTf");
	    },

	    renderInnerAttributes : function(oRM, oCtrl) {
			if (!Device.os.ios) { //on iOS the input is not focused if type search
					oRM.writeAttribute("type", "search");
				}
	      if (isMobile()) {
	        oRM.writeAttribute('autocapitalize', 'off');
	        oRM.writeAttribute('autocorrect', 'off');
	      }
	    }

	  }
	});

	// TODO enhance Notepad controls to support such assignments (e.g. "a,b" : function () { ... } )
	SearchField.TF.prototype.getFocusDomRef = SearchField.TF.prototype.getInputDomRef;


	//***********************************************
	// Inner Control "Search Combo Box"
	//***********************************************

	ComboBox.extend("sap.ui.commons.SearchField.CB", {

		metadata : {
			library: "sap.ui.commons"
		},

		constructor: function(sId, mSettings) {
			ComboBox.apply(this, arguments);
			this._mSuggestions = {};
			this._aSuggestValues = [];
			this.mobile = false; // switch off native dropdown version
		},

		updateSuggestions: function(sSuggestVal, aSuggestions) {
			this._mSuggestions[sSuggestVal] = aSuggestions;
			if (this.getInputDomRef() && jQuery(this.getInputDomRef()).val() === sSuggestVal && this._hasSuggestValue(sSuggestVal)) {
				this._doUpdateList(sSuggestVal);
			}
		},

		applyFocusInfo: function(oFocusInfo) {
			jQuery(this.getInputDomRef()).val(oFocusInfo.sTypedChars);
			return this;
		},

		_getListBox: function() {
			return this.getParent()._lb;
		},

		_hasSuggestValue: function(sSuggestVal) {
			return this._aSuggestValues.length > 0 && sSuggestVal == this._aSuggestValues[this._aSuggestValues.length - 1];
		},

		_doUpdateList: function(sSuggestVal, bSkipOpen) {
			var bEmpty = this._updateList(sSuggestVal);
			this._aSuggestValues = [sSuggestVal];
			if ((!this.oPopup || !this.oPopup.isOpen()) && !bSkipOpen && !bEmpty) {
				this._open();
			} else if (this.oPopup && this.oPopup.isOpen() && bEmpty) {
				this._close();
			}

			if (!bEmpty && !this._lastKeyIsDel && sSuggestVal === jQuery(this.getInputDomRef()).val()) {
				this._doTypeAhead();
			}
		},

		onclick: function(oEvent) {
			//this._forceOpen = true;
			ComboBox.prototype.onclick.apply(this, arguments);
			//this._forceOpen = false;
			if (oEvent.target === this.getDomRef("searchico")) {
				if (this.oPopup && this.oPopup.isOpen()) {
					this.oPopup.close();
				}
				if (!this.getParent().getEnableClear()) {
					this.getParent().fireSearch();
				} else if (jQuery(this.getInputDomRef()).val() && this.getEditable() && this.getEnabled()) {
					this.setValue("");
					this._triggerValueHelp = true;
					this.onkeyup();
					this._aSuggestValues = [];
					if (this.getParent().getEnableFilterMode()) {
						jQuery(this.getInputDomRef()).val("");
						this.getParent().fireSearch();
					}
				}
				if (this.getEditable() && this.getEnabled()) {
					this.focus();
				}
			} else if (containsOrEquals(this.getDomRef("providerico"), oEvent.target)) {
				if (this.getEditable() && this.getEnabled()) {
					this.focus();
				}
			}
		},

		onkeypress: SearchField.TF.prototype.onkeypress,

		onkeyup: function(oEvent) {
			var $Input = jQuery(this.getInputDomRef());
			var sVal = $Input.val();

			this.getParent().$().toggleClass("sapUiSearchFieldVal", !!sVal);
			_setClearTooltip(this.getParent());

			if (oEvent) {
				if (oEvent.keyCode === KeyCodes.F2) {
					// toggle action mode
					var $FocusDomRef = jQuery(this.getFocusDomRef());
					var bDataInNavArea = $FocusDomRef.data("sap.InNavArea");
					if (typeof bDataInNavArea === "boolean") {
						$FocusDomRef.data("sap.InNavArea", !bDataInNavArea);
					}
				}

				if (ComboBox._isHotKey(oEvent) || oEvent.keyCode === KeyCodes.F4 && oEvent.which === 0 /* this is the Firefox case and ensures 's' with same charCode is accepted