8 var indexSectionsWithContent =
10 0:
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010111111101111111111111111110001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
11 1:
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111110101001100100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
12 2:
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101000100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
13 3:
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110110100001101101100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
14 4:
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111101111111111111111110001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
15 5:
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111101111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
16 6:
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
17 7:
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000111001001101100010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
18 8:
"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
21 var indexSectionNames =
34 function convertToId(search)
37 for (i=0;i<search.length;i++)
39 var c = search.charAt(i);
40 var cn = c.charCodeAt(0);
41 if (c.match(/[a-z0-9]/))
47 result+=
"_0"+cn.toString(16);
51 result+=
"_"+cn.toString(16);
57 function getXPos(item)
62 while (item && item!=document.body)
65 item = item.offsetParent;
71 function getYPos(item)
76 while (item && item!=document.body)
79 item = item.offsetParent;
92 function SearchBox(name, resultsPath, inFrame, label)
94 if (!name || !resultsPath) { alert(
"Missing parameters to SearchBox."); }
98 this.resultsPath = resultsPath;
100 this.keyTimeoutLength = 500;
101 this.closeSelectionTimeout = 300;
102 this.lastSearchValue =
"";
103 this.lastResultsPage =
"";
104 this.hideTimeout = 0;
105 this.searchIndex = 0;
106 this.searchActive =
false;
107 this.insideFrame = inFrame;
108 this.searchLabel = label;
112 this.DOMSearchField =
function()
113 {
return document.getElementById(
"MSearchField"); }
115 this.DOMSearchSelect =
function()
116 {
return document.getElementById(
"MSearchSelect"); }
118 this.DOMSearchSelectWindow =
function()
119 {
return document.getElementById(
"MSearchSelectWindow"); }
121 this.DOMPopupSearchResults =
function()
122 {
return document.getElementById(
"MSearchResults"); }
124 this.DOMPopupSearchResultsWindow =
function()
125 {
return document.getElementById(
"MSearchResultsWindow"); }
127 this.DOMSearchClose =
function()
128 {
return document.getElementById(
"MSearchClose"); }
130 this.DOMSearchBox =
function()
131 {
return document.getElementById(
"MSearchBox"); }
136 this.OnSearchFieldFocus =
function(isActive)
138 this.Activate(isActive);
141 this.OnSearchSelectShow =
function()
143 var searchSelectWindow = this.DOMSearchSelectWindow();
144 var searchField = this.DOMSearchSelect();
146 if (this.insideFrame)
148 var left = getXPos(searchField);
149 var top = getYPos(searchField);
150 left += searchField.offsetWidth + 6;
151 top += searchField.offsetHeight;
154 searchSelectWindow.style.display=
'block';
155 left -= searchSelectWindow.offsetWidth;
156 searchSelectWindow.style.left = left +
'px';
157 searchSelectWindow.style.top = top +
'px';
161 var left = getXPos(searchField);
162 var top = getYPos(searchField);
163 top += searchField.offsetHeight;
166 searchSelectWindow.style.display=
'block';
167 searchSelectWindow.style.left = left +
'px';
168 searchSelectWindow.style.top = top +
'px';
172 if (this.hideTimeout)
174 clearTimeout(this.hideTimeout);
180 this.OnSearchSelectHide =
function()
182 this.hideTimeout = setTimeout(this.name +
".CloseSelectionWindow()",
183 this.closeSelectionTimeout);
187 this.OnSearchFieldChange =
function(evt)
191 clearTimeout(this.keyTimeout);
195 var e = (evt) ? evt : window.event;
196 if (e.keyCode==40 || e.keyCode==13)
200 this.OnSearchSelectShow();
201 var win=this.DOMSearchSelectWindow();
202 for (i=0;i<win.childNodes.length;i++)
204 var child = win.childNodes[i];
205 if (child.className==
'SelectItem')
213 else if (window.frames.MSearchResults.searchResults)
215 var elem = window.frames.MSearchResults.searchResults.NavNext(0);
216 if (elem) elem.focus();
219 else if (e.keyCode==27)
221 this.DOMSearchField().blur();
222 this.DOMPopupSearchResultsWindow().style.display =
'none';
223 this.DOMSearchClose().style.display =
'none';
224 this.lastSearchValue =
'';
225 this.Activate(
false);
230 var searchValue = this.DOMSearchField().value.replace(/ +/g,
"");
232 if (searchValue != this.lastSearchValue)
234 if (searchValue !=
"")
237 this.keyTimeout = setTimeout(this.name +
'.Search()',
238 this.keyTimeoutLength);
242 this.DOMPopupSearchResultsWindow().style.display =
'none';
243 this.DOMSearchClose().style.display =
'none';
244 this.lastSearchValue =
'';
249 this.SelectItemCount =
function(id)
252 var win=this.DOMSearchSelectWindow();
253 for (i=0;i<win.childNodes.length;i++)
255 var child = win.childNodes[i];
256 if (child.className==
'SelectItem')
264 this.SelectItemSet =
function(id)
267 var win=this.DOMSearchSelectWindow();
268 for (i=0;i<win.childNodes.length;i++)
270 var child = win.childNodes[i];
271 if (child.className==
'SelectItem')
273 var node = child.firstChild;
276 node.innerHTML=
'•';
280 node.innerHTML=
' ';
289 this.OnSelectItem =
function(id)
291 this.searchIndex = id;
292 this.SelectItemSet(
id);
293 var searchValue = this.DOMSearchField().value.replace(/ +/g,
"");
294 if (searchValue!=
"" && this.searchActive)
300 this.OnSearchSelectKey =
function(evt)
302 var e = (evt) ? evt : window.event;
303 if (e.keyCode==40 &&
this.searchIndex<
this.SelectItemCount())
306 this.OnSelectItem(this.searchIndex);
308 else if (e.keyCode==38 &&
this.searchIndex>0)
311 this.OnSelectItem(this.searchIndex);
313 else if (e.keyCode==13 || e.keyCode==27)
315 this.OnSelectItem(this.searchIndex);
316 this.CloseSelectionWindow();
317 this.DOMSearchField().focus();
325 this.CloseResultsWindow =
function()
327 this.DOMPopupSearchResultsWindow().style.display =
'none';
328 this.DOMSearchClose().style.display =
'none';
329 this.Activate(
false);
332 this.CloseSelectionWindow =
function()
334 this.DOMSearchSelectWindow().style.display =
'none';
338 this.Search =
function()
343 var searchValue = this.DOMSearchField().value.replace(/^ +/,
"");
345 var code = searchValue.toLowerCase().charCodeAt(0);
349 hexCode=
"0"+code.toString(16);
353 hexCode=code.toString(16);
357 var resultsPageWithSearch;
360 if (indexSectionsWithContent[this.searchIndex].charAt(code) ==
'1')
362 resultsPage = this.resultsPath +
'/' + indexSectionNames[this.searchIndex] +
'_' + hexCode +
'.html';
363 resultsPageWithSearch = resultsPage+
'?'+escape(searchValue);
364 hasResultsPage =
true;
368 resultsPage = this.resultsPath +
'/nomatches.html';
369 resultsPageWithSearch = resultsPage;
370 hasResultsPage =
false;
373 window.frames.MSearchResults.location = resultsPageWithSearch;
374 var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow();
376 if (domPopupSearchResultsWindow.style.display!=
'block')
378 var domSearchBox = this.DOMSearchBox();
379 this.DOMSearchClose().style.display =
'inline';
380 if (this.insideFrame)
382 var domPopupSearchResults = this.DOMPopupSearchResults();
383 domPopupSearchResultsWindow.style.position =
'relative';
384 domPopupSearchResultsWindow.style.display =
'block';
385 var width = document.body.clientWidth - 8;
386 domPopupSearchResultsWindow.style.width = width +
'px';
387 domPopupSearchResults.style.width = width +
'px';
391 var domPopupSearchResults = this.DOMPopupSearchResults();
392 var left = getXPos(domSearchBox) + 150;
393 var top = getYPos(domSearchBox) + 20;
394 domPopupSearchResultsWindow.style.display =
'block';
395 left -= domPopupSearchResults.offsetWidth;
396 domPopupSearchResultsWindow.style.top = top +
'px';
397 domPopupSearchResultsWindow.style.left = left +
'px';
401 this.lastSearchValue = searchValue;
402 this.lastResultsPage = resultsPage;
409 this.Activate =
function(isActive)
412 this.DOMPopupSearchResultsWindow().style.display ==
'block'
415 this.DOMSearchBox().className =
'MSearchBoxActive';
417 var searchField = this.DOMSearchField();
419 if (searchField.value ==
this.searchLabel)
421 searchField.value =
'';
422 this.searchActive =
true;
427 this.DOMSearchBox().className =
'MSearchBoxInactive';
428 this.DOMSearchField().value = this.searchLabel;
429 this.searchActive =
false;
430 this.lastSearchValue =
''
431 this.lastResultsPage =
'';
439 function SearchResults(name)
442 this.lastMatchCount = 0;
444 this.repeatOn =
false;
447 this.FindChildElement =
function(id)
449 var parentElement = document.getElementById(
id);
450 var element = parentElement.firstChild;
452 while (element && element!=parentElement)
454 if (element.nodeName ==
'DIV' && element.className ==
'SRChildren')
459 if (element.nodeName ==
'DIV' && element.hasChildNodes())
461 element = element.firstChild;
463 else if (element.nextSibling)
465 element = element.nextSibling;
471 element = element.parentNode;
473 while (element && element!=parentElement && !element.nextSibling);
475 if (element && element!=parentElement)
477 element = element.nextSibling;
483 this.Toggle =
function(id)
485 var element = this.FindChildElement(
id);
488 if (element.style.display ==
'block')
490 element.style.display =
'none';
494 element.style.display =
'block';
504 this.Search =
function(search)
508 search = window.location.search;
509 search = search.substring(1);
510 search = unescape(search);
513 search = search.replace(/^ +/,
"");
514 search = search.replace(/ +$/,
"");
515 search = search.toLowerCase();
516 search = convertToId(search);
518 var resultRows = document.getElementsByTagName(
"div");
522 while (i < resultRows.length)
524 var row = resultRows.item(i);
525 if (row.className ==
"SRResult")
527 var rowMatchName = row.id.toLowerCase();
528 rowMatchName = rowMatchName.replace(/^sr\d*_/,
'');
530 if (search.length<=rowMatchName.length &&
531 rowMatchName.substr(0, search.length)==search)
533 row.style.display =
'block';
538 row.style.display =
'none';
543 document.getElementById(
"Searching").style.display=
'none';
546 document.getElementById(
"NoMatches").style.display=
'block';
550 document.getElementById(
"NoMatches").style.display=
'none';
552 this.lastMatchCount = matches;
557 this.NavNext =
function(index)
562 var focusName =
'Item'+index;
563 focusItem = document.getElementById(focusName);
564 if (focusItem && focusItem.parentNode.parentNode.style.display==
'block')
578 this.NavPrev =
function(index)
583 var focusName =
'Item'+index;
584 focusItem = document.getElementById(focusName);
585 if (focusItem && focusItem.parentNode.parentNode.style.display==
'block')
599 this.ProcessKeys =
function(e)
601 if (e.type ==
"keydown")
603 this.repeatOn =
false;
604 this.lastKey = e.keyCode;
606 else if (e.type ==
"keypress")
610 if (this.lastKey) this.repeatOn =
true;
614 else if (e.type ==
"keyup")
617 this.repeatOn =
false;
619 return this.lastKey!=0;
622 this.Nav =
function(evt,itemIndex)
624 var e = (evt) ? evt : window.event;
625 if (e.keyCode==13)
return true;
626 if (!this.ProcessKeys(e))
return false;
628 if (this.lastKey==38)
630 var newIndex = itemIndex-1;
631 var focusItem = this.NavPrev(newIndex);
634 var child = this.FindChildElement(focusItem.parentNode.parentNode.id);
635 if (child && child.style.display ==
'block')
641 tmpElem = document.getElementById(
'Item'+newIndex+
'_c'+n);
660 parent.document.getElementById(
"MSearchField").focus();
663 else if (this.lastKey==40)
665 var newIndex = itemIndex+1;
667 var item = document.getElementById(
'Item'+itemIndex);
668 var elem = this.FindChildElement(item.parentNode.parentNode.id);
669 if (elem && elem.style.display ==
'block')
671 focusItem = document.getElementById(
'Item'+itemIndex+
'_c0');
673 if (!focusItem) focusItem = this.NavNext(newIndex);
674 if (focusItem) focusItem.focus();
676 else if (this.lastKey==39)
678 var item = document.getElementById(
'Item'+itemIndex);
679 var elem = this.FindChildElement(item.parentNode.parentNode.id);
680 if (elem) elem.style.display =
'block';
682 else if (this.lastKey==37)
684 var item = document.getElementById(
'Item'+itemIndex);
685 var elem = this.FindChildElement(item.parentNode.parentNode.id);
686 if (elem) elem.style.display =
'none';
688 else if (this.lastKey==27)
690 parent.searchBox.CloseResultsWindow();
691 parent.document.getElementById(
"MSearchField").focus();
693 else if (this.lastKey==13)
700 this.NavChild =
function(evt,itemIndex,childIndex)
702 var e = (evt) ? evt : window.event;
703 if (e.keyCode==13)
return true;
704 if (!this.ProcessKeys(e))
return false;
706 if (this.lastKey==38)
710 var newIndex = childIndex-1;
711 document.getElementById(
'Item'+itemIndex+
'_c'+newIndex).focus();
715 document.getElementById(
'Item'+itemIndex).focus();
718 else if (this.lastKey==40)
720 var newIndex = childIndex+1;
721 var elem = document.getElementById(
'Item'+itemIndex+
'_c'+newIndex);
724 elem = this.NavNext(itemIndex+1);
731 else if (this.lastKey==27)
733 parent.searchBox.CloseResultsWindow();
734 parent.document.getElementById(
"MSearchField").focus();
736 else if (this.lastKey==13)
744 function setKeyActions(elem,action)
746 elem.setAttribute(
'onkeydown',action);
747 elem.setAttribute(
'onkeypress',action);
748 elem.setAttribute(
'onkeyup',action);
751 function setClassAttr(elem,attr)
753 elem.setAttribute(
'class',attr);
754 elem.setAttribute(
'className',attr);
757 function createResults()
759 var results = document.getElementById(
"SRResults");
760 for (var e=0; e<searchData.length; e++)
762 var
id = searchData[e][0];
763 var srResult = document.createElement(
'div');
764 srResult.setAttribute(
'id',
'SR_'+
id);
765 setClassAttr(srResult,
'SRResult');
766 var srEntry = document.createElement(
'div');
767 setClassAttr(srEntry,
'SREntry');
768 var srLink = document.createElement(
'a');
769 srLink.setAttribute(
'id',
'Item'+e);
770 setKeyActions(srLink,
'return searchResults.Nav(event,'+e+
')');
771 setClassAttr(srLink,
'SRSymbol');
772 srLink.innerHTML = searchData[e][1][0];
773 srEntry.appendChild(srLink);
774 if (searchData[e][1].length==2)
776 srLink.setAttribute(
'href',searchData[e][1][1][0]);
777 if (searchData[e][1][1][1])
779 srLink.setAttribute(
'target',
'_parent');
781 var srScope = document.createElement(
'span');
782 setClassAttr(srScope,
'SRScope');
783 srScope.innerHTML = searchData[e][1][1][2];
784 srEntry.appendChild(srScope);
788 srLink.setAttribute(
'href',
'javascript:searchResults.Toggle("SR_'+
id+
'")');
789 var srChildren = document.createElement(
'div');
790 setClassAttr(srChildren,
'SRChildren');
791 for (var c=0; c<searchData[e][1].length-1; c++)
793 var srChild = document.createElement(
'a');
794 srChild.setAttribute(
'id',
'Item'+e+
'_c'+c);
795 setKeyActions(srChild,
'return searchResults.NavChild(event,'+e+
','+c+
')');
796 setClassAttr(srChild,
'SRScope');
797 srChild.setAttribute(
'href',searchData[e][1][c+1][0]);
798 if (searchData[e][1][c+1][1])
800 srChild.setAttribute(
'target',
'_parent');
802 srChild.innerHTML = searchData[e][1][c+1][2];
803 srChildren.appendChild(srChild);
805 srEntry.appendChild(srChildren);
807 srResult.appendChild(srEntry);
808 results.appendChild(srResult);