search.js 22 KB

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