// // // var actualSuggestElementIndex = -1; var mouseOutSuggestInputElementFlag = false; var mouseOutSuggestOutputElementFlag = false; var searchSuggestLinkFlag = -1; // // // function searchSuggest(searchParentContainerId, e) { var actualEvent; if(e) { actualEvent = e; } else if (window.event) { actualEvent = window.event; } if (actualEvent) { var key = actualEvent.keyCode; } var parentDivElement = document.getElementById(searchParentContainerId); var childArray = parentDivElement.childNodes; for (i=0;i0) { suggestOutputElement.style.visibility = "visible"; } suggestInputElement.onkeyup = function(event){ handleSuggestOutputKeyDown(suggestInputElement,suggestOutputElement,suggestionArray,searchParentContainerId,xmlDataUrl,event,searchSuggestLinkFlag); }; } }; /* var bodyElement = document.getElementsByTagName("body")[0]; bodyElement.onmousemove = function (){ if ((mouseOutSuggestInputElementFlag) && (mouseOutSuggestOutputElementFlag)) { suggestOutputElement.style.visibility = "hidden"; } };*/ xmlhttp.open("GET",xmlDataUrl,true); if (xmlhttp.overrideMimeType) xmlhttp.overrideMimeType('text/xml'); xmlhttp.send(null); } } // // // function handleSuggestOutputKeyDown(suggestInputElement,suggestOutputElement,suggestionArray,searchParentContainerId,xmlDataUrl,e,searchSuggestLinkFlag) { var actualEvent; if(e) { actualEvent = e; } else { actualEvent = window.event; } var key = actualEvent.keyCode; if (key == 40 || key == 39) { if(suggestInputElement.value.length > 0) { if ((actualSuggestElementIndex + 1) < suggestionArray.length) { actualSuggestElementIndex = actualSuggestElementIndex + 1; } else { actualSuggestElementIndex = 0; } for(i=0;i 0) { if ((actualSuggestElementIndex - 1) >= 0) { actualSuggestElementIndex = actualSuggestElementIndex - 1; } else { actualSuggestElementIndex = suggestionArray.length-1; } for(i=0;i 0) { suggestInputElement.value = document.getElementById("suggestElement"+actualSuggestElementIndex).innerHTML; } setSearch(this.value,suggestInputElement,suggestOutputElement); } else { window.open(document.getElementById("suggestElement"+actualSuggestElementIndex).href, "_self"); } } else if (key == 27) { suggestInputElement.focus(); suggestOutputElement.style.visibility = "hidden"; actualSuggestElementIndex = 0; suggestInputElement.value =""; } else { suggestInputElement.focus(); searchSuggest(searchParentContainerId,xmlDataUrl,e); } } // // // function suggestOver(divElement) { divElement.className = 'suggestLinkOver'; } // // // function suggestOut(divElement) { divElement.className = 'suggestLink'; } // // // function setSearch(value,suggestInputElement,suggestOutputElement) { suggestInputElement.value = value; suggestOutputElement.style.visibility = "hidden"; suggestInputElement.focus(); } // // // function getXMLHTTPRequest() { var xmlhttp = false; if(location.protocol=="file:") { if(!xmlhttp) { try{ xmlhttp=new ActiveXObject("MSXML2.XMLHTTP"); } catch(e){ xmlhttp=false; } } if(!xmlhttp) { try{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ xmlhttp=false; } } } if(!xmlhttp) { try{ xmlhttp=new XMLHttpRequest(); } catch(e){ xmlhttp=false; } } if(typeof ActiveXObject != "undefined") { if(!xmlhttp) { try{ xmlhttp=new ActiveXObject("MSXML2.XMLHTTP"); } catch(e){ xmlhttp=false; } } if(!xmlhttp) { try{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ xmlhttp=false; } } } return xmlhttp; } // // // function openResults(targetTemplatePart1, targetTemplatePart2) { var inputText = document.getElementById("suggestInput").value; var newURL = targetTemplatePart1 + inputText + targetTemplatePart2; window.open(newURL, "_self"); }