search.js 22 KB

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