"function convertToId(search)\n" "{\n" " var result = '';\n" " for (i=0;i do a search\n" " {\n" " this.Search();\n" " }\n" " }\n" "\n" " this.OnSearchSelectKey = function(evt)\n" " {\n" " var e = (evt) ? evt : window.event; // for IE\n" " if (e.keyCode==40 && this.searchIndex0) // Up\n" " {\n" " this.searchIndex--;\n" " this.OnSelectItem(this.searchIndex);\n" " }\n" " else if (e.keyCode==13 || e.keyCode==27)\n" " {\n" " this.OnSelectItem(this.searchIndex);\n" " this.CloseSelectionWindow();\n" " this.DOMSearchField().focus();\n" " }\n" " return false;\n" " }\n" "\n" " // --------- Actions\n" "\n" " // Closes the results window.\n" " this.CloseResultsWindow = function()\n" " {\n" " this.DOMPopupSearchResultsWindow().style.display = 'none';\n" " this.DOMSearchClose().style.display = 'none';\n" " this.Activate(false);\n" " }\n" "\n" " this.CloseSelectionWindow = function()\n" " {\n" " this.DOMSearchSelectWindow().style.display = 'none';\n" " }\n" "\n" " // Performs a search.\n" " this.Search = function()\n" " {\n" " this.keyTimeout = 0;\n" "\n" " // strip leading whitespace\n" " var searchValue = this.DOMSearchField().value.replace(/^ +/, \"\");\n" "\n" " var code = searchValue.toLowerCase().charCodeAt(0);\n" " var idxChar = searchValue.substr(0, 1).toLowerCase();\n" " if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) // surrogate pair\n" " {\n" " idxChar = searchValue.substr(0, 2);\n" " }\n" "\n" " var resultsPage;\n" " var resultsPageWithSearch;\n" " var hasResultsPage;\n" "\n" " var idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar);\n" " if (idx!=-1)\n" " {\n" " var hexCode=idx.toString(16);\n" " resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html';\n" " resultsPageWithSearch = resultsPage+'?'+escape(searchValue);\n" " hasResultsPage = true;\n" " }\n" " else // nothing available for this search term\n" " {\n" " resultsPage = this.resultsPath + '/nomatches.html';\n" " resultsPageWithSearch = resultsPage;\n" " hasResultsPage = false;\n" " }\n" "\n" " window.frames.MSearchResults.location = resultsPageWithSearch; \n" " var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow();\n" "\n" " if (domPopupSearchResultsWindow.style.display!='block')\n" " {\n" " var domSearchBox = this.DOMSearchBox();\n" " this.DOMSearchClose().style.display = 'inline';\n" " if (this.insideFrame)\n" " {\n" " var domPopupSearchResults = this.DOMPopupSearchResults();\n" " domPopupSearchResultsWindow.style.position = 'relative';\n" " domPopupSearchResultsWindow.style.display = 'block';\n" " var width = document.body.clientWidth - 8; // the -8 is for IE :-(\n" " domPopupSearchResultsWindow.style.width = width + 'px';\n" " domPopupSearchResults.style.width = width + 'px';\n" " }\n" " else\n" " {\n" " var domPopupSearchResults = this.DOMPopupSearchResults();\n" " var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth;\n" " var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1;\n" " domPopupSearchResultsWindow.style.display = 'block';\n" " left -= domPopupSearchResults.offsetWidth;\n" " domPopupSearchResultsWindow.style.top = top + 'px';\n" " domPopupSearchResultsWindow.style.left = left + 'px';\n" " }\n" " }\n" "\n" " this.lastSearchValue = searchValue;\n" " this.lastResultsPage = resultsPage;\n" " }\n" "\n" " // -------- Activation Functions\n" "\n" " // Activates or deactivates the search panel, resetting things to \n" " // their default values if necessary. \n" " this.Activate = function(isActive)\n" " {\n" " if (isActive || // open it\n" " this.DOMPopupSearchResultsWindow().style.display == 'block' \n" " )\n" " {\n" " this.DOMSearchBox().className = 'MSearchBoxActive';\n" "\n" " var searchField = this.DOMSearchField();\n" "\n" " if (searchField.value == this.searchLabel) // clear \"Search\" term upon entry\n" " { \n" " searchField.value = ''; \n" " this.searchActive = true;\n" " }\n" " }\n" " else if (!isActive) // directly remove the panel\n" " {\n" " this.DOMSearchBox().className = 'MSearchBoxInactive';\n" " this.DOMSearchField().value = this.searchLabel;\n" " this.searchActive = false;\n" " this.lastSearchValue = ''\n" " this.lastResultsPage = '';\n" " }\n" " }\n" "}\n" "\n" "// -----------------------------------------------------------------------\n" "\n" "// The class that handles everything on the search results page.\n" "function SearchResults(name)\n" "{\n" " // The number of matches from the last run of .\n" " this.lastMatchCount = 0;\n" " this.lastKey = 0;\n" " this.repeatOn = false;\n" "\n" " // Toggles the visibility of the passed element ID.\n" " this.FindChildElement = function(id)\n" " {\n" " var parentElement = document.getElementById(id);\n" " var element = parentElement.firstChild;\n" "\n" " while (element && element!=parentElement)\n" " {\n" " if (element.nodeName == 'DIV' && element.className == 'SRChildren')\n" " {\n" " return element;\n" " }\n" "\n" " if (element.nodeName == 'DIV' && element.hasChildNodes())\n" " { \n" " element = element.firstChild; \n" " }\n" " else if (element.nextSibling)\n" " { \n" " element = element.nextSibling; \n" " }\n" " else\n" " {\n" " do\n" " {\n" " element = element.parentNode;\n" " }\n" " while (element && element!=parentElement && !element.nextSibling);\n" "\n" " if (element && element!=parentElement)\n" " { \n" " element = element.nextSibling; \n" " }\n" " }\n" " }\n" " }\n" "\n" " this.Toggle = function(id)\n" " {\n" " var element = this.FindChildElement(id);\n" " if (element)\n" " {\n" " if (element.style.display == 'block')\n" " {\n" " element.style.display = 'none';\n" " }\n" " else\n" " {\n" " element.style.display = 'block';\n" " }\n" " }\n" " }\n" "\n" " // Searches for the passed string. If there is no parameter,\n" " // it takes it from the URL query.\n" " //\n" " // Always returns true, since other documents may try to call it\n" " // and that may or may not be possible.\n" " this.Search = function(search)\n" " {\n" " if (!search) // get search word from URL\n" " {\n" " search = window.location.search;\n" " search = search.substring(1); // Remove the leading '?'\n" " search = unescape(search);\n" " }\n" "\n" " search = search.replace(/^ +/, \"\"); // strip leading spaces\n" " search = search.replace(/ +$/, \"\"); // strip trailing spaces\n" " search = search.toLowerCase();\n" " search = convertToId(search);\n" "\n" " var resultRows = document.getElementsByTagName(\"div\");\n" " var matches = 0;\n" "\n" " var i = 0;\n" " while (i < resultRows.length)\n" " {\n" " var row = resultRows.item(i);\n" " if (row.className == \"SRResult\")\n" " {\n" " var rowMatchName = row.id.toLowerCase();\n" " rowMatchName = rowMatchName.replace(/^sr\\d*_/, ''); // strip 'sr123_'\n" "\n" " if (search.length<=rowMatchName.length && \n" " rowMatchName.substr(0, search.length)==search)\n" " {\n" " row.style.display = 'block';\n" " matches++;\n" " }\n" " else\n" " {\n" " row.style.display = 'none';\n" " }\n" " }\n" " i++;\n" " }\n" " document.getElementById(\"Searching\").style.display='none';\n" " if (matches == 0) // no results\n" " {\n" " document.getElementById(\"NoMatches\").style.display='block';\n" " }\n" " else // at least one result\n" " {\n" " document.getElementById(\"NoMatches\").style.display='none';\n" " }\n" " this.lastMatchCount = matches;\n" " return true;\n" " }\n" "\n" " // return the first item with index index or higher that is visible\n" " this.NavNext = function(index)\n" " {\n" " var focusItem;\n" " while (1)\n" " {\n" " var focusName = 'Item'+index;\n" " focusItem = document.getElementById(focusName);\n" " if (focusItem && focusItem.parentNode.parentNode.style.display=='block')\n" " {\n" " break;\n" " }\n" " else if (!focusItem) // last element\n" " {\n" " break;\n" " }\n" " focusItem=null;\n" " index++;\n" " }\n" " return focusItem;\n" " }\n" "\n" " this.NavPrev = function(index)\n" " {\n" " var focusItem;\n" " while (1)\n" " {\n" " var focusName = 'Item'+index;\n" " focusItem = document.getElementById(focusName);\n" " if (focusItem && focusItem.parentNode.parentNode.style.display=='block')\n" " {\n" " break;\n" " }\n" " else if (!focusItem) // last element\n" " {\n" " break;\n" " }\n" " focusItem=null;\n" " index--;\n" " }\n" " return focusItem;\n" " }\n" "\n" " this.ProcessKeys = function(e)\n" " {\n" " if (e.type == \"keydown\") \n" " {\n" " this.repeatOn = false;\n" " this.lastKey = e.keyCode;\n" " }\n" " else if (e.type == \"keypress\")\n" " {\n" " if (!this.repeatOn)\n" " {\n" " if (this.lastKey) this.repeatOn = true;\n" " return false; // ignore first keypress after keydown\n" " }\n" " }\n" " else if (e.type == \"keyup\")\n" " {\n" " this.lastKey = 0;\n" " this.repeatOn = false;\n" " }\n" " return this.lastKey!=0;\n" " }\n" "\n" " this.Nav = function(evt,itemIndex) \n" " {\n" " var e = (evt) ? evt : window.event; // for IE\n" " if (e.keyCode==13) return true;\n" " if (!this.ProcessKeys(e)) return false;\n" "\n" " if (this.lastKey==38) // Up\n" " {\n" " var newIndex = itemIndex-1;\n" " var focusItem = this.NavPrev(newIndex);\n" " if (focusItem)\n" " {\n" " var child = this.FindChildElement(focusItem.parentNode.parentNode.id);\n" " if (child && child.style.display == 'block') // children visible\n" " { \n" " var n=0;\n" " var tmpElem;\n" " while (1) // search for last child\n" " {\n" " tmpElem = document.getElementById('Item'+newIndex+'_c'+n);\n" " if (tmpElem)\n" " {\n" " focusItem = tmpElem;\n" " }\n" " else // found it!\n" " {\n" " break;\n" " }\n" " n++;\n" " }\n" " }\n" " }\n" " if (focusItem)\n" " {\n" " focusItem.focus();\n" " }\n" " else // return focus to search field\n" " {\n" " parent.document.getElementById(\"MSearchField\").focus();\n" " }\n" " }\n" " else if (this.lastKey==40) // Down\n" " {\n" " var newIndex = itemIndex+1;\n" " var focusItem;\n" " var item = document.getElementById('Item'+itemIndex);\n" " var elem = this.FindChildElement(item.parentNode.parentNode.id);\n" " if (elem && elem.style.display == 'block') // children visible\n" " {\n" " focusItem = document.getElementById('Item'+itemIndex+'_c0');\n" " }\n" " if (!focusItem) focusItem = this.NavNext(newIndex);\n" " if (focusItem) focusItem.focus();\n" " }\n" " else if (this.lastKey==39) // Right\n" " {\n" " var item = document.getElementById('Item'+itemIndex);\n" " var elem = this.FindChildElement(item.parentNode.parentNode.id);\n" " if (elem) elem.style.display = 'block';\n" " }\n" " else if (this.lastKey==37) // Left\n" " {\n" " var item = document.getElementById('Item'+itemIndex);\n" " var elem = this.FindChildElement(item.parentNode.parentNode.id);\n" " if (elem) elem.style.display = 'none';\n" " }\n" " else if (this.lastKey==27) // Escape\n" " {\n" " parent.searchBox.CloseResultsWindow();\n" " parent.document.getElementById(\"MSearchField\").focus();\n" " }\n" " else if (this.lastKey==13) // Enter\n" " {\n" " return true;\n" " }\n" " return false;\n" " }\n" "\n" " this.NavChild = function(evt,itemIndex,childIndex)\n" " {\n" " var e = (evt) ? evt : window.event; // for IE\n" " if (e.keyCode==13) return true;\n" " if (!this.ProcessKeys(e)) return false;\n" "\n" " if (this.lastKey==38) // Up\n" " {\n" " if (childIndex>0)\n" " {\n" " var newIndex = childIndex-1;\n" " document.getElementById('Item'+itemIndex+'_c'+newIndex).focus();\n" " }\n" " else // already at first child, jump to parent\n" " {\n" " document.getElementById('Item'+itemIndex).focus();\n" " }\n" " }\n" " else if (this.lastKey==40) // Down\n" " {\n" " var newIndex = childIndex+1;\n" " var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex);\n" " if (!elem) // last child, jump to parent next parent\n" " {\n" " elem = this.NavNext(itemIndex+1);\n" " }\n" " if (elem)\n" " {\n" " elem.focus();\n" " } \n" " }\n" " else if (this.lastKey==27) // Escape\n" " {\n" " parent.searchBox.CloseResultsWindow();\n" " parent.document.getElementById(\"MSearchField\").focus();\n" " }\n" " else if (this.lastKey==13) // Enter\n" " {\n" " return true;\n" " }\n" " return false;\n" " }\n" "}\n" "\n" "function setKeyActions(elem,action)\n" "{\n" " elem.setAttribute('onkeydown',action);\n" " elem.setAttribute('onkeypress',action);\n" " elem.setAttribute('onkeyup',action);\n" "}\n" "\n" "function setClassAttr(elem,attr)\n" "{\n" " elem.setAttribute('class',attr);\n" " elem.setAttribute('className',attr);\n" "}\n" "\n" "function createResults()\n" "{\n" " var results = document.getElementById(\"SRResults\");\n" " for (var e=0; e