You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

898 lines
32 KiB

4 years ago
  1. //CdnPath=http://ajax.aspnetcdn.com/ajax/4.5.1/1/Menu.js
  2. var __rootMenuItem;
  3. var __menuInterval;
  4. var __scrollPanel;
  5. var __disappearAfter = 500;
  6. function Menu_ClearInterval() {
  7. if (__menuInterval) {
  8. window.clearInterval(__menuInterval);
  9. }
  10. }
  11. function Menu_Collapse(item) {
  12. Menu_SetRoot(item);
  13. if (__rootMenuItem) {
  14. Menu_ClearInterval();
  15. if (__disappearAfter >= 0) {
  16. __menuInterval = window.setInterval("Menu_HideItems()", __disappearAfter);
  17. }
  18. }
  19. }
  20. function Menu_Expand(item, horizontalOffset, verticalOffset, hideScrollers) {
  21. Menu_ClearInterval();
  22. var tr = item.parentNode.parentNode.parentNode.parentNode.parentNode;
  23. var horizontal = true;
  24. if (!tr.id) {
  25. horizontal = false;
  26. tr = tr.parentNode;
  27. }
  28. var child = Menu_FindSubMenu(item);
  29. if (child) {
  30. var data = Menu_GetData(item);
  31. if (!data) {
  32. return null;
  33. }
  34. child.rel = tr.id;
  35. child.x = horizontalOffset;
  36. child.y = verticalOffset;
  37. if (horizontal) child.pos = "bottom";
  38. PopOut_Show(child.id, hideScrollers, data);
  39. }
  40. Menu_SetRoot(item);
  41. if (child) {
  42. if (!document.body.__oldOnClick && document.body.onclick) {
  43. document.body.__oldOnClick = document.body.onclick;
  44. }
  45. if (__rootMenuItem) {
  46. document.body.onclick = Menu_HideItems;
  47. }
  48. }
  49. Menu_ResetSiblings(tr);
  50. return child;
  51. }
  52. function Menu_FindMenu(item) {
  53. if (item && item.menu) return item.menu;
  54. var tr = item.parentNode.parentNode.parentNode.parentNode.parentNode;
  55. if (!tr.id) {
  56. tr = tr.parentNode;
  57. }
  58. for (var i = tr.id.length - 1; i >= 0; i--) {
  59. if (tr.id.charAt(i) < '0' || tr.id.charAt(i) > '9') {
  60. var menu = WebForm_GetElementById(tr.id.substr(0, i));
  61. if (menu) {
  62. item.menu = menu;
  63. return menu;
  64. }
  65. }
  66. }
  67. return null;
  68. }
  69. function Menu_FindNext(item) {
  70. var a = WebForm_GetElementByTagName(item, "A");
  71. var parent = Menu_FindParentContainer(item);
  72. var first = null;
  73. if (parent) {
  74. var links = WebForm_GetElementsByTagName(parent, "A");
  75. var match = false;
  76. for (var i = 0; i < links.length; i++) {
  77. var link = links[i];
  78. if (Menu_IsSelectable(link)) {
  79. if (Menu_FindParentContainer(link) == parent) {
  80. if (match) {
  81. return link;
  82. }
  83. else if (!first) {
  84. first = link;
  85. }
  86. }
  87. if (!match && link == a) {
  88. match = true;
  89. }
  90. }
  91. }
  92. }
  93. return first;
  94. }
  95. function Menu_FindParentContainer(item) {
  96. if (item.menu_ParentContainerCache) return item.menu_ParentContainerCache;
  97. var a = (item.tagName.toLowerCase() == "a") ? item : WebForm_GetElementByTagName(item, "A");
  98. var menu = Menu_FindMenu(a);
  99. if (menu) {
  100. var parent = item;
  101. while (parent && parent.tagName &&
  102. parent.id != menu.id &&
  103. parent.tagName.toLowerCase() != "div") {
  104. parent = parent.parentNode;
  105. }
  106. item.menu_ParentContainerCache = parent;
  107. return parent;
  108. }
  109. }
  110. function Menu_FindParentItem(item) {
  111. var parentContainer = Menu_FindParentContainer(item);
  112. var parentContainerID = parentContainer.id;
  113. var len = parentContainerID.length;
  114. if (parentContainerID && parentContainerID.substr(len - 5) == "Items") {
  115. var parentItemID = parentContainerID.substr(0, len - 5);
  116. return WebForm_GetElementById(parentItemID);
  117. }
  118. return null;
  119. }
  120. function Menu_FindPrevious(item) {
  121. var a = WebForm_GetElementByTagName(item, "A");
  122. var parent = Menu_FindParentContainer(item);
  123. var last = null;
  124. if (parent) {
  125. var links = WebForm_GetElementsByTagName(parent, "A");
  126. for (var i = 0; i < links.length; i++) {
  127. var link = links[i];
  128. if (Menu_IsSelectable(link)) {
  129. if (link == a && last) {
  130. return last;
  131. }
  132. if (Menu_FindParentContainer(link) == parent) {
  133. last = link;
  134. }
  135. }
  136. }
  137. }
  138. return last;
  139. }
  140. function Menu_FindSubMenu(item) {
  141. var tr = item.parentNode.parentNode.parentNode.parentNode.parentNode;
  142. if (!tr.id) {
  143. tr=tr.parentNode;
  144. }
  145. return WebForm_GetElementById(tr.id + "Items");
  146. }
  147. function Menu_Focus(item) {
  148. if (item && item.focus) {
  149. var pos = WebForm_GetElementPosition(item);
  150. var parentContainer = Menu_FindParentContainer(item);
  151. if (!parentContainer.offset) {
  152. parentContainer.offset = 0;
  153. }
  154. var posParent = WebForm_GetElementPosition(parentContainer);
  155. var delta;
  156. if (pos.y + pos.height > posParent.y + parentContainer.offset + parentContainer.clippedHeight) {
  157. delta = pos.y + pos.height - posParent.y - parentContainer.offset - parentContainer.clippedHeight;
  158. PopOut_Scroll(parentContainer, delta);
  159. }
  160. else if (pos.y < posParent.y + parentContainer.offset) {
  161. delta = posParent.y + parentContainer.offset - pos.y;
  162. PopOut_Scroll(parentContainer, -delta);
  163. }
  164. PopOut_HideScrollers(parentContainer);
  165. item.focus();
  166. }
  167. }
  168. function Menu_GetData(item) {
  169. if (!item.data) {
  170. var a = (item.tagName.toLowerCase() == "a" ? item : WebForm_GetElementByTagName(item, "a"));
  171. var menu = Menu_FindMenu(a);
  172. try {
  173. item.data = eval(menu.id + "_Data");
  174. }
  175. catch(e) {}
  176. }
  177. return item.data;
  178. }
  179. function Menu_HideItems(items) {
  180. if (document.body.__oldOnClick) {
  181. document.body.onclick = document.body.__oldOnClick;
  182. document.body.__oldOnClick = null;
  183. }
  184. Menu_ClearInterval();
  185. if (!items || ((typeof(items.tagName) == "undefined") && (items instanceof Event))) {
  186. items = __rootMenuItem;
  187. }
  188. var table = items;
  189. if ((typeof(table) == "undefined") || (table == null) || !table.tagName || (table.tagName.toLowerCase() != "table")) {
  190. table = WebForm_GetElementByTagName(table, "TABLE");
  191. }
  192. if ((typeof(table) == "undefined") || (table == null) || !table.tagName || (table.tagName.toLowerCase() != "table")) {
  193. return;
  194. }
  195. var rows = table.rows ? table.rows : table.firstChild.rows;
  196. var isVertical = false;
  197. for (var r = 0; r < rows.length; r++) {
  198. if (rows[r].id) {
  199. isVertical = true;
  200. break;
  201. }
  202. }
  203. var i, child, nextLevel;
  204. if (isVertical) {
  205. for(i = 0; i < rows.length; i++) {
  206. if (rows[i].id) {
  207. child = WebForm_GetElementById(rows[i].id + "Items");
  208. if (child) {
  209. Menu_HideItems(child);
  210. }
  211. }
  212. else if (rows[i].cells[0]) {
  213. nextLevel = WebForm_GetElementByTagName(rows[i].cells[0], "TABLE");
  214. if (nextLevel) {
  215. Menu_HideItems(nextLevel);
  216. }
  217. }
  218. }
  219. }
  220. else if (rows[0]) {
  221. for(i = 0; i < rows[0].cells.length; i++) {
  222. if (rows[0].cells[i].id) {
  223. child = WebForm_GetElementById(rows[0].cells[i].id + "Items");
  224. if (child) {
  225. Menu_HideItems(child);
  226. }
  227. }
  228. else {
  229. nextLevel = WebForm_GetElementByTagName(rows[0].cells[i], "TABLE");
  230. if (nextLevel) {
  231. Menu_HideItems(rows[0].cells[i].firstChild);
  232. }
  233. }
  234. }
  235. }
  236. if (items && items.id) {
  237. PopOut_Hide(items.id);
  238. }
  239. }
  240. function Menu_HoverDisabled(item) {
  241. var node = (item.tagName.toLowerCase() == "td") ?
  242. item:
  243. item.cells[0];
  244. var data = Menu_GetData(item);
  245. if (!data) return;
  246. node = WebForm_GetElementByTagName(node, "table").rows[0].cells[0].childNodes[0];
  247. if (data.disappearAfter >= 200) {
  248. __disappearAfter = data.disappearAfter;
  249. }
  250. Menu_Expand(node, data.horizontalOffset, data.verticalOffset);
  251. }
  252. function Menu_HoverDynamic(item) {
  253. var node = (item.tagName.toLowerCase() == "td") ?
  254. item:
  255. item.cells[0];
  256. var data = Menu_GetData(item);
  257. if (!data) return;
  258. var nodeTable = WebForm_GetElementByTagName(node, "table");
  259. if (data.hoverClass) {
  260. nodeTable.hoverClass = data.hoverClass;
  261. WebForm_AppendToClassName(nodeTable, data.hoverClass);
  262. }
  263. node = nodeTable.rows[0].cells[0].childNodes[0];
  264. if (data.hoverHyperLinkClass) {
  265. node.hoverHyperLinkClass = data.hoverHyperLinkClass;
  266. WebForm_AppendToClassName(node, data.hoverHyperLinkClass);
  267. }
  268. if (data.disappearAfter >= 200) {
  269. __disappearAfter = data.disappearAfter;
  270. }
  271. Menu_Expand(node, data.horizontalOffset, data.verticalOffset);
  272. }
  273. function Menu_HoverRoot(item) {
  274. var node = (item.tagName.toLowerCase() == "td") ?
  275. item:
  276. item.cells[0];
  277. var data = Menu_GetData(item);
  278. if (!data) {
  279. return null;
  280. }
  281. var nodeTable = WebForm_GetElementByTagName(node, "table");
  282. if (data.staticHoverClass) {
  283. nodeTable.hoverClass = data.staticHoverClass;
  284. WebForm_AppendToClassName(nodeTable, data.staticHoverClass);
  285. }
  286. node = nodeTable.rows[0].cells[0].childNodes[0];
  287. if (data.staticHoverHyperLinkClass) {
  288. node.hoverHyperLinkClass = data.staticHoverHyperLinkClass;
  289. WebForm_AppendToClassName(node, data.staticHoverHyperLinkClass);
  290. }
  291. return node;
  292. }
  293. function Menu_HoverStatic(item) {
  294. var node = Menu_HoverRoot(item);
  295. var data = Menu_GetData(item);
  296. if (!data) return;
  297. __disappearAfter = data.disappearAfter;
  298. Menu_Expand(node, data.horizontalOffset, data.verticalOffset);
  299. }
  300. function Menu_IsHorizontal(item) {
  301. if (item) {
  302. var a = ((item.tagName && (item.tagName.toLowerCase == "a")) ? item : WebForm_GetElementByTagName(item, "A"));
  303. if (!a) {
  304. return false;
  305. }
  306. var td = a.parentNode.parentNode.parentNode.parentNode.parentNode;
  307. if (td.id) {
  308. return true;
  309. }
  310. }
  311. return false;
  312. }
  313. function Menu_IsSelectable(link) {
  314. return (link && link.href)
  315. }
  316. function Menu_Key(item) {
  317. var event;
  318. if (item.currentTarget) {
  319. event = item;
  320. item = event.currentTarget;
  321. }
  322. else {
  323. event = window.event;
  324. }
  325. var key = (event ? event.keyCode : -1);
  326. var data = Menu_GetData(item);
  327. if (!data) return;
  328. var horizontal = Menu_IsHorizontal(item);
  329. var a = WebForm_GetElementByTagName(item, "A");
  330. var nextItem, parentItem, previousItem;
  331. if ((!horizontal && key == 38) || (horizontal && key == 37)) {
  332. previousItem = Menu_FindPrevious(item);
  333. while (previousItem && previousItem.disabled) {
  334. previousItem = Menu_FindPrevious(previousItem);
  335. }
  336. if (previousItem) {
  337. Menu_Focus(previousItem);
  338. Menu_Expand(previousItem, data.horizontalOffset, data.verticalOffset, true);
  339. event.cancelBubble = true;
  340. if (event.stopPropagation) event.stopPropagation();
  341. return;
  342. }
  343. }
  344. if ((!horizontal && key == 40) || (horizontal && key == 39)) {
  345. if (horizontal) {
  346. var subMenu = Menu_FindSubMenu(a);
  347. if (subMenu && subMenu.style && subMenu.style.visibility &&
  348. subMenu.style.visibility.toLowerCase() == "hidden") {
  349. Menu_Expand(a, data.horizontalOffset, data.verticalOffset, true);
  350. event.cancelBubble = true;
  351. if (event.stopPropagation) event.stopPropagation();
  352. return;
  353. }
  354. }
  355. nextItem = Menu_FindNext(item);
  356. while (nextItem && nextItem.disabled) {
  357. nextItem = Menu_FindNext(nextItem);
  358. }
  359. if (nextItem) {
  360. Menu_Focus(nextItem);
  361. Menu_Expand(nextItem, data.horizontalOffset, data.verticalOffset, true);
  362. event.cancelBubble = true;
  363. if (event.stopPropagation) event.stopPropagation();
  364. return;
  365. }
  366. }
  367. if ((!horizontal && key == 39) || (horizontal && key == 40)) {
  368. var children = Menu_Expand(a, data.horizontalOffset, data.verticalOffset, true);
  369. if (children) {
  370. var firstChild;
  371. children = WebForm_GetElementsByTagName(children, "A");
  372. for (var i = 0; i < children.length; i++) {
  373. if (!children[i].disabled && Menu_IsSelectable(children[i])) {
  374. firstChild = children[i];
  375. break;
  376. }
  377. }
  378. if (firstChild) {
  379. Menu_Focus(firstChild);
  380. Menu_Expand(firstChild, data.horizontalOffset, data.verticalOffset, true);
  381. event.cancelBubble = true;
  382. if (event.stopPropagation) event.stopPropagation();
  383. return;
  384. }
  385. }
  386. else {
  387. parentItem = Menu_FindParentItem(item);
  388. while (parentItem && !Menu_IsHorizontal(parentItem)) {
  389. parentItem = Menu_FindParentItem(parentItem);
  390. }
  391. if (parentItem) {
  392. nextItem = Menu_FindNext(parentItem);
  393. while (nextItem && nextItem.disabled) {
  394. nextItem = Menu_FindNext(nextItem);
  395. }
  396. if (nextItem) {
  397. Menu_Focus(nextItem);
  398. Menu_Expand(nextItem, data.horizontalOffset, data.verticalOffset, true);
  399. event.cancelBubble = true;
  400. if (event.stopPropagation) event.stopPropagation();
  401. return;
  402. }
  403. }
  404. }
  405. }
  406. if ((!horizontal && key == 37) || (horizontal && key == 38)) {
  407. parentItem = Menu_FindParentItem(item);
  408. if (parentItem) {
  409. if (Menu_IsHorizontal(parentItem)) {
  410. previousItem = Menu_FindPrevious(parentItem);
  411. while (previousItem && previousItem.disabled) {
  412. previousItem = Menu_FindPrevious(previousItem);
  413. }
  414. if (previousItem) {
  415. Menu_Focus(previousItem);
  416. Menu_Expand(previousItem, data.horizontalOffset, data.verticalOffset, true);
  417. event.cancelBubble = true;
  418. if (event.stopPropagation) event.stopPropagation();
  419. return;
  420. }
  421. }
  422. var parentA = WebForm_GetElementByTagName(parentItem, "A");
  423. if (parentA) {
  424. Menu_Focus(parentA);
  425. }
  426. Menu_ResetSiblings(parentItem);
  427. event.cancelBubble = true;
  428. if (event.stopPropagation) event.stopPropagation();
  429. return;
  430. }
  431. }
  432. if (key == 27) {
  433. Menu_HideItems();
  434. event.cancelBubble = true;
  435. if (event.stopPropagation) event.stopPropagation();
  436. return;
  437. }
  438. }
  439. function Menu_ResetSiblings(item) {
  440. var table = (item.tagName.toLowerCase() == "td") ?
  441. item.parentNode.parentNode.parentNode :
  442. item.parentNode.parentNode;
  443. var isVertical = false;
  444. for (var r = 0; r < table.rows.length; r++) {
  445. if (table.rows[r].id) {
  446. isVertical = true;
  447. break;
  448. }
  449. }
  450. var i, child, childNode;
  451. if (isVertical) {
  452. for(i = 0; i < table.rows.length; i++) {
  453. childNode = table.rows[i];
  454. if (childNode != item) {
  455. child = WebForm_GetElementById(childNode.id + "Items");
  456. if (child) {
  457. Menu_HideItems(child);
  458. }
  459. }
  460. }
  461. }
  462. else {
  463. for(i = 0; i < table.rows[0].cells.length; i++) {
  464. childNode = table.rows[0].cells[i];
  465. if (childNode != item) {
  466. child = WebForm_GetElementById(childNode.id + "Items");
  467. if (child) {
  468. Menu_HideItems(child);
  469. }
  470. }
  471. }
  472. }
  473. Menu_ResetTopMenus(table, table, 0, true);
  474. }
  475. function Menu_ResetTopMenus(table, doNotReset, level, up) {
  476. var i, child, childNode;
  477. if (up && table.id == "") {
  478. var parentTable = table.parentNode.parentNode.parentNode.parentNode;
  479. if (parentTable.tagName.toLowerCase() == "table") {
  480. Menu_ResetTopMenus(parentTable, doNotReset, level + 1, true);
  481. }
  482. }
  483. else {
  484. if (level == 0 && table != doNotReset) {
  485. if (table.rows[0].id) {
  486. for(i = 0; i < table.rows.length; i++) {
  487. childNode = table.rows[i];
  488. child = WebForm_GetElementById(childNode.id + "Items");
  489. if (child) {
  490. Menu_HideItems(child);
  491. }
  492. }
  493. }
  494. else {
  495. for(i = 0; i < table.rows[0].cells.length; i++) {
  496. childNode = table.rows[0].cells[i];
  497. child = WebForm_GetElementById(childNode.id + "Items");
  498. if (child) {
  499. Menu_HideItems(child);
  500. }
  501. }
  502. }
  503. }
  504. else if (level > 0) {
  505. for (i = 0; i < table.rows.length; i++) {
  506. for (var j = 0; j < table.rows[i].cells.length; j++) {
  507. var subTable = table.rows[i].cells[j].firstChild;
  508. if (subTable && subTable.tagName.toLowerCase() == "table") {
  509. Menu_ResetTopMenus(subTable, doNotReset, level - 1, false);
  510. }
  511. }
  512. }
  513. }
  514. }
  515. }
  516. function Menu_RestoreInterval() {
  517. if (__menuInterval && __rootMenuItem) {
  518. Menu_ClearInterval();
  519. __menuInterval = window.setInterval("Menu_HideItems()", __disappearAfter);
  520. }
  521. }
  522. function Menu_SetRoot(item) {
  523. var newRoot = Menu_FindMenu(item);
  524. if (newRoot) {
  525. if (__rootMenuItem && __rootMenuItem != newRoot) {
  526. Menu_HideItems();
  527. }
  528. __rootMenuItem = newRoot;
  529. }
  530. }
  531. function Menu_Unhover(item) {
  532. var node = (item.tagName.toLowerCase() == "td") ?
  533. item:
  534. item.cells[0];
  535. var nodeTable = WebForm_GetElementByTagName(node, "table");
  536. if (nodeTable.hoverClass) {
  537. WebForm_RemoveClassName(nodeTable, nodeTable.hoverClass);
  538. }
  539. node = nodeTable.rows[0].cells[0].childNodes[0];
  540. if (node.hoverHyperLinkClass) {
  541. WebForm_RemoveClassName(node, node.hoverHyperLinkClass);
  542. }
  543. Menu_Collapse(node);
  544. }
  545. function PopOut_Clip(element, y, height) {
  546. if (element && element.style) {
  547. element.style.clip = "rect(" + y + "px auto " + (y + height) + "px auto)";
  548. element.style.overflow = "hidden";
  549. }
  550. }
  551. function PopOut_Down(scroller) {
  552. Menu_ClearInterval();
  553. var panel;
  554. if (scroller) {
  555. panel = scroller.parentNode
  556. }
  557. else {
  558. panel = __scrollPanel;
  559. }
  560. if (panel && ((panel.offset + panel.clippedHeight) < panel.physicalHeight)) {
  561. PopOut_Scroll(panel, 2)
  562. __scrollPanel = panel;
  563. PopOut_ShowScrollers(panel);
  564. PopOut_Stop();
  565. __scrollPanel.interval = window.setInterval("PopOut_Down()", 8);
  566. }
  567. else {
  568. PopOut_ShowScrollers(panel);
  569. }
  570. }
  571. function PopOut_Hide(panelId) {
  572. var panel = WebForm_GetElementById(panelId);
  573. if (panel && panel.tagName.toLowerCase() == "div") {
  574. panel.style.visibility = "hidden";
  575. panel.style.display = "none";
  576. panel.offset = 0;
  577. panel.scrollTop = 0;
  578. var table = WebForm_GetElementByTagName(panel, "TABLE");
  579. if (table) {
  580. WebForm_SetElementY(table, 0);
  581. }
  582. if (window.navigator && window.navigator.appName == "Microsoft Internet Explorer" &&
  583. !window.opera) {
  584. var childFrameId = panel.id + "_MenuIFrame";
  585. var childFrame = WebForm_GetElementById(childFrameId);
  586. if (childFrame) {
  587. childFrame.style.display = "none";
  588. }
  589. }
  590. }
  591. }
  592. function PopOut_HideScrollers(panel) {
  593. if (panel && panel.style) {
  594. var up = WebForm_GetElementById(panel.id + "Up");
  595. var dn = WebForm_GetElementById(panel.id + "Dn");
  596. if (up) {
  597. up.style.visibility = "hidden";
  598. up.style.display = "none";
  599. }
  600. if (dn) {
  601. dn.style.visibility = "hidden";
  602. dn.style.display = "none";
  603. }
  604. }
  605. }
  606. function PopOut_Position(panel, hideScrollers) {
  607. if (window.opera) {
  608. panel.parentNode.removeChild(panel);
  609. document.forms[0].appendChild(panel);
  610. }
  611. var rel = WebForm_GetElementById(panel.rel);
  612. var relTable = WebForm_GetElementByTagName(rel, "TABLE");
  613. var relCoordinates = WebForm_GetElementPosition(relTable ? relTable : rel);
  614. var panelCoordinates = WebForm_GetElementPosition(panel);
  615. var panelHeight = ((typeof(panel.physicalHeight) != "undefined") && (panel.physicalHeight != null)) ?
  616. panel.physicalHeight :
  617. panelCoordinates.height;
  618. panel.physicalHeight = panelHeight;
  619. var panelParentCoordinates;
  620. if (panel.offsetParent) {
  621. panelParentCoordinates = WebForm_GetElementPosition(panel.offsetParent);
  622. }
  623. else {
  624. panelParentCoordinates = new Object();
  625. panelParentCoordinates.x = 0;
  626. panelParentCoordinates.y = 0;
  627. }
  628. var overflowElement = WebForm_GetElementById("__overFlowElement");
  629. if (!overflowElement) {
  630. overflowElement = document.createElement("img");
  631. overflowElement.id="__overFlowElement";
  632. WebForm_SetElementWidth(overflowElement, 1);
  633. document.body.appendChild(overflowElement);
  634. }
  635. WebForm_SetElementHeight(overflowElement, panelHeight + relCoordinates.y + parseInt(panel.y ? panel.y : 0));
  636. overflowElement.style.visibility = "visible";
  637. overflowElement.style.display = "inline";
  638. var clientHeight = 0;
  639. var clientWidth = 0;
  640. if (window.innerHeight) {
  641. clientHeight = window.innerHeight;
  642. clientWidth = window.innerWidth;
  643. }
  644. else if (document.documentElement && document.documentElement.clientHeight) {
  645. clientHeight = document.documentElement.clientHeight;
  646. clientWidth = document.documentElement.clientWidth;
  647. }
  648. else if (document.body && document.body.clientHeight) {
  649. clientHeight = document.body.clientHeight;
  650. clientWidth = document.body.clientWidth;
  651. }
  652. var scrollTop = 0;
  653. var scrollLeft = 0;
  654. if (typeof(window.pageYOffset) != "undefined") {
  655. scrollTop = window.pageYOffset;
  656. scrollLeft = window.pageXOffset;
  657. }
  658. else if (document.documentElement && (typeof(document.documentElement.scrollTop) != "undefined")) {
  659. scrollTop = document.documentElement.scrollTop;
  660. scrollLeft = document.documentElement.scrollLeft;
  661. }
  662. else if (document.body && (typeof(document.body.scrollTop) != "undefined")) {
  663. scrollTop = document.body.scrollTop;
  664. scrollLeft = document.body.scrollLeft;
  665. }
  666. overflowElement.style.visibility = "hidden";
  667. overflowElement.style.display = "none";
  668. var bottomWindowBorder = clientHeight + scrollTop;
  669. var rightWindowBorder = clientWidth + scrollLeft;
  670. var position = panel.pos;
  671. if ((typeof(position) == "undefined") || (position == null) || (position == "")) {
  672. position = (WebForm_GetElementDir(rel) == "rtl" ? "middleleft" : "middleright");
  673. }
  674. position = position.toLowerCase();
  675. var y = relCoordinates.y + parseInt(panel.y ? panel.y : 0) - panelParentCoordinates.y;
  676. var borderParent = (rel && rel.parentNode && rel.parentNode.parentNode && rel.parentNode.parentNode.parentNode
  677. && rel.parentNode.parentNode.parentNode.tagName.toLowerCase() == "div") ?
  678. rel.parentNode.parentNode.parentNode : null;
  679. WebForm_SetElementY(panel, y);
  680. PopOut_SetPanelHeight(panel, panelHeight, true);
  681. var clip = false;
  682. var overflow;
  683. if (position.indexOf("top") != -1) {
  684. y -= panelHeight;
  685. WebForm_SetElementY(panel, y);
  686. if (y < -panelParentCoordinates.y) {
  687. y = -panelParentCoordinates.y;
  688. WebForm_SetElementY(panel, y);
  689. if (panelHeight > clientHeight - 2) {
  690. clip = true;
  691. PopOut_SetPanelHeight(panel, clientHeight - 2);
  692. }
  693. }
  694. }
  695. else {
  696. if (position.indexOf("bottom") != -1) {
  697. y += relCoordinates.height;
  698. WebForm_SetElementY(panel, y);
  699. }
  700. overflow = y + panelParentCoordinates.y + panelHeight - bottomWindowBorder;
  701. if (overflow > 0) {
  702. y -= overflow;
  703. WebForm_SetElementY(panel, y);
  704. if (y < -panelParentCoordinates.y) {
  705. y = 2 - panelParentCoordinates.y + scrollTop;
  706. WebForm_SetElementY(panel, y);
  707. clip = true;
  708. PopOut_SetPanelHeight(panel, clientHeight - 2);
  709. }
  710. }
  711. }
  712. if (!clip) {
  713. PopOut_SetPanelHeight(panel, panel.clippedHeight, true);
  714. }
  715. var panelParentOffsetY = 0;
  716. if (panel.offsetParent) {
  717. panelParentOffsetY = WebForm_GetElementPosition(panel.offsetParent).y;
  718. }
  719. var panelY = ((typeof(panel.originY) != "undefined") && (panel.originY != null)) ?
  720. panel.originY :
  721. y - panelParentOffsetY;
  722. panel.originY = panelY;
  723. if (!hideScrollers) {
  724. PopOut_ShowScrollers(panel);
  725. }
  726. else {
  727. PopOut_HideScrollers(panel);
  728. }
  729. var x = relCoordinates.x + parseInt(panel.x ? panel.x : 0) - panelParentCoordinates.x;
  730. if (borderParent && borderParent.clientLeft) {
  731. x += 2 * borderParent.clientLeft;
  732. }
  733. WebForm_SetElementX(panel, x);
  734. if (position.indexOf("left") != -1) {
  735. x -= panelCoordinates.width;
  736. WebForm_SetElementX(panel, x);
  737. if (x < -panelParentCoordinates.x) {
  738. WebForm_SetElementX(panel, -panelParentCoordinates.x);
  739. }
  740. }
  741. else {
  742. if (position.indexOf("right") != -1) {
  743. x += relCoordinates.width;
  744. WebForm_SetElementX(panel, x);
  745. }
  746. overflow = x + panelParentCoordinates.x + panelCoordinates.width - rightWindowBorder;
  747. if (overflow > 0) {
  748. if (position.indexOf("bottom") == -1 && relCoordinates.x > panelCoordinates.width) {
  749. x -= relCoordinates.width + panelCoordinates.width;
  750. }
  751. else {
  752. x -= overflow;
  753. }
  754. WebForm_SetElementX(panel, x);
  755. if (x < -panelParentCoordinates.x) {
  756. WebForm_SetElementX(panel, -panelParentCoordinates.x);
  757. }
  758. }
  759. }
  760. }
  761. function PopOut_Scroll(panel, offsetDelta) {
  762. var table = WebForm_GetElementByTagName(panel, "TABLE");
  763. if (!table) return;
  764. table.style.position = "relative";
  765. var tableY = (table.style.top ? parseInt(table.style.top) : 0);
  766. panel.offset += offsetDelta;
  767. WebForm_SetElementY(table, tableY - offsetDelta);
  768. }
  769. function PopOut_SetPanelHeight(element, height, doNotClip) {
  770. if (element && element.style) {
  771. var size = WebForm_GetElementPosition(element);
  772. element.physicalWidth = size.width;
  773. element.clippedHeight = height;
  774. WebForm_SetElementHeight(element, height - (element.clientTop ? (2 * element.clientTop) : 0));
  775. if (doNotClip && element.style) {
  776. element.style.clip = "rect(auto auto auto auto)";
  777. }
  778. else {
  779. PopOut_Clip(element, 0, height);
  780. }
  781. }
  782. }
  783. function PopOut_Show(panelId, hideScrollers, data) {
  784. var panel = WebForm_GetElementById(panelId);
  785. if (panel && panel.tagName.toLowerCase() == "div") {
  786. panel.style.visibility = "visible";
  787. panel.style.display = "inline";
  788. if (!panel.offset || hideScrollers) {
  789. panel.scrollTop = 0;
  790. panel.offset = 0;
  791. var table = WebForm_GetElementByTagName(panel, "TABLE");
  792. if (table) {
  793. WebForm_SetElementY(table, 0);
  794. }
  795. }
  796. PopOut_Position(panel, hideScrollers);
  797. var z = 1;
  798. var isIE = window.navigator && window.navigator.appName == "Microsoft Internet Explorer" && !window.opera;
  799. if (isIE && data) {
  800. var childFrameId = panel.id + "_MenuIFrame";
  801. var childFrame = WebForm_GetElementById(childFrameId);
  802. var parent = panel.offsetParent;
  803. if (!childFrame) {
  804. childFrame = document.createElement("iframe");
  805. childFrame.id = childFrameId;
  806. childFrame.src = (data.iframeUrl ? data.iframeUrl : "about:blank");
  807. childFrame.style.position = "absolute";
  808. childFrame.style.display = "none";
  809. childFrame.scrolling = "no";
  810. childFrame.frameBorder = "0";
  811. if (parent.tagName.toLowerCase() == "html") {
  812. document.body.appendChild(childFrame);
  813. }
  814. else {
  815. parent.appendChild(childFrame);
  816. }
  817. }
  818. var pos = WebForm_GetElementPosition(panel);
  819. var parentPos = WebForm_GetElementPosition(parent);
  820. WebForm_SetElementX(childFrame, pos.x - parentPos.x);
  821. WebForm_SetElementY(childFrame, pos.y - parentPos.y);
  822. WebForm_SetElementWidth(childFrame, pos.width);
  823. WebForm_SetElementHeight(childFrame, pos.height);
  824. childFrame.style.display = "block";
  825. if (panel.currentStyle && panel.currentStyle.zIndex && panel.currentStyle.zIndex != "auto") {
  826. z = panel.currentStyle.zIndex;
  827. }
  828. else if (panel.style.zIndex) {
  829. z = panel.style.zIndex;
  830. }
  831. }
  832. panel.style.zIndex = z;
  833. }
  834. }
  835. function PopOut_ShowScrollers(panel) {
  836. if (panel && panel.style) {
  837. var up = WebForm_GetElementById(panel.id + "Up");
  838. var dn = WebForm_GetElementById(panel.id + "Dn");
  839. var cnt = 0;
  840. if (up && dn) {
  841. if (panel.offset && panel.offset > 0) {
  842. up.style.visibility = "visible";
  843. up.style.display = "inline";
  844. cnt++;
  845. if (panel.clientWidth) {
  846. WebForm_SetElementWidth(up, panel.clientWidth
  847. - (up.clientLeft ? (2 * up.clientLeft) : 0));
  848. }
  849. WebForm_SetElementY(up, 0);
  850. }
  851. else {
  852. up.style.visibility = "hidden";
  853. up.style.display = "none";
  854. }
  855. if (panel.offset + panel.clippedHeight + 2 <= panel.physicalHeight) {
  856. dn.style.visibility = "visible";
  857. dn.style.display = "inline";
  858. cnt++;
  859. if (panel.clientWidth) {
  860. WebForm_SetElementWidth(dn, panel.clientWidth
  861. - (dn.clientLeft ? (2 * dn.clientLeft) : 0));
  862. }
  863. WebForm_SetElementY(dn, panel.clippedHeight - WebForm_GetElementPosition(dn).height
  864. - (panel.clientTop ? (2 * panel.clientTop) : 0));
  865. }
  866. else {
  867. dn.style.visibility = "hidden";
  868. dn.style.display = "none";
  869. }
  870. if (cnt == 0) {
  871. panel.style.clip = "rect(auto auto auto auto)";
  872. }
  873. }
  874. }
  875. }
  876. function PopOut_Stop() {
  877. if (__scrollPanel && __scrollPanel.interval) {
  878. window.clearInterval(__scrollPanel.interval);
  879. }
  880. Menu_RestoreInterval();
  881. }
  882. function PopOut_Up(scroller) {
  883. Menu_ClearInterval();
  884. var panel;
  885. if (scroller) {
  886. panel = scroller.parentNode
  887. }
  888. else {
  889. panel = __scrollPanel;
  890. }
  891. if (panel && panel.offset && panel.offset > 0) {
  892. PopOut_Scroll(panel, -2);
  893. __scrollPanel = panel;
  894. PopOut_ShowScrollers(panel);
  895. PopOut_Stop();
  896. __scrollPanel.interval = window.setInterval("PopOut_Up()", 8);
  897. }
  898. }