search.js 22 KB

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