search.js 22 KB

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