var autocomplete=new function(){var me=this;var inputNodes;var listContainerNode;var bodyNode;var minLength;var req;var currentLookupString="";var currentFocusedInputNode=null;var numberCurrentValues;var lastLookupString="",lastLookupValues;me.values=null;me.x=-1;me.y=-1;me.init=function(){if(EventHelpers.hasPageLoadHappened(arguments))return;bodyNode=document.getElementsByTagName('body')[0];minLength=config.getIntegerValue('autocomplete.values.minLength',0);createListContainerNode();setInitialEvents()}function createListContainerNode(){listContainerNode=document.createElement('div');listContainerNode.style.display='none';listContainerNode.style.position='absolute';listContainerNode.id='autocomplete-selection'bodyNode.appendChild(listContainerNode)}function setInitialEvents(){inputNodes=CSSHelpers.getElementsByClassName(document,'autocomplete_input');for(var i=0;i0){firstListItemNode=listItemNodes[0]}else{firstListItemNode=listItemNodes}jslog.debug('firstListItemNode: '+firstListItemNode.nodeName)if(firstListItemNode){switch(firstListItemNode.nodeName){case"OPTION":firstListItemNode.selected='selected';replaceValue(firstListItemNode);listNode.focus();break}}}function getListEvent(e){activeInputNode=EventHelpers.getEventTarget(e);currentLookupString=activeInputNode.value;if(currentLookupString.length0){return listNodes[0]}else{return null}}function setAutocompleteBoxEvents(){var valueNodes=getListItemNodes();var listNode=getListNode();if(listNode){EventHelpers.addEvent(listNode,'change',replaceValueEvent);EventHelpers.addEvent(listNode,'blur',hideAutocompleteBox);EventHelpers.addEvent(listNode,'keyup',selectKeyEvent);EventHelpers.addEvent(listNode,'keydown',selectKeyEvent);EventHelpers.addEvent(listNode,'blur',focusOnInputField)}if(valueNodes){for(var i=0;i