search.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792
  1. function convertToId(search)
  2. {
  3. var result = '';
  4. for (i=0;i<search.length;i++)
  5. {
  6. var c = search.charAt(i);
  7. var cn = c.charCodeAt(0);
  8. if (c.match(/[a-z0-9\u0080-\uFFFF]/))
  9. {
  10. result+=c;
  11. }
  12. else if (cn<16)
  13. {
  14. result+="_0"+cn.toString(16);
  15. }
  16. else
  17. {
  18. result+="_"+cn.toString(16);
  19. }
  20. }
  21. return result;
  22. }
  23. function getXPos(item)
  24. {
  25. var x = 0;
  26. if (item.offsetWidth)
  27. {
  28. while (item && item!=document.body)
  29. {
  30. x += item.offsetLeft;
  31. item = item.offsetParent;
  32. }
  33. }
  34. return x;
  35. }
  36. function getYPos(item)
  37. {
  38. var y = 0;
  39. if (item.offsetWidth)
  40. {
  41. while (item && item!=document.body)
  42. {
  43. y += item.offsetTop;
  44. item = item.offsetParent;
  45. }
  46. }
  47. return y;
  48. }
  49. /* A class handling everything associated with the search panel.
  50. Parameters:
  51. name - The name of the global variable that will be
  52. storing this instance. Is needed to be able to set timeouts.
  53. resultPath - path to use for external files
  54. */
  55. function SearchBox(name, resultsPath, inFrame, label)
  56. {
  57. if (!name || !resultsPath) { alert("Missing parameters to SearchBox."); }
  58. // ---------- Instance variables
  59. this.name = name;
  60. this.resultsPath = resultsPath;
  61. this.keyTimeout = 0;
  62. this.keyTimeoutLength = 500;
  63. this.closeSelectionTimeout = 300;
  64. this.lastSearchValue = "";
  65. this.lastResultsPage = "";
  66. this.hideTimeout = 0;
  67. this.searchIndex = 0;
  68. this.searchActive = false;
  69. this.insideFrame = inFrame;
  70. this.searchLabel = label;
  71. // ----------- DOM Elements
  72. this.DOMSearchField = function()
  73. { return document.getElementById("MSearchField"); }
  74. this.DOMSearchSelect = function()
  75. { return document.getElementById("MSearchSelect"); }
  76. this.DOMSearchSelectWindow = function()
  77. { return document.getElementById("MSearchSelectWindow"); }
  78. this.DOMPopupSearchResults = function()
  79. { return document.getElementById("MSearchResults"); }
  80. this.DOMPopupSearchResultsWindow = function()
  81. { return document.getElementById("MSearchResultsWindow"); }
  82. this.DOMSearchClose = function()
  83. { return document.getElementById("MSearchClose"); }
  84. this.DOMSearchBox = function()
  85. { return document.getElementById("MSearchBox"); }
  86. // ------------ Event Handlers
  87. // Called when focus is added or removed from the search field.
  88. this.OnSearchFieldFocus = function(isActive)
  89. {
  90. this.Activate(isActive);
  91. }
  92. this.OnSearchSelectShow = function()
  93. {
  94. var searchSelectWindow = this.DOMSearchSelectWindow();
  95. var searchField = this.DOMSearchSelect();
  96. if (this.insideFrame)
  97. {
  98. var left = getXPos(searchField);
  99. var top = getYPos(searchField);
  100. left += searchField.offsetWidth + 6;
  101. top += searchField.offsetHeight;
  102. // show search selection popup
  103. searchSelectWindow.style.display='block';
  104. left -= searchSelectWindow.offsetWidth;
  105. searchSelectWindow.style.left = left + 'px';
  106. searchSelectWindow.style.top = top + 'px';
  107. }
  108. else
  109. {
  110. var left = getXPos(searchField);
  111. var top = getYPos(searchField);
  112. top += searchField.offsetHeight;
  113. // show search selection popup
  114. searchSelectWindow.style.display='block';
  115. searchSelectWindow.style.left = left + 'px';
  116. searchSelectWindow.style.top = top + 'px';
  117. }
  118. // stop selection hide timer
  119. if (this.hideTimeout)
  120. {
  121. clearTimeout(this.hideTimeout);
  122. this.hideTimeout=0;
  123. }
  124. return false; // to avoid "image drag" default event
  125. }
  126. this.OnSearchSelectHide = function()
  127. {
  128. this.hideTimeout = setTimeout(this.name +".CloseSelectionWindow()",
  129. this.closeSelectionTimeout);
  130. }
  131. // Called when the content of the search field is changed.
  132. this.OnSearchFieldChange = function(evt)
  133. {
  134. if (this.keyTimeout) // kill running timer
  135. {
  136. clearTimeout(this.keyTimeout);
  137. this.keyTimeout = 0;
  138. }
  139. var e = (evt) ? evt : window.event; // for IE
  140. if (e.keyCode==40 || e.keyCode==13)
  141. {
  142. if (e.shiftKey==1)
  143. {
  144. this.OnSearchSelectShow();
  145. var win=this.DOMSearchSelectWindow();
  146. for (i=0;i<win.childNodes.length;i++)
  147. {
  148. var child = win.childNodes[i]; // get span within a
  149. if (child.className=='SelectItem')
  150. {
  151. child.focus();
  152. return;
  153. }
  154. }
  155. return;
  156. }
  157. else if (window.frames.MSearchResults.searchResults)
  158. {
  159. var elem = window.frames.MSearchResults.searchResults.NavNext(0);
  160. if (elem) elem.focus();
  161. }
  162. }
  163. else if (e.keyCode==27) // Escape out of the search field
  164. {
  165. this.DOMSearchField().blur();
  166. this.DOMPopupSearchResultsWindow().style.display = 'none';
  167. this.DOMSearchClose().style.display = 'none';
  168. this.lastSearchValue = '';
  169. this.Activate(false);
  170. return;
  171. }
  172. // strip whitespaces
  173. var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
  174. if (searchValue != this.lastSearchValue) // search value has changed
  175. {
  176. if (searchValue != "") // non-empty search
  177. {
  178. // set timer for search update
  179. this.keyTimeout = setTimeout(this.name + '.Search()',
  180. this.keyTimeoutLength);
  181. }
  182. else // empty search field
  183. {
  184. this.DOMPopupSearchResultsWindow().style.display = 'none';
  185. this.DOMSearchClose().style.display = 'none';
  186. this.lastSearchValue = '';
  187. }
  188. }
  189. }
  190. this.SelectItemCount = function(id)
  191. {
  192. var count=0;
  193. var win=this.DOMSearchSelectWindow();
  194. for (i=0;i<win.childNodes.length;i++)
  195. {
  196. var child = win.childNodes[i]; // get span within a
  197. if (child.className=='SelectItem')
  198. {
  199. count++;
  200. }
  201. }
  202. return count;
  203. }
  204. this.SelectItemSet = function(id)
  205. {
  206. var i,j=0;
  207. var win=this.DOMSearchSelectWindow();
  208. for (i=0;i<win.childNodes.length;i++)
  209. {
  210. var child = win.childNodes[i]; // get span within a
  211. if (child.className=='SelectItem')
  212. {
  213. var node = child.firstChild;
  214. if (j==id)
  215. {
  216. node.innerHTML='&#8226;';
  217. }
  218. else
  219. {
  220. node.innerHTML='&#160;';
  221. }
  222. j++;
  223. }
  224. }
  225. }
  226. // Called when an search filter selection is made.
  227. // set item with index id as the active item
  228. this.OnSelectItem = function(id)
  229. {
  230. this.searchIndex = id;
  231. this.SelectItemSet(id);
  232. var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
  233. if (searchValue!="" && this.searchActive) // something was found -> do a search
  234. {
  235. this.Search();
  236. }
  237. }
  238. this.OnSearchSelectKey = function(evt)
  239. {
  240. var e = (evt) ? evt : window.event; // for IE
  241. if (e.keyCode==40 && this.searchIndex<this.SelectItemCount()) // Down
  242. {
  243. this.searchIndex++;
  244. this.OnSelectItem(this.searchIndex);
  245. }
  246. else if (e.keyCode==38 && this.searchIndex>0) // Up
  247. {
  248. this.searchIndex--;
  249. this.OnSelectItem(this.searchIndex);
  250. }
  251. else if (e.keyCode==13 || e.keyCode==27)
  252. {
  253. this.OnSelectItem(this.searchIndex);
  254. this.CloseSelectionWindow();
  255. this.DOMSearchField().focus();
  256. }
  257. return false;
  258. }
  259. // --------- Actions
  260. // Closes the results window.
  261. this.CloseResultsWindow = function()
  262. {
  263. this.DOMPopupSearchResultsWindow().style.display = 'none';
  264. this.DOMSearchClose().style.display = 'none';
  265. this.Activate(false);
  266. }
  267. this.CloseSelectionWindow = function()
  268. {
  269. this.DOMSearchSelectWindow().style.display = 'none';
  270. }
  271. // Performs a search.
  272. this.Search = function()
  273. {
  274. this.keyTimeout = 0;
  275. // strip leading whitespace
  276. var searchValue = this.DOMSearchField().value.replace(/^ +/, "");
  277. var code = searchValue.toLowerCase().charCodeAt(0);
  278. var idxChar = searchValue.substr(0, 1).toLowerCase();
  279. if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) // surrogate pair
  280. {
  281. idxChar = searchValue.substr(0, 2);
  282. }
  283. var resultsPage;
  284. var resultsPageWithSearch;
  285. var hasResultsPage;
  286. var idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar);
  287. if (idx!=-1)
  288. {
  289. var hexCode=idx.toString(16);
  290. resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html';
  291. resultsPageWithSearch = resultsPage+'?'+escape(searchValue);
  292. hasResultsPage = true;
  293. }
  294. else // nothing available for this search term
  295. {
  296. resultsPage = this.resultsPath + '/nomatches.html';
  297. resultsPageWithSearch = resultsPage;
  298. hasResultsPage = false;
  299. }
  300. window.frames.MSearchResults.location = resultsPageWithSearch;
  301. var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow();
  302. if (domPopupSearchResultsWindow.style.display!='block')
  303. {
  304. var domSearchBox = this.DOMSearchBox();
  305. this.DOMSearchClose().style.display = 'inline';
  306. if (this.insideFrame)
  307. {
  308. var domPopupSearchResults = this.DOMPopupSearchResults();
  309. domPopupSearchResultsWindow.style.position = 'relative';
  310. domPopupSearchResultsWindow.style.display = 'block';
  311. var width = document.body.clientWidth - 8; // the -8 is for IE :-(
  312. domPopupSearchResultsWindow.style.width = width + 'px';
  313. domPopupSearchResults.style.width = width + 'px';
  314. }
  315. else
  316. {
  317. var domPopupSearchResults = this.DOMPopupSearchResults();
  318. var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth;
  319. var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1;
  320. domPopupSearchResultsWindow.style.display = 'block';
  321. left -= domPopupSearchResults.offsetWidth;
  322. domPopupSearchResultsWindow.style.top = top + 'px';
  323. domPopupSearchResultsWindow.style.left = left + 'px';
  324. }
  325. }
  326. this.lastSearchValue = searchValue;
  327. this.lastResultsPage = resultsPage;
  328. }
  329. // -------- Activation Functions
  330. // Activates or deactivates the search panel, resetting things to
  331. // their default values if necessary.
  332. this.Activate = function(isActive)
  333. {
  334. if (isActive || // open it
  335. this.DOMPopupSearchResultsWindow().style.display == 'block'
  336. )
  337. {
  338. this.DOMSearchBox().className = 'MSearchBoxActive';
  339. var searchField = this.DOMSearchField();
  340. if (searchField.value == this.searchLabel) // clear "Search" term upon entry
  341. {
  342. searchField.value = '';
  343. this.searchActive = true;
  344. }
  345. }
  346. else if (!isActive) // directly remove the panel
  347. {
  348. this.DOMSearchBox().className = 'MSearchBoxInactive';
  349. this.DOMSearchField().value = this.searchLabel;
  350. this.searchActive = false;
  351. this.lastSearchValue = ''
  352. this.lastResultsPage = '';
  353. }
  354. }
  355. }
  356. // -----------------------------------------------------------------------
  357. // The class that handles everything on the search results page.
  358. function SearchResults(name)
  359. {
  360. // The number of matches from the last run of <Search()>.
  361. this.lastMatchCount = 0;
  362. this.lastKey = 0;
  363. this.repeatOn = false;
  364. // Toggles the visibility of the passed element ID.
  365. this.FindChildElement = function(id)
  366. {
  367. var parentElement = document.getElementById(id);
  368. var element = parentElement.firstChild;
  369. while (element && element!=parentElement)
  370. {
  371. if (element.nodeName == 'DIV' && element.className == 'SRChildren')
  372. {
  373. return element;
  374. }
  375. if (element.nodeName == 'DIV' && element.hasChildNodes())
  376. {
  377. element = element.firstChild;
  378. }
  379. else if (element.nextSibling)
  380. {
  381. element = element.nextSibling;
  382. }
  383. else
  384. {
  385. do
  386. {
  387. element = element.parentNode;
  388. }
  389. while (element && element!=parentElement && !element.nextSibling);
  390. if (element && element!=parentElement)
  391. {
  392. element = element.nextSibling;
  393. }
  394. }
  395. }
  396. }
  397. this.Toggle = function(id)
  398. {
  399. var element = this.FindChildElement(id);
  400. if (element)
  401. {
  402. if (element.style.display == 'block')
  403. {
  404. element.style.display = 'none';
  405. }
  406. else
  407. {
  408. element.style.display = 'block';
  409. }
  410. }
  411. }
  412. // Searches for the passed string. If there is no parameter,
  413. // it takes it from the URL query.
  414. //
  415. // Always returns true, since other documents may try to call it
  416. // and that may or may not be possible.
  417. this.Search = function(search)
  418. {
  419. if (!search) // get search word from URL
  420. {
  421. search = window.location.search;
  422. search = search.substring(1); // Remove the leading '?'
  423. search = unescape(search);
  424. }
  425. search = search.replace(/^ +/, ""); // strip leading spaces
  426. search = search.replace(/ +$/, ""); // strip trailing spaces
  427. search = search.toLowerCase();
  428. search = convertToId(search);
  429. var resultRows = document.getElementsByTagName("div");
  430. var matches = 0;
  431. var i = 0;
  432. while (i < resultRows.length)
  433. {
  434. var row = resultRows.item(i);
  435. if (row.className == "SRResult")
  436. {
  437. var rowMatchName = row.id.toLowerCase();
  438. rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_'
  439. if (search.length<=rowMatchName.length &&
  440. rowMatchName.substr(0, search.length)==search)
  441. {
  442. row.style.display = 'block';
  443. matches++;
  444. }
  445. else
  446. {
  447. row.style.display = 'none';
  448. }
  449. }
  450. i++;
  451. }
  452. document.getElementById("Searching").style.display='none';
  453. if (matches == 0) // no results
  454. {
  455. document.getElementById("NoMatches").style.display='block';
  456. }
  457. else // at least one result
  458. {
  459. document.getElementById("NoMatches").style.display='none';
  460. }
  461. this.lastMatchCount = matches;
  462. return true;
  463. }
  464. // return the first item with index index or higher that is visible
  465. this.NavNext = function(index)
  466. {
  467. var focusItem;
  468. while (1)
  469. {
  470. var focusName = 'Item'+index;
  471. focusItem = document.getElementById(focusName);
  472. if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
  473. {
  474. break;
  475. }
  476. else if (!focusItem) // last element
  477. {
  478. break;
  479. }
  480. focusItem=null;
  481. index++;
  482. }
  483. return focusItem;
  484. }
  485. this.NavPrev = function(index)
  486. {
  487. var focusItem;
  488. while (1)
  489. {
  490. var focusName = 'Item'+index;
  491. focusItem = document.getElementById(focusName);
  492. if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
  493. {
  494. break;
  495. }
  496. else if (!focusItem) // last element
  497. {
  498. break;
  499. }
  500. focusItem=null;
  501. index--;
  502. }
  503. return focusItem;
  504. }
  505. this.ProcessKeys = function(e)
  506. {
  507. if (e.type == "keydown")
  508. {
  509. this.repeatOn = false;
  510. this.lastKey = e.keyCode;
  511. }
  512. else if (e.type == "keypress")
  513. {
  514. if (!this.repeatOn)
  515. {
  516. if (this.lastKey) this.repeatOn = true;
  517. return false; // ignore first keypress after keydown
  518. }
  519. }
  520. else if (e.type == "keyup")
  521. {
  522. this.lastKey = 0;
  523. this.repeatOn = false;
  524. }
  525. return this.lastKey!=0;
  526. }
  527. this.Nav = function(evt,itemIndex)
  528. {
  529. var e = (evt) ? evt : window.event; // for IE
  530. if (e.keyCode==13) return true;
  531. if (!this.ProcessKeys(e)) return false;
  532. if (this.lastKey==38) // Up
  533. {
  534. var newIndex = itemIndex-1;
  535. var focusItem = this.NavPrev(newIndex);
  536. if (focusItem)
  537. {
  538. var child = this.FindChildElement(focusItem.parentNode.parentNode.id);
  539. if (child && child.style.display == 'block') // children visible
  540. {
  541. var n=0;
  542. var tmpElem;
  543. while (1) // search for last child
  544. {
  545. tmpElem = document.getElementById('Item'+newIndex+'_c'+n);
  546. if (tmpElem)
  547. {
  548. focusItem = tmpElem;
  549. }
  550. else // found it!
  551. {
  552. break;
  553. }
  554. n++;
  555. }
  556. }
  557. }
  558. if (focusItem)
  559. {
  560. focusItem.focus();
  561. }
  562. else // return focus to search field
  563. {
  564. parent.document.getElementById("MSearchField").focus();
  565. }
  566. }
  567. else if (this.lastKey==40) // Down
  568. {
  569. var newIndex = itemIndex+1;
  570. var focusItem;
  571. var item = document.getElementById('Item'+itemIndex);
  572. var elem = this.FindChildElement(item.parentNode.parentNode.id);
  573. if (elem && elem.style.display == 'block') // children visible
  574. {
  575. focusItem = document.getElementById('Item'+itemIndex+'_c0');
  576. }
  577. if (!focusItem) focusItem = this.NavNext(newIndex);
  578. if (focusItem) focusItem.focus();
  579. }
  580. else if (this.lastKey==39) // Right
  581. {
  582. var item = document.getElementById('Item'+itemIndex);
  583. var elem = this.FindChildElement(item.parentNode.parentNode.id);
  584. if (elem) elem.style.display = 'block';
  585. }
  586. else if (this.lastKey==37) // Left
  587. {
  588. var item = document.getElementById('Item'+itemIndex);
  589. var elem = this.FindChildElement(item.parentNode.parentNode.id);
  590. if (elem) elem.style.display = 'none';
  591. }
  592. else if (this.lastKey==27) // Escape
  593. {
  594. parent.searchBox.CloseResultsWindow();
  595. parent.document.getElementById("MSearchField").focus();
  596. }
  597. else if (this.lastKey==13) // Enter
  598. {
  599. return true;
  600. }
  601. return false;
  602. }
  603. this.NavChild = function(evt,itemIndex,childIndex)
  604. {
  605. var e = (evt) ? evt : window.event; // for IE
  606. if (e.keyCode==13) return true;
  607. if (!this.ProcessKeys(e)) return false;
  608. if (this.lastKey==38) // Up
  609. {
  610. if (childIndex>0)
  611. {
  612. var newIndex = childIndex-1;
  613. document.getElementById('Item'+itemIndex+'_c'+newIndex).focus();
  614. }
  615. else // already at first child, jump to parent
  616. {
  617. document.getElementById('Item'+itemIndex).focus();
  618. }
  619. }
  620. else if (this.lastKey==40) // Down
  621. {
  622. var newIndex = childIndex+1;
  623. var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex);
  624. if (!elem) // last child, jump to parent next parent
  625. {
  626. elem = this.NavNext(itemIndex+1);
  627. }
  628. if (elem)
  629. {
  630. elem.focus();
  631. }
  632. }
  633. else if (this.lastKey==27) // Escape
  634. {
  635. parent.searchBox.CloseResultsWindow();
  636. parent.document.getElementById("MSearchField").focus();
  637. }
  638. else if (this.lastKey==13) // Enter
  639. {
  640. return true;
  641. }
  642. return false;
  643. }
  644. }
  645. function setKeyActions(elem,action)
  646. {
  647. elem.setAttribute('onkeydown',action);
  648. elem.setAttribute('onkeypress',action);
  649. elem.setAttribute('onkeyup',action);
  650. }
  651. function setClassAttr(elem,attr)
  652. {
  653. elem.setAttribute('class',attr);
  654. elem.setAttribute('className',attr);
  655. }
  656. function createResults()
  657. {
  658. var results = document.getElementById("SRResults");
  659. for (var e=0; e<searchData.length; e++)
  660. {
  661. var id = searchData[e][0];
  662. var srResult = document.createElement('div');
  663. srResult.setAttribute('id','SR_'+id);
  664. setClassAttr(srResult,'SRResult');
  665. var srEntry = document.createElement('div');
  666. setClassAttr(srEntry,'SREntry');
  667. var srLink = document.createElement('a');
  668. srLink.setAttribute('id','Item'+e);
  669. setKeyActions(srLink,'return searchResults.Nav(event,'+e+')');
  670. setClassAttr(srLink,'SRSymbol');
  671. srLink.innerHTML = searchData[e][1][0];
  672. srEntry.appendChild(srLink);
  673. if (searchData[e][1].length==2) // single result
  674. {
  675. srLink.setAttribute('href',searchData[e][1][1][0]);
  676. if (searchData[e][1][1][1])
  677. {
  678. srLink.setAttribute('target','_parent');
  679. }
  680. var srScope = document.createElement('span');
  681. setClassAttr(srScope,'SRScope');
  682. srScope.innerHTML = searchData[e][1][1][2];
  683. srEntry.appendChild(srScope);
  684. }
  685. else // multiple results
  686. {
  687. srLink.setAttribute('href','javascript:searchResults.Toggle("SR_'+id+'")');
  688. var srChildren = document.createElement('div');
  689. setClassAttr(srChildren,'SRChildren');
  690. for (var c=0; c<searchData[e][1].length-1; c++)
  691. {
  692. var srChild = document.createElement('a');
  693. srChild.setAttribute('id','Item'+e+'_c'+c);
  694. setKeyActions(srChild,'return searchResults.NavChild(event,'+e+','+c+')');
  695. setClassAttr(srChild,'SRScope');
  696. srChild.setAttribute('href',searchData[e][1][c+1][0]);
  697. if (searchData[e][1][c+1][1])
  698. {
  699. srChild.setAttribute('target','_parent');
  700. }
  701. srChild.innerHTML = searchData[e][1][c+1][2];
  702. srChildren.appendChild(srChild);
  703. }
  704. srEntry.appendChild(srChildren);
  705. }
  706. srResult.appendChild(srEntry);
  707. results.appendChild(srResult);
  708. }
  709. }
  710. function init_search()
  711. {
  712. var results = document.getElementById("MSearchSelectWindow");
  713. for (var key in indexSectionLabels)
  714. {
  715. var link = document.createElement('a');
  716. link.setAttribute('class','SelectItem');
  717. link.setAttribute('onclick','searchBox.OnSelectItem('+key+')');
  718. link.href='javascript:void(0)';
  719. link.innerHTML='<span class="SelectionMark">&#160;</span>'+indexSectionLabels[key];
  720. results.appendChild(link);
  721. }
  722. searchBox.OnSelectItem(0);
  723. }