OSDN Git Service

Version 5.91
[vbslib/main.git] / _src / Test / tools / T_GPL_Tools / _HTML / search / search.css
1 /*---------------- Search Box */
2
3 #FSearchBox {
4     float: left;
5 }
6
7 #MSearchBox {
8     white-space : nowrap;
9     position: absolute;
10     float: none;
11     display: inline;
12     margin-top: 8px;
13     right: 0px;
14     width: 170px;
15     z-index: 102;
16     background-color: white;
17 }
18
19 #MSearchBox .left
20 {
21     display:block;
22     position:absolute;
23     left:10px;
24     width:20px;
25     height:19px;
26     background:url('search_l.png') no-repeat;
27     background-position:right;
28 }
29
30 #MSearchSelect {
31     display:block;
32     position:absolute;
33     width:20px;
34     height:19px;
35 }
36
37 .left #MSearchSelect {
38     left:4px;
39 }
40
41 .right #MSearchSelect {
42     right:5px;
43 }
44
45 #MSearchField {
46     display:block;
47     position:absolute;
48     height:19px;
49     background:url('search_m.png') repeat-x;
50     border:none;
51     width:111px;
52     margin-left:20px;
53     padding-left:4px;
54     color: #909090;
55     outline: none;
56     font: 9pt Arial, Verdana, sans-serif;
57 }
58
59 #FSearchBox #MSearchField {
60     margin-left:15px;
61 }
62
63 #MSearchBox .right {
64     display:block;
65     position:absolute;
66     right:10px;
67     top:0px;
68     width:20px;
69     height:19px;
70     background:url('search_r.png') no-repeat;
71     background-position:left;
72 }
73
74 #MSearchClose {
75     display: none;
76     position: absolute;
77     top: 4px;
78     background : none;
79     border: none;
80     margin: 0px 4px 0px 0px;
81     padding: 0px 0px;
82     outline: none;
83 }
84
85 .left #MSearchClose {
86     left: 6px;
87 }
88
89 .right #MSearchClose {
90     right: 2px;
91 }
92
93 .MSearchBoxActive #MSearchField {
94     color: #000000;
95 }
96
97 /*---------------- Search filter selection */
98
99 #MSearchSelectWindow {
100     display: none;
101     position: absolute;
102     left: 0; top: 0;
103     border: 1px solid #90A5CE;
104     background-color: #F9FAFC;
105     z-index: 1;
106     padding-top: 4px;
107     padding-bottom: 4px;
108     -moz-border-radius: 4px;
109     -webkit-border-top-left-radius: 4px;
110     -webkit-border-top-right-radius: 4px;
111     -webkit-border-bottom-left-radius: 4px;
112     -webkit-border-bottom-right-radius: 4px;
113     -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
114 }
115
116 .SelectItem {
117     font: 8pt Arial, Verdana, sans-serif;
118     padding-left:  2px;
119     padding-right: 12px;
120     border: 0px;
121 }
122
123 span.SelectionMark {
124     margin-right: 4px;
125     font-family: monospace;
126     outline-style: none;
127     text-decoration: none;
128 }
129
130 a.SelectItem {
131     display: block;
132     outline-style: none;
133     color: #000000; 
134     text-decoration: none;
135     padding-left:   6px;
136     padding-right: 12px;
137 }
138
139 a.SelectItem:focus,
140 a.SelectItem:active {
141     color: #000000; 
142     outline-style: none;
143     text-decoration: none;
144 }
145
146 a.SelectItem:hover {
147     color: #FFFFFF;
148     background-color: #3D578C;
149     outline-style: none;
150     text-decoration: none;
151     cursor: pointer;
152     display: block;
153 }
154
155 /*---------------- Search results window */
156
157 iframe#MSearchResults {
158     width: 60ex;
159     height: 15em;
160 }
161
162 #MSearchResultsWindow {
163     display: none;
164     position: absolute;
165     left: 0; top: 0;
166     border: 1px solid #000;
167     background-color: #EEF1F7;
168 }
169
170 /* ----------------------------------- */
171
172
173 #SRIndex {
174     clear:both; 
175     padding-bottom: 15px;
176 }
177
178 .SREntry {
179     font-size: 10pt;
180     padding-left: 1ex;
181 }
182
183 .SRPage .SREntry {
184     font-size: 8pt;
185     padding: 1px 5px;
186 }
187
188 body.SRPage {
189     margin: 5px 2px;
190 }
191
192 .SRChildren {
193     padding-left: 3ex; padding-bottom: .5em 
194 }
195
196 .SRPage .SRChildren {
197     display: none;
198 }
199
200 .SRSymbol {
201     font-weight: bold; 
202     color: #425E97;
203     font-family: Arial, Verdana, sans-serif;
204     text-decoration: none;
205     outline: none;
206 }
207
208 a.SRScope {
209     display: block;
210     color: #425E97; 
211     font-family: Arial, Verdana, sans-serif;
212     text-decoration: none;
213     outline: none;
214 }
215
216 a.SRSymbol:focus, a.SRSymbol:active,
217 a.SRScope:focus, a.SRScope:active {
218     text-decoration: underline;
219 }
220
221 span.SRScope {
222     padding-left: 4px;
223 }
224
225 .SRPage .SRStatus {
226     padding: 2px 5px;
227     font-size: 8pt;
228     font-style: italic;
229 }
230
231 .SRResult {
232     display: none;
233 }
234
235 DIV.searchresults {
236     margin-left: 10px;
237     margin-right: 10px;
238 }
239
240 /*---------------- External search page results */
241
242 .searchresult {
243     background-color: #F0F3F8;
244 }
245
246 .pages b {
247    color: white;
248    padding: 5px 5px 3px 5px;
249    background-image: url("../tab_a.png");
250    background-repeat: repeat-x;
251    text-shadow: 0 1px 1px #000000;
252 }
253
254 .pages {
255     line-height: 17px;
256     margin-left: 4px;
257     text-decoration: none;
258 }
259
260 .hl {
261     font-weight: bold;
262 }
263
264 #searchresults {
265     margin-bottom: 20px;
266 }
267
268 .searchpages {
269     margin-top: 10px;
270 }
271
272 function convertToId(search)
273 {
274   var result = '';
275   for (i=0;i<search.length;i++)
276   {
277     var c = search.charAt(i);
278     var cn = c.charCodeAt(0);
279     if (c.match(/[a-z0-9\u0080-\uFFFF]/))
280     {
281       result+=c;
282     }
283     else if (cn<16)
284     {
285       result+="_0"+cn.toString(16);
286     }
287     else
288     {
289       result+="_"+cn.toString(16);
290     }
291   }
292   return result;
293 }
294
295 function getXPos(item)
296 {
297   var x = 0;
298   if (item.offsetWidth)
299   {
300     while (item && item!=document.body)
301     {
302       x   += item.offsetLeft;
303       item = item.offsetParent;
304     }
305   }
306   return x;
307 }
308
309 function getYPos(item)
310 {
311   var y = 0;
312   if (item.offsetWidth)
313   {
314      while (item && item!=document.body)
315      {
316        y   += item.offsetTop;
317        item = item.offsetParent;
318      }
319   }
320   return y;
321 }
322
323 /* A class handling everything associated with the search panel.
324
325    Parameters:
326    name - The name of the global variable that will be
327           storing this instance.  Is needed to be able to set timeouts.
328    resultPath - path to use for external files
329 */
330 function SearchBox(name, resultsPath, inFrame, label)
331 {
332   if (!name || !resultsPath) {  alert("Missing parameters to SearchBox."); }
333
334   // ---------- Instance variables
335   this.name                  = name;
336   this.resultsPath           = resultsPath;
337   this.keyTimeout            = 0;
338   this.keyTimeoutLength      = 500;
339   this.closeSelectionTimeout = 300;
340   this.lastSearchValue       = "";
341   this.lastResultsPage       = "";
342   this.hideTimeout           = 0;
343   this.searchIndex           = 0;
344   this.searchActive          = false;
345   this.insideFrame           = inFrame;
346   this.searchLabel           = label;
347
348   // ----------- DOM Elements
349
350   this.DOMSearchField = function()
351   {  return document.getElementById("MSearchField");  }
352
353   this.DOMSearchSelect = function()
354   {  return document.getElementById("MSearchSelect");  }
355
356   this.DOMSearchSelectWindow = function()
357   {  return document.getElementById("MSearchSelectWindow");  }
358
359   this.DOMPopupSearchResults = function()
360   {  return document.getElementById("MSearchResults");  }
361
362   this.DOMPopupSearchResultsWindow = function()
363   {  return document.getElementById("MSearchResultsWindow");  }
364
365   this.DOMSearchClose = function()
366   {  return document.getElementById("MSearchClose"); }
367
368   this.DOMSearchBox = function()
369   {  return document.getElementById("MSearchBox");  }
370
371   // ------------ Event Handlers
372
373   // Called when focus is added or removed from the search field.
374   this.OnSearchFieldFocus = function(isActive)
375   {
376     this.Activate(isActive);
377   }
378
379   this.OnSearchSelectShow = function()
380   {
381     var searchSelectWindow = this.DOMSearchSelectWindow();
382     var searchField        = this.DOMSearchSelect();
383
384     if (this.insideFrame)
385     {
386       var left = getXPos(searchField);
387       var top  = getYPos(searchField);
388       left += searchField.offsetWidth + 6;
389       top += searchField.offsetHeight;
390
391       // show search selection popup
392       searchSelectWindow.style.display='block';
393       left -= searchSelectWindow.offsetWidth;
394       searchSelectWindow.style.left =  left + 'px';
395       searchSelectWindow.style.top  =  top  + 'px';
396     }
397     else
398     {
399       var left = getXPos(searchField);
400       var top  = getYPos(searchField);
401       top += searchField.offsetHeight;
402
403       // show search selection popup
404       searchSelectWindow.style.display='block';
405       searchSelectWindow.style.left =  left + 'px';
406       searchSelectWindow.style.top  =  top  + 'px';
407     }
408
409     // stop selection hide timer
410     if (this.hideTimeout)
411     {
412       clearTimeout(this.hideTimeout);
413       this.hideTimeout=0;
414     }
415     return false; // to avoid "image drag" default event
416   }
417
418   this.OnSearchSelectHide = function()
419   {
420     this.hideTimeout = setTimeout(this.name +".CloseSelectionWindow()",
421                                   this.closeSelectionTimeout);
422   }
423
424   // Called when the content of the search field is changed.
425   this.OnSearchFieldChange = function(evt)
426   {
427     if (this.keyTimeout) // kill running timer
428     {
429       clearTimeout(this.keyTimeout);
430       this.keyTimeout = 0;
431     }
432
433     var e  = (evt) ? evt : window.event; // for IE
434     if (e.keyCode==40 || e.keyCode==13)
435     {
436       if (e.shiftKey==1)
437       {
438         this.OnSearchSelectShow();
439         var win=this.DOMSearchSelectWindow();
440         for (i=0;i<win.childNodes.length;i++)
441         {
442           var child = win.childNodes[i]; // get span within a
443           if (child.className=='SelectItem')
444           {
445             child.focus();
446             return;
447           }
448         }
449         return;
450       }
451       else if (window.frames.MSearchResults.searchResults)
452       {
453         var elem = window.frames.MSearchResults.searchResults.NavNext(0);
454         if (elem) elem.focus();
455       }
456     }
457     else if (e.keyCode==27) // Escape out of the search field
458     {
459       this.DOMSearchField().blur();
460       this.DOMPopupSearchResultsWindow().style.display = 'none';
461       this.DOMSearchClose().style.display = 'none';
462       this.lastSearchValue = '';
463       this.Activate(false);
464       return;
465     }
466
467     // strip whitespaces
468     var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
469
470     if (searchValue != this.lastSearchValue) // search value has changed
471     {
472       if (searchValue != "") // non-empty search
473       {
474         // set timer for search update
475         this.keyTimeout = setTimeout(this.name + '.Search()',
476                                      this.keyTimeoutLength);
477       }
478       else // empty search field
479       {
480         this.DOMPopupSearchResultsWindow().style.display = 'none';
481         this.DOMSearchClose().style.display = 'none';
482         this.lastSearchValue = '';
483       }
484     }
485   }
486
487   this.SelectItemCount = function(id)
488   {
489     var count=0;
490     var win=this.DOMSearchSelectWindow();
491     for (i=0;i<win.childNodes.length;i++)
492     {
493       var child = win.childNodes[i]; // get span within a
494       if (child.className=='SelectItem')
495       {
496         count++;
497       }
498     }
499     return count;
500   }
501
502   this.SelectItemSet = function(id)
503   {
504     var i,j=0;
505     var win=this.DOMSearchSelectWindow();
506     for (i=0;i<win.childNodes.length;i++)
507     {
508       var child = win.childNodes[i]; // get span within a
509       if (child.className=='SelectItem')
510       {
511         var node = child.firstChild;
512         if (j==id)
513         {
514           node.innerHTML='&#8226;';
515         }
516         else
517         {
518           node.innerHTML='&#160;';
519         }
520         j++;
521       }
522     }
523   }
524
525   // Called when an search filter selection is made.
526   // set item with index id as the active item
527   this.OnSelectItem = function(id)
528   {
529     this.searchIndex = id;
530     this.SelectItemSet(id);
531     var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
532     if (searchValue!="" && this.searchActive) // something was found -> do a search
533     {
534       this.Search();
535     }
536   }
537
538   this.OnSearchSelectKey = function(evt)
539   {
540     var e = (evt) ? evt : window.event; // for IE
541     if (e.keyCode==40 && this.searchIndex<this.SelectItemCount()) // Down
542     {
543       this.searchIndex++;
544       this.OnSelectItem(this.searchIndex);
545     }
546     else if (e.keyCode==38 && this.searchIndex>0) // Up
547     {
548       this.searchIndex--;
549       this.OnSelectItem(this.searchIndex);
550     }
551     else if (e.keyCode==13 || e.keyCode==27)
552     {
553       this.OnSelectItem(this.searchIndex);
554       this.CloseSelectionWindow();
555       this.DOMSearchField().focus();
556     }
557     return false;
558   }
559
560   // --------- Actions
561
562   // Closes the results window.
563   this.CloseResultsWindow = function()
564   {
565     this.DOMPopupSearchResultsWindow().style.display = 'none';
566     this.DOMSearchClose().style.display = 'none';
567     this.Activate(false);
568   }
569
570   this.CloseSelectionWindow = function()
571   {
572     this.DOMSearchSelectWindow().style.display = 'none';
573   }
574
575   // Performs a search.
576   this.Search = function()
577   {
578     this.keyTimeout = 0;
579
580     // strip leading whitespace
581     var searchValue = this.DOMSearchField().value.replace(/^ +/, "");
582
583     var code = searchValue.toLowerCase().charCodeAt(0);
584     var idxChar = searchValue.substr(0, 1).toLowerCase();
585     if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) // surrogate pair
586     {
587       idxChar = searchValue.substr(0, 2);
588     }
589
590     var resultsPage;
591     var resultsPageWithSearch;
592     var hasResultsPage;
593
594     var idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar);
595     if (idx!=-1)
596     {
597        var hexCode=idx.toString(16);
598        resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html';
599        resultsPageWithSearch = resultsPage+'?'+escape(searchValue);
600        hasResultsPage = true;
601     }
602     else // nothing available for this search term
603     {
604        resultsPage = this.resultsPath + '/nomatches.html';
605        resultsPageWithSearch = resultsPage;
606        hasResultsPage = false;
607     }
608
609     window.frames.MSearchResults.location = resultsPageWithSearch;
610     var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow();
611
612     if (domPopupSearchResultsWindow.style.display!='block')
613     {
614        var domSearchBox = this.DOMSearchBox();
615        this.DOMSearchClose().style.display = 'inline';
616        if (this.insideFrame)
617        {
618          var domPopupSearchResults = this.DOMPopupSearchResults();
619          domPopupSearchResultsWindow.style.position = 'relative';
620          domPopupSearchResultsWindow.style.display  = 'block';
621          var width = document.body.clientWidth - 8; // the -8 is for IE :-(
622          domPopupSearchResultsWindow.style.width    = width + 'px';
623          domPopupSearchResults.style.width          = width + 'px';
624        }
625        else
626        {
627          var domPopupSearchResults = this.DOMPopupSearchResults();
628          var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth;
629          var top  = getYPos(domSearchBox) + 20;  // domSearchBox.offsetHeight + 1;
630          domPopupSearchResultsWindow.style.display = 'block';
631          left -= domPopupSearchResults.offsetWidth;
632          domPopupSearchResultsWindow.style.top     = top  + 'px';
633          domPopupSearchResultsWindow.style.left    = left + 'px';
634        }
635     }
636
637     this.lastSearchValue = searchValue;
638     this.lastResultsPage = resultsPage;
639   }
640
641   // -------- Activation Functions
642
643   // Activates or deactivates the search panel, resetting things to
644   // their default values if necessary.
645   this.Activate = function(isActive)
646   {
647     if (isActive || // open it
648         this.DOMPopupSearchResultsWindow().style.display == 'block'
649        )
650     {
651       this.DOMSearchBox().className = 'MSearchBoxActive';
652
653       var searchField = this.DOMSearchField();
654
655       if (searchField.value == this.searchLabel) // clear "Search" term upon entry
656       {
657         searchField.value = '';
658         this.searchActive = true;
659       }
660     }
661     else if (!isActive) // directly remove the panel
662     {
663       this.DOMSearchBox().className = 'MSearchBoxInactive';
664       this.DOMSearchField().value   = this.searchLabel;
665       this.searchActive             = false;
666       this.lastSearchValue          = ''
667       this.lastResultsPage          = '';
668     }
669   }
670 }
671
672 // -----------------------------------------------------------------------
673
674 // The class that handles everything on the search results page.
675 function SearchResults(name)
676 {
677     // The number of matches from the last run of <Search()>.
678     this.lastMatchCount = 0;
679     this.lastKey = 0;
680     this.repeatOn = false;
681
682     // Toggles the visibility of the passed element ID.
683     this.FindChildElement = function(id)
684     {
685       var parentElement = document.getElementById(id);
686       var element = parentElement.firstChild;
687
688       while (element && element!=parentElement)
689       {
690         if (element.nodeName == 'DIV' && element.className == 'SRChildren')
691         {
692           return element;
693         }
694
695         if (element.nodeName == 'DIV' && element.hasChildNodes())
696         {
697            element = element.firstChild;
698         }
699         else if (element.nextSibling)
700         {
701            element = element.nextSibling;
702         }
703         else
704         {
705           do
706           {
707             element = element.parentNode;
708           }
709           while (element && element!=parentElement && !element.nextSibling);
710
711           if (element && element!=parentElement)
712           {
713             element = element.nextSibling;
714           }
715         }
716       }
717     }
718
719     this.Toggle = function(id)
720     {
721       var element = this.FindChildElement(id);
722       if (element)
723       {
724         if (element.style.display == 'block')
725         {
726           element.style.display = 'none';
727         }
728         else
729         {
730           element.style.display = 'block';
731         }
732       }
733     }
734
735     // Searches for the passed string.  If there is no parameter,
736     // it takes it from the URL query.
737     //
738     // Always returns true, since other documents may try to call it
739     // and that may or may not be possible.
740     this.Search = function(search)
741     {
742       if (!search) // get search word from URL
743       {
744         search = window.location.search;
745         search = search.substring(1);  // Remove the leading '?'
746         search = unescape(search);
747       }
748
749       search = search.replace(/^ +/, ""); // strip leading spaces
750       search = search.replace(/ +$/, ""); // strip trailing spaces
751       search = search.toLowerCase();
752       search = convertToId(search);
753
754       var resultRows = document.getElementsByTagName("div");
755       var matches = 0;
756
757       var i = 0;
758       while (i < resultRows.length)
759       {
760         var row = resultRows.item(i);
761         if (row.className == "SRResult")
762         {
763           var rowMatchName = row.id.toLowerCase();
764           rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_'
765
766           if (search.length<=rowMatchName.length &&
767              rowMatchName.substr(0, search.length)==search)
768           {
769             row.style.display = 'block';
770             matches++;
771           }
772           else
773           {
774             row.style.display = 'none';
775           }
776         }
777         i++;
778       }
779       document.getElementById("Searching").style.display='none';
780       if (matches == 0) // no results
781       {
782         document.getElementById("NoMatches").style.display='block';
783       }
784       else // at least one result
785       {
786         document.getElementById("NoMatches").style.display='none';
787       }
788       this.lastMatchCount = matches;
789       return true;
790     }
791
792     // return the first item with index index or higher that is visible
793     this.NavNext = function(index)
794     {
795       var focusItem;
796       while (1)
797       {
798         var focusName = 'Item'+index;
799         focusItem = document.getElementById(focusName);
800         if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
801         {
802           break;
803         }
804         else if (!focusItem) // last element
805         {
806           break;
807         }
808         focusItem=null;
809         index++;
810       }
811       return focusItem;
812     }
813
814     this.NavPrev = function(index)
815     {
816       var focusItem;
817       while (1)
818       {
819         var focusName = 'Item'+index;
820         focusItem = document.getElementById(focusName);
821         if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
822         {
823           break;
824         }
825         else if (!focusItem) // last element
826         {
827           break;
828         }
829         focusItem=null;
830         index--;
831       }
832       return focusItem;
833     }
834
835     this.ProcessKeys = function(e)
836     {
837       if (e.type == "keydown")
838       {
839         this.repeatOn = false;
840         this.lastKey = e.keyCode;
841       }
842       else if (e.type == "keypress")
843       {
844         if (!this.repeatOn)
845         {
846           if (this.lastKey) this.repeatOn = true;
847           return false; // ignore first keypress after keydown
848         }
849       }
850       else if (e.type == "keyup")
851       {
852         this.lastKey = 0;
853         this.repeatOn = false;
854       }
855       return this.lastKey!=0;
856     }
857
858     this.Nav = function(evt,itemIndex)
859     {
860       var e  = (evt) ? evt : window.event; // for IE
861       if (e.keyCode==13) return true;
862       if (!this.ProcessKeys(e)) return false;
863
864       if (this.lastKey==38) // Up
865       {
866         var newIndex = itemIndex-1;
867         var focusItem = this.NavPrev(newIndex);
868         if (focusItem)
869         {
870           var child = this.FindChildElement(focusItem.parentNode.parentNode.id);
871           if (child && child.style.display == 'block') // children visible
872           {
873             var n=0;
874             var tmpElem;
875             while (1) // search for last child
876             {
877               tmpElem = document.getElementById('Item'+newIndex+'_c'+n);
878               if (tmpElem)
879               {
880                 focusItem = tmpElem;
881               }
882               else // found it!
883               {
884                 break;
885               }
886               n++;
887             }
888           }
889         }
890         if (focusItem)
891         {
892           focusItem.focus();
893         }
894         else // return focus to search field
895         {
896            parent.document.getElementById("MSearchField").focus();
897         }
898       }
899       else if (this.lastKey==40) // Down
900       {
901         var newIndex = itemIndex+1;
902         var focusItem;
903         var item = document.getElementById('Item'+itemIndex);
904         var elem = this.FindChildElement(item.parentNode.parentNode.id);
905         if (elem && elem.style.display == 'block') // children visible
906         {
907           focusItem = document.getElementById('Item'+itemIndex+'_c0');
908         }
909         if (!focusItem) focusItem = this.NavNext(newIndex);
910         if (focusItem)  focusItem.focus();
911       }
912       else if (this.lastKey==39) // Right
913       {
914         var item = document.getElementById('Item'+itemIndex);
915         var elem = this.FindChildElement(item.parentNode.parentNode.id);
916         if (elem) elem.style.display = 'block';
917       }
918       else if (this.lastKey==37) // Left
919       {
920         var item = document.getElementById('Item'+itemIndex);
921         var elem = this.FindChildElement(item.parentNode.parentNode.id);
922         if (elem) elem.style.display = 'none';
923       }
924       else if (this.lastKey==27) // Escape
925       {
926         parent.searchBox.CloseResultsWindow();
927         parent.document.getElementById("MSearchField").focus();
928       }
929       else if (this.lastKey==13) // Enter
930       {
931         return true;
932       }
933       return false;
934     }
935
936     this.NavChild = function(evt,itemIndex,childIndex)
937     {
938       var e  = (evt) ? evt : window.event; // for IE
939       if (e.keyCode==13) return true;
940       if (!this.ProcessKeys(e)) return false;
941
942       if (this.lastKey==38) // Up
943       {
944         if (childIndex>0)
945         {
946           var newIndex = childIndex-1;
947           document.getElementById('Item'+itemIndex+'_c'+newIndex).focus();
948         }
949         else // already at first child, jump to parent
950         {
951           document.getElementById('Item'+itemIndex).focus();
952         }
953       }
954       else if (this.lastKey==40) // Down
955       {
956         var newIndex = childIndex+1;
957         var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex);
958         if (!elem) // last child, jump to parent next parent
959         {
960           elem = this.NavNext(itemIndex+1);
961         }
962         if (elem)
963         {
964           elem.focus();
965         }
966       }
967       else if (this.lastKey==27) // Escape
968       {
969         parent.searchBox.CloseResultsWindow();
970         parent.document.getElementById("MSearchField").focus();
971       }
972       else if (this.lastKey==13) // Enter
973       {
974         return true;
975       }
976       return false;
977     }
978 }
979
980 function setKeyActions(elem,action)
981 {
982   elem.setAttribute('onkeydown',action);
983   elem.setAttribute('onkeypress',action);
984   elem.setAttribute('onkeyup',action);
985 }
986
987 function setClassAttr(elem,attr)
988 {
989   elem.setAttribute('class',attr);
990   elem.setAttribute('className',attr);
991 }
992
993 function createResults()
994 {
995   var results = document.getElementById("SRResults");
996   for (var e=0; e<searchData.length; e++)
997   {
998     var id = searchData[e][0];
999     var srResult = document.createElement('div');
1000     srResult.setAttribute('id','SR_'+id);
1001     setClassAttr(srResult,'SRResult');
1002     var srEntry = document.createElement('div');
1003     setClassAttr(srEntry,'SREntry');
1004     var srLink = document.createElement('a');
1005     srLink.setAttribute('id','Item'+e);
1006     setKeyActions(srLink,'return searchResults.Nav(event,'+e+')');
1007     setClassAttr(srLink,'SRSymbol');
1008     srLink.innerHTML = searchData[e][1][0];
1009     srEntry.appendChild(srLink);
1010     if (searchData[e][1].length==2) // single result
1011     {
1012       srLink.setAttribute('href',searchData[e][1][1][0]);
1013       if (searchData[e][1][1][1])
1014       {
1015        srLink.setAttribute('target','_parent');
1016       }
1017       var srScope = document.createElement('span');
1018       setClassAttr(srScope,'SRScope');
1019       srScope.innerHTML = searchData[e][1][1][2];
1020       srEntry.appendChild(srScope);
1021     }
1022     else // multiple results
1023     {
1024       srLink.setAttribute('href','javascript:searchResults.Toggle("SR_'+id+'")');
1025       var srChildren = document.createElement('div');
1026       setClassAttr(srChildren,'SRChildren');
1027       for (var c=0; c<searchData[e][1].length-1; c++)
1028       {
1029         var srChild = document.createElement('a');
1030         srChild.setAttribute('id','Item'+e+'_c'+c);
1031         setKeyActions(srChild,'return searchResults.NavChild(event,'+e+','+c+')');
1032         setClassAttr(srChild,'SRScope');
1033         srChild.setAttribute('href',searchData[e][1][c+1][0]);
1034         if (searchData[e][1][c+1][1])
1035         {
1036          srChild.setAttribute('target','_parent');
1037         }
1038         srChild.innerHTML = searchData[e][1][c+1][2];
1039         srChildren.appendChild(srChild);
1040       }
1041       srEntry.appendChild(srChildren);
1042     }
1043     srResult.appendChild(srEntry);
1044     results.appendChild(srResult);
1045   }
1046 }
1047
1048 function init_search()
1049 {
1050   var results = document.getElementById("MSearchSelectWindow");
1051   for (var key in indexSectionLabels)
1052   {
1053     var link = document.createElement('a');
1054     link.setAttribute('class','SelectItem');
1055     link.setAttribute('onclick','searchBox.OnSelectItem('+key+')');
1056     link.href='javascript:void(0)';
1057     link.innerHTML='<span class="SelectionMark">&#160;</span>'+indexSectionLabels[key];
1058     results.appendChild(link);
1059   }
1060   searchBox.OnSelectItem(0);
1061 }
1062