search.js 22 KB

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