search.js 22 KB

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