| 83 | resultPath - path to use for external files |
| 84 | */ |
| 85 | function SearchBox(name, resultsPath, extension) |
| 86 | { |
| 87 | if (!name || !resultsPath) { alert("Missing parameters to SearchBox."); } |
| 88 | if (!extension || extension == "") { extension = ".html"; } |
| 89 | |
| 90 | // ---------- Instance variables |
| 91 | this.name = name; |
| 92 | this.resultsPath = resultsPath; |
| 93 | this.keyTimeout = 0; |
| 94 | this.keyTimeoutLength = 500; |
| 95 | this.closeSelectionTimeout = 300; |
| 96 | this.lastSearchValue = ""; |
| 97 | this.lastResultsPage = ""; |
| 98 | this.hideTimeout = 0; |
| 99 | this.searchIndex = 0; |
| 100 | this.searchActive = false; |
| 101 | this.extension = extension; |
| 102 | |
| 103 | // ----------- DOM Elements |
| 104 | |
| 105 | this.DOMSearchField = function() |
| 106 | { return document.getElementById("MSearchField"); } |
| 107 | |
| 108 | this.DOMSearchSelect = function() |
| 109 | { return document.getElementById("MSearchSelect"); } |
| 110 | |
| 111 | this.DOMSearchSelectWindow = function() |
| 112 | { return document.getElementById("MSearchSelectWindow"); } |
| 113 | |
| 114 | this.DOMPopupSearchResults = function() |
| 115 | { return document.getElementById("MSearchResults"); } |
| 116 | |
| 117 | this.DOMPopupSearchResultsWindow = function() |
| 118 | { return document.getElementById("MSearchResultsWindow"); } |
| 119 | |
| 120 | this.DOMSearchClose = function() |
| 121 | { return document.getElementById("MSearchClose"); } |
| 122 | |
| 123 | this.DOMSearchBox = function() |
| 124 | { return document.getElementById("MSearchBox"); } |
| 125 | |
| 126 | // ------------ Event Handlers |
| 127 | |
| 128 | // Called when focus is added or removed from the search field. |
| 129 | this.OnSearchFieldFocus = function(isActive) |
| 130 | { |
| 131 | this.Activate(isActive); |
| 132 | } |
| 133 | |
| 134 | this.OnSearchSelectShow = function() |
| 135 | { |
| 136 | var searchSelectWindow = this.DOMSearchSelectWindow(); |
| 137 | var searchField = this.DOMSearchSelect(); |
| 138 | |
| 139 | var left = getXPos(searchField); |
| 140 | var top = getYPos(searchField); |
| 141 | top += searchField.offsetHeight; |
| 142 | |