10 0:
"_abcdefghijklmnopqrstuvwxyz~",
14 4:
"_abcdefghijklmnopqrstuvwxyz~",
15 5:
"_abcdefghijklmnoprstuvwxyz",
18 8:
"abcdeghilmnoprstvwxyz",
20 10:
"_bdefgilmnopqrstuvw",
45 for (
i=0;
i<search.length;
i++)
47 var
c = search.charAt(
i);
48 var cn = c.charCodeAt(0);
49 if (c.match(/[
a-z0-9\u0080-\uFFFF]/))
55 result+=
"_0"+cn.toString(16);
59 result+=
"_"+cn.toString(16);
70 while (item && item!=document.body)
73 item = item.offsetParent;
84 while (item && item!=document.body)
87 item = item.offsetParent;
102 if (!name || !resultsPath) { alert(
"Missing parameters to SearchBox."); }
106 this.resultsPath = resultsPath;
108 this.keyTimeoutLength = 500;
109 this.closeSelectionTimeout = 300;
110 this.lastSearchValue =
"";
111 this.lastResultsPage =
"";
112 this.hideTimeout = 0;
113 this.searchIndex = 0;
114 this.searchActive =
false;
115 this.insideFrame = inFrame;
116 this.searchLabel = label;
120 this.DOMSearchField =
function()
121 {
return document.getElementById(
"MSearchField"); }
123 this.DOMSearchSelect =
function()
124 {
return document.getElementById(
"MSearchSelect"); }
126 this.DOMSearchSelectWindow =
function()
127 {
return document.getElementById(
"MSearchSelectWindow"); }
129 this.DOMPopupSearchResults =
function()
130 {
return document.getElementById(
"MSearchResults"); }
132 this.DOMPopupSearchResultsWindow =
function()
133 {
return document.getElementById(
"MSearchResultsWindow"); }
135 this.DOMSearchClose =
function()
136 {
return document.getElementById(
"MSearchClose"); }
138 this.DOMSearchBox =
function()
139 {
return document.getElementById(
"MSearchBox"); }
144 this.OnSearchFieldFocus =
function(isActive)
146 this.Activate(isActive);
149 this.OnSearchSelectShow =
function()
151 var searchSelectWindow = this.DOMSearchSelectWindow();
152 var searchField = this.DOMSearchSelect();
154 if (this.insideFrame)
156 var left =
getXPos(searchField);
157 var top =
getYPos(searchField);
158 left += searchField.offsetWidth + 6;
159 top += searchField.offsetHeight;
162 searchSelectWindow.style.display=
'block';
163 left -= searchSelectWindow.offsetWidth;
164 searchSelectWindow.style.left = left +
'px';
165 searchSelectWindow.style.top = top +
'px';
169 var left =
getXPos(searchField);
170 var top =
getYPos(searchField);
171 top += searchField.offsetHeight;
174 searchSelectWindow.style.display=
'block';
175 searchSelectWindow.style.left = left +
'px';
176 searchSelectWindow.style.top = top +
'px';
180 if (this.hideTimeout)
182 clearTimeout(this.hideTimeout);
188 this.OnSearchSelectHide =
function()
190 this.hideTimeout = setTimeout(this.name +
".CloseSelectionWindow()",
191 this.closeSelectionTimeout);
195 this.OnSearchFieldChange =
function(evt)
199 clearTimeout(this.keyTimeout);
203 var
e = (evt) ? evt :
window.event;
204 if (e.keyCode==40 || e.keyCode==13)
208 this.OnSearchSelectShow();
209 var win=this.DOMSearchSelectWindow();
210 for (
i=0;
i<win.childNodes.length;
i++)
212 var child = win.childNodes[
i];
213 if (child.className==
'SelectItem')
221 else if (
window.frames.MSearchResults.searchResults)
223 var elem =
window.frames.MSearchResults.searchResults.NavNext(0);
224 if (elem) elem.focus();
227 else if (e.keyCode==27)
229 this.DOMSearchField().blur();
230 this.DOMPopupSearchResultsWindow().style.display =
'none';
231 this.DOMSearchClose().style.display =
'none';
232 this.lastSearchValue =
'';
233 this.Activate(
false);
238 var searchValue = this.DOMSearchField().value.replace(/ +/
g,
"");
240 if (searchValue != this.lastSearchValue)
242 if (searchValue !=
"")
245 this.keyTimeout = setTimeout(this.name +
'.Search()',
246 this.keyTimeoutLength);
250 this.DOMPopupSearchResultsWindow().style.display =
'none';
251 this.DOMSearchClose().style.display =
'none';
252 this.lastSearchValue =
'';
257 this.SelectItemCount =
function(id)
260 var win=this.DOMSearchSelectWindow();
261 for (
i=0;
i<win.childNodes.length;
i++)
263 var child = win.childNodes[
i];
264 if (child.className==
'SelectItem')
272 this.SelectItemSet =
function(id)
275 var win=this.DOMSearchSelectWindow();
276 for (i=0;i<win.childNodes.length;i++)
278 var child = win.childNodes[
i];
279 if (child.className==
'SelectItem')
281 var node = child.firstChild;
284 node.innerHTML=
'•';
288 node.innerHTML=
' ';
297 this.OnSelectItem =
function(id)
299 this.searchIndex = id;
300 this.SelectItemSet(
id);
301 var searchValue = this.DOMSearchField().value.replace(/ +/
g,
"");
302 if (searchValue!=
"" && this.searchActive)
308 this.OnSearchSelectKey =
function(evt)
310 var
e = (evt) ? evt :
window.event;
311 if (e.keyCode==40 &&
this.searchIndex<
this.SelectItemCount())
314 this.OnSelectItem(this.searchIndex);
316 else if (e.keyCode==38 &&
this.searchIndex>0)
319 this.OnSelectItem(this.searchIndex);
321 else if (e.keyCode==13 || e.keyCode==27)
323 this.OnSelectItem(this.searchIndex);
324 this.CloseSelectionWindow();
325 this.DOMSearchField().focus();
333 this.CloseResultsWindow =
function()
335 this.DOMPopupSearchResultsWindow().style.display =
'none';
336 this.DOMSearchClose().style.display =
'none';
337 this.Activate(
false);
340 this.CloseSelectionWindow =
function()
342 this.DOMSearchSelectWindow().style.display =
'none';
346 this.Search =
function()
351 var searchValue = this.DOMSearchField().value.replace(/^ +/,
"");
353 var code = searchValue.toLowerCase().charCodeAt(0);
354 var idxChar = searchValue.substr(0, 1).toLowerCase();
355 if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1)
357 idxChar = searchValue.substr(0, 2);
361 var resultsPageWithSearch;
367 var hexCode=idx.toString(16);
368 resultsPage = this.resultsPath +
'/' +
indexSectionNames[this.searchIndex] +
'_' + hexCode +
'.html';
369 resultsPageWithSearch = resultsPage+
'?'+escape(searchValue);
370 hasResultsPage =
true;
374 resultsPage = this.resultsPath +
'/nomatches.html';
375 resultsPageWithSearch = resultsPage;
376 hasResultsPage =
false;
379 window.frames.MSearchResults.location = resultsPageWithSearch;
380 var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow();
382 if (domPopupSearchResultsWindow.style.display!=
'block')
384 var domSearchBox = this.DOMSearchBox();
385 this.DOMSearchClose().style.display =
'inline';
386 if (this.insideFrame)
388 var domPopupSearchResults = this.DOMPopupSearchResults();
389 domPopupSearchResultsWindow.style.position =
'relative';
390 domPopupSearchResultsWindow.style.display =
'block';
391 var width = document.body.clientWidth - 8;
392 domPopupSearchResultsWindow.style.width = width +
'px';
393 domPopupSearchResults.style.width = width +
'px';
397 var domPopupSearchResults = this.DOMPopupSearchResults();
398 var left =
getXPos(domSearchBox) + 150;
399 var top =
getYPos(domSearchBox) + 20;
400 domPopupSearchResultsWindow.style.display =
'block';
401 left -= domPopupSearchResults.offsetWidth;
402 domPopupSearchResultsWindow.style.top = top +
'px';
403 domPopupSearchResultsWindow.style.left = left +
'px';
407 this.lastSearchValue = searchValue;
408 this.lastResultsPage = resultsPage;
415 this.Activate =
function(isActive)
418 this.DOMPopupSearchResultsWindow().style.display ==
'block'
421 this.DOMSearchBox().className =
'MSearchBoxActive';
423 var searchField = this.DOMSearchField();
425 if (searchField.value ==
this.searchLabel)
427 searchField.value =
'';
428 this.searchActive =
true;
433 this.DOMSearchBox().className =
'MSearchBoxInactive';
434 this.DOMSearchField().value = this.searchLabel;
435 this.searchActive =
false;
436 this.lastSearchValue =
''
437 this.lastResultsPage =
'';
448 this.lastMatchCount = 0;
450 this.repeatOn =
false;
453 this.FindChildElement =
function(id)
455 var parentElement = document.getElementById(
id);
456 var element = parentElement.firstChild;
458 while (element && element!=parentElement)
460 if (element.nodeName ==
'DIV' && element.className ==
'SRChildren')
465 if (element.nodeName ==
'DIV' && element.hasChildNodes())
467 element = element.firstChild;
469 else if (element.nextSibling)
471 element = element.nextSibling;
477 element = element.parentNode;
479 while (element && element!=parentElement && !element.nextSibling);
481 if (element && element!=parentElement)
483 element = element.nextSibling;
489 this.Toggle =
function(id)
491 var element = this.FindChildElement(
id);
494 if (element.style.display ==
'block')
496 element.style.display =
'none';
500 element.style.display =
'block';
510 this.Search =
function(search)
514 search =
window.location.search;
515 search = search.substring(1);
516 search = unescape(search);
519 search = search.replace(/^ +/,
"");
520 search = search.replace(/ +$/,
"");
521 search = search.toLowerCase();
524 var resultRows = document.getElementsByTagName(
"div");
528 while (i < resultRows.length)
530 var row = resultRows.item(i);
531 if (row.className ==
"SRResult")
533 var rowMatchName = row.id.toLowerCase();
534 rowMatchName = rowMatchName.replace(/^sr\
d*_/,
'');
536 if (search.length<=rowMatchName.length &&
537 rowMatchName.substr(0, search.length)==search)
539 row.style.display =
'block';
544 row.style.display =
'none';
549 document.getElementById(
"Searching").style.display=
'none';
552 document.getElementById(
"NoMatches").style.display=
'block';
556 document.getElementById(
"NoMatches").style.display=
'none';
558 this.lastMatchCount = matches;
563 this.NavNext =
function(index)
568 var focusName =
'Item'+index;
569 focusItem = document.getElementById(focusName);
570 if (focusItem && focusItem.parentNode.parentNode.style.display==
'block')
584 this.NavPrev =
function(index)
589 var focusName =
'Item'+index;
590 focusItem = document.getElementById(focusName);
591 if (focusItem && focusItem.parentNode.parentNode.style.display==
'block')
605 this.ProcessKeys =
function(
e)
607 if (
e.type ==
"keydown")
609 this.repeatOn =
false;
610 this.lastKey =
e.keyCode;
612 else if (
e.type ==
"keypress")
616 if (this.lastKey) this.repeatOn =
true;
620 else if (
e.type ==
"keyup")
623 this.repeatOn =
false;
625 return this.lastKey!=0;
628 this.Nav =
function(evt,itemIndex)
630 var
e = (evt) ? evt :
window.event;
631 if (e.keyCode==13)
return true;
632 if (!this.ProcessKeys(e))
return false;
634 if (this.lastKey==38)
636 var newIndex = itemIndex-1;
637 var focusItem = this.NavPrev(newIndex);
640 var child = this.FindChildElement(focusItem.parentNode.parentNode.id);
641 if (child && child.style.display ==
'block')
647 tmpElem = document.getElementById(
'Item'+newIndex+
'_c'+n);
666 parent.document.getElementById(
"MSearchField").focus();
669 else if (this.lastKey==40)
671 var newIndex = itemIndex+1;
673 var item = document.getElementById(
'Item'+itemIndex);
674 var elem = this.FindChildElement(item.parentNode.parentNode.id);
675 if (elem && elem.style.display ==
'block')
677 focusItem = document.getElementById(
'Item'+itemIndex+
'_c0');
679 if (!focusItem) focusItem = this.NavNext(newIndex);
680 if (focusItem) focusItem.focus();
682 else if (this.lastKey==39)
684 var item = document.getElementById(
'Item'+itemIndex);
685 var elem = this.FindChildElement(item.parentNode.parentNode.id);
686 if (elem) elem.style.display =
'block';
688 else if (this.lastKey==37)
690 var item = document.getElementById(
'Item'+itemIndex);
691 var elem = this.FindChildElement(item.parentNode.parentNode.id);
692 if (elem) elem.style.display =
'none';
694 else if (this.lastKey==27)
696 parent.searchBox.CloseResultsWindow();
697 parent.document.getElementById(
"MSearchField").focus();
699 else if (this.lastKey==13)
706 this.NavChild =
function(evt,itemIndex,childIndex)
708 var
e = (evt) ? evt :
window.event;
709 if (e.keyCode==13)
return true;
710 if (!this.ProcessKeys(e))
return false;
712 if (this.lastKey==38)
716 var newIndex = childIndex-1;
717 document.getElementById(
'Item'+itemIndex+
'_c'+newIndex).focus();
721 document.getElementById(
'Item'+itemIndex).focus();
724 else if (this.lastKey==40)
726 var newIndex = childIndex+1;
727 var elem = document.getElementById(
'Item'+itemIndex+
'_c'+newIndex);
730 elem = this.NavNext(itemIndex+1);
737 else if (this.lastKey==27)
739 parent.searchBox.CloseResultsWindow();
740 parent.document.getElementById(
"MSearchField").focus();
742 else if (this.lastKey==13)
752 elem.setAttribute(
'onkeydown',action);
753 elem.setAttribute(
'onkeypress',action);
754 elem.setAttribute(
'onkeyup',action);
759 elem.setAttribute(
'class',attr);
760 elem.setAttribute(
'className',attr);
765 var results = document.getElementById(
"SRResults");
769 var srResult = document.createElement(
'div');
770 srResult.setAttribute(
'id',
'SR_'+
id);
772 var srEntry = document.createElement(
'div');
774 var srLink = document.createElement(
'a');
775 srLink.setAttribute(
'id',
'Item'+
e);
779 srEntry.appendChild(srLink);
782 srLink.setAttribute(
'href',
searchData[
e][1][1][0]);
785 srLink.setAttribute(
'target',
'_parent');
787 var srScope = document.createElement(
'span');
790 srEntry.appendChild(srScope);
794 srLink.setAttribute(
'href',
'javascript:searchResults.Toggle("SR_'+
id+
'")');
795 var srChildren = document.createElement(
'div');
799 var srChild = document.createElement(
'a');
800 srChild.setAttribute(
'id',
'Item'+
e+
'_c'+
c);
801 setKeyActions(srChild,
'return searchResults.NavChild(event,'+
e+
','+
c+
')');
806 srChild.setAttribute(
'target',
'_parent');
809 srChildren.appendChild(srChild);
811 srEntry.appendChild(srChildren);
813 srResult.appendChild(srEntry);
814 results.appendChild(srResult);
var indexSectionsWithContent
function setKeyActions(elem, action)
function SearchResults(name)
moTypes MOint moText moParamIndex moParamReference int iRow int int i int i
function SearchBox(name, resultsPath, inFrame, label)
function setClassAttr(elem, attr)
function convertToId(search)