summaryrefslogtreecommitdiffstats
path: root/samples/TestAzureAD/Scripts/WebForms/Menu.js
diff options
context:
space:
mode:
authorGirish Bablani <girishb@microsoft.com>2013-04-16 18:53:13 -0700
committerGirish Bablani <girishb@microsoft.com>2013-04-16 18:53:13 -0700
commit789f14adf18e65ab416b60341bfbecc6577a1c37 (patch)
tree3f140b5f1679cb2857cd65a7d14d2c0ec28f2fca /samples/TestAzureAD/Scripts/WebForms/Menu.js
parent9e33a9e89ba1973cb3bf923e1303105047094d9c (diff)
downloadDotNetOpenAuth-789f14adf18e65ab416b60341bfbecc6577a1c37.zip
DotNetOpenAuth-789f14adf18e65ab416b60341bfbecc6577a1c37.tar.gz
DotNetOpenAuth-789f14adf18e65ab416b60341bfbecc6577a1c37.tar.bz2
Enabled AzureAD integration and added TestAzureAD sample app
Diffstat (limited to 'samples/TestAzureAD/Scripts/WebForms/Menu.js')
-rw-r--r--samples/TestAzureAD/Scripts/WebForms/Menu.js898
1 files changed, 898 insertions, 0 deletions
diff --git a/samples/TestAzureAD/Scripts/WebForms/Menu.js b/samples/TestAzureAD/Scripts/WebForms/Menu.js
new file mode 100644
index 0000000..27a78fa
--- /dev/null
+++ b/samples/TestAzureAD/Scripts/WebForms/Menu.js
@@ -0,0 +1,898 @@
+//CdnPath=http://ajax.aspnetcdn.com/ajax/4.5/6/Menu.js
+var __rootMenuItem;
+var __menuInterval;
+var __scrollPanel;
+var __disappearAfter = 500;
+function Menu_ClearInterval() {
+ if (__menuInterval) {
+ window.clearInterval(__menuInterval);
+ }
+}
+function Menu_Collapse(item) {
+ Menu_SetRoot(item);
+ if (__rootMenuItem) {
+ Menu_ClearInterval();
+ if (__disappearAfter >= 0) {
+ __menuInterval = window.setInterval("Menu_HideItems()", __disappearAfter);
+ }
+ }
+}
+function Menu_Expand(item, horizontalOffset, verticalOffset, hideScrollers) {
+ Menu_ClearInterval();
+ var tr = item.parentNode.parentNode.parentNode.parentNode.parentNode;
+ var horizontal = true;
+ if (!tr.id) {
+ horizontal = false;
+ tr = tr.parentNode;
+ }
+ var child = Menu_FindSubMenu(item);
+ if (child) {
+ var data = Menu_GetData(item);
+ if (!data) {
+ return null;
+ }
+ child.rel = tr.id;
+ child.x = horizontalOffset;
+ child.y = verticalOffset;
+ if (horizontal) child.pos = "bottom";
+ PopOut_Show(child.id, hideScrollers, data);
+ }
+ Menu_SetRoot(item);
+ if (child) {
+ if (!document.body.__oldOnClick && document.body.onclick) {
+ document.body.__oldOnClick = document.body.onclick;
+ }
+ if (__rootMenuItem) {
+ document.body.onclick = Menu_HideItems;
+ }
+ }
+ Menu_ResetSiblings(tr);
+ return child;
+}
+function Menu_FindMenu(item) {
+ if (item && item.menu) return item.menu;
+ var tr = item.parentNode.parentNode.parentNode.parentNode.parentNode;
+ if (!tr.id) {
+ tr = tr.parentNode;
+ }
+ for (var i = tr.id.length - 1; i >= 0; i--) {
+ if (tr.id.charAt(i) < '0' || tr.id.charAt(i) > '9') {
+ var menu = WebForm_GetElementById(tr.id.substr(0, i));
+ if (menu) {
+ item.menu = menu;
+ return menu;
+ }
+ }
+ }
+ return null;
+}
+function Menu_FindNext(item) {
+ var a = WebForm_GetElementByTagName(item, "A");
+ var parent = Menu_FindParentContainer(item);
+ var first = null;
+ if (parent) {
+ var links = WebForm_GetElementsByTagName(parent, "A");
+ var match = false;
+ for (var i = 0; i < links.length; i++) {
+ var link = links[i];
+ if (Menu_IsSelectable(link)) {
+ if (Menu_FindParentContainer(link) == parent) {
+ if (match) {
+ return link;
+ }
+ else if (!first) {
+ first = link;
+ }
+ }
+ if (!match && link == a) {
+ match = true;
+ }
+ }
+ }
+ }
+ return first;
+}
+function Menu_FindParentContainer(item) {
+ if (item.menu_ParentContainerCache) return item.menu_ParentContainerCache;
+ var a = (item.tagName.toLowerCase() == "a") ? item : WebForm_GetElementByTagName(item, "A");
+ var menu = Menu_FindMenu(a);
+ if (menu) {
+ var parent = item;
+ while (parent && parent.tagName &&
+ parent.id != menu.id &&
+ parent.tagName.toLowerCase() != "div") {
+ parent = parent.parentNode;
+ }
+ item.menu_ParentContainerCache = parent;
+ return parent;
+ }
+}
+function Menu_FindParentItem(item) {
+ var parentContainer = Menu_FindParentContainer(item);
+ var parentContainerID = parentContainer.id;
+ var len = parentContainerID.length;
+ if (parentContainerID && parentContainerID.substr(len - 5) == "Items") {
+ var parentItemID = parentContainerID.substr(0, len - 5);
+ return WebForm_GetElementById(parentItemID);
+ }
+ return null;
+}
+function Menu_FindPrevious(item) {
+ var a = WebForm_GetElementByTagName(item, "A");
+ var parent = Menu_FindParentContainer(item);
+ var last = null;
+ if (parent) {
+ var links = WebForm_GetElementsByTagName(parent, "A");
+ for (var i = 0; i < links.length; i++) {
+ var link = links[i];
+ if (Menu_IsSelectable(link)) {
+ if (link == a && last) {
+ return last;
+ }
+ if (Menu_FindParentContainer(link) == parent) {
+ last = link;
+ }
+ }
+ }
+ }
+ return last;
+}
+function Menu_FindSubMenu(item) {
+ var tr = item.parentNode.parentNode.parentNode.parentNode.parentNode;
+ if (!tr.id) {
+ tr=tr.parentNode;
+ }
+ return WebForm_GetElementById(tr.id + "Items");
+}
+function Menu_Focus(item) {
+ if (item && item.focus) {
+ var pos = WebForm_GetElementPosition(item);
+ var parentContainer = Menu_FindParentContainer(item);
+ if (!parentContainer.offset) {
+ parentContainer.offset = 0;
+ }
+ var posParent = WebForm_GetElementPosition(parentContainer);
+ var delta;
+ if (pos.y + pos.height > posParent.y + parentContainer.offset + parentContainer.clippedHeight) {
+ delta = pos.y + pos.height - posParent.y - parentContainer.offset - parentContainer.clippedHeight;
+ PopOut_Scroll(parentContainer, delta);
+ }
+ else if (pos.y < posParent.y + parentContainer.offset) {
+ delta = posParent.y + parentContainer.offset - pos.y;
+ PopOut_Scroll(parentContainer, -delta);
+ }
+ PopOut_HideScrollers(parentContainer);
+ item.focus();
+ }
+}
+function Menu_GetData(item) {
+ if (!item.data) {
+ var a = (item.tagName.toLowerCase() == "a" ? item : WebForm_GetElementByTagName(item, "a"));
+ var menu = Menu_FindMenu(a);
+ try {
+ item.data = eval(menu.id + "_Data");
+ }
+ catch(e) {}
+ }
+ return item.data;
+}
+function Menu_HideItems(items) {
+ if (document.body.__oldOnClick) {
+ document.body.onclick = document.body.__oldOnClick;
+ document.body.__oldOnClick = null;
+ }
+ Menu_ClearInterval();
+ if (!items || ((typeof(items.tagName) == "undefined") && (items instanceof Event))) {
+ items = __rootMenuItem;
+ }
+ var table = items;
+ if ((typeof(table) == "undefined") || (table == null) || !table.tagName || (table.tagName.toLowerCase() != "table")) {
+ table = WebForm_GetElementByTagName(table, "TABLE");
+ }
+ if ((typeof(table) == "undefined") || (table == null) || !table.tagName || (table.tagName.toLowerCase() != "table")) {
+ return;
+ }
+ var rows = table.rows ? table.rows : table.firstChild.rows;
+ var isVertical = false;
+ for (var r = 0; r < rows.length; r++) {
+ if (rows[r].id) {
+ isVertical = true;
+ break;
+ }
+ }
+ var i, child, nextLevel;
+ if (isVertical) {
+ for(i = 0; i < rows.length; i++) {
+ if (rows[i].id) {
+ child = WebForm_GetElementById(rows[i].id + "Items");
+ if (child) {
+ Menu_HideItems(child);
+ }
+ }
+ else if (rows[i].cells[0]) {
+ nextLevel = WebForm_GetElementByTagName(rows[i].cells[0], "TABLE");
+ if (nextLevel) {
+ Menu_HideItems(nextLevel);
+ }
+ }
+ }
+ }
+ else if (rows[0]) {
+ for(i = 0; i < rows[0].cells.length; i++) {
+ if (rows[0].cells[i].id) {
+ child = WebForm_GetElementById(rows[0].cells[i].id + "Items");
+ if (child) {
+ Menu_HideItems(child);
+ }
+ }
+ else {
+ nextLevel = WebForm_GetElementByTagName(rows[0].cells[i], "TABLE");
+ if (nextLevel) {
+ Menu_HideItems(rows[0].cells[i].firstChild);
+ }
+ }
+ }
+ }
+ if (items && items.id) {
+ PopOut_Hide(items.id);
+ }
+}
+function Menu_HoverDisabled(item) {
+ var node = (item.tagName.toLowerCase() == "td") ?
+ item:
+ item.cells[0];
+ var data = Menu_GetData(item);
+ if (!data) return;
+ node = WebForm_GetElementByTagName(node, "table").rows[0].cells[0].childNodes[0];
+ if (data.disappearAfter >= 200) {
+ __disappearAfter = data.disappearAfter;
+ }
+ Menu_Expand(node, data.horizontalOffset, data.verticalOffset);
+}
+function Menu_HoverDynamic(item) {
+ var node = (item.tagName.toLowerCase() == "td") ?
+ item:
+ item.cells[0];
+ var data = Menu_GetData(item);
+ if (!data) return;
+ var nodeTable = WebForm_GetElementByTagName(node, "table");
+ if (data.hoverClass) {
+ nodeTable.hoverClass = data.hoverClass;
+ WebForm_AppendToClassName(nodeTable, data.hoverClass);
+ }
+ node = nodeTable.rows[0].cells[0].childNodes[0];
+ if (data.hoverHyperLinkClass) {
+ node.hoverHyperLinkClass = data.hoverHyperLinkClass;
+ WebForm_AppendToClassName(node, data.hoverHyperLinkClass);
+ }
+ if (data.disappearAfter >= 200) {
+ __disappearAfter = data.disappearAfter;
+ }
+ Menu_Expand(node, data.horizontalOffset, data.verticalOffset);
+}
+function Menu_HoverRoot(item) {
+ var node = (item.tagName.toLowerCase() == "td") ?
+ item:
+ item.cells[0];
+ var data = Menu_GetData(item);
+ if (!data) {
+ return null;
+ }
+ var nodeTable = WebForm_GetElementByTagName(node, "table");
+ if (data.staticHoverClass) {
+ nodeTable.hoverClass = data.staticHoverClass;
+ WebForm_AppendToClassName(nodeTable, data.staticHoverClass);
+ }
+ node = nodeTable.rows[0].cells[0].childNodes[0];
+ if (data.staticHoverHyperLinkClass) {
+ node.hoverHyperLinkClass = data.staticHoverHyperLinkClass;
+ WebForm_AppendToClassName(node, data.staticHoverHyperLinkClass);
+ }
+ return node;
+}
+function Menu_HoverStatic(item) {
+ var node = Menu_HoverRoot(item);
+ var data = Menu_GetData(item);
+ if (!data) return;
+ __disappearAfter = data.disappearAfter;
+ Menu_Expand(node, data.horizontalOffset, data.verticalOffset);
+}
+function Menu_IsHorizontal(item) {
+ if (item) {
+ var a = ((item.tagName && (item.tagName.toLowerCase == "a")) ? item : WebForm_GetElementByTagName(item, "A"));
+ if (!a) {
+ return false;
+ }
+ var td = a.parentNode.parentNode.parentNode.parentNode.parentNode;
+ if (td.id) {
+ return true;
+ }
+ }
+ return false;
+}
+function Menu_IsSelectable(link) {
+ return (link && link.href)
+}
+function Menu_Key(item) {
+ var event;
+ if (window.event) {
+ event = window.event;
+ }
+ else {
+ event = item;
+ item = event.currentTarget;
+ }
+ var key = (event ? event.keyCode : -1);
+ var data = Menu_GetData(item);
+ if (!data) return;
+ var horizontal = Menu_IsHorizontal(item);
+ var a = WebForm_GetElementByTagName(item, "A");
+ var nextItem, parentItem, previousItem;
+ if ((!horizontal && key == 38) || (horizontal && key == 37)) {
+ previousItem = Menu_FindPrevious(item);
+ while (previousItem && previousItem.disabled) {
+ previousItem = Menu_FindPrevious(previousItem);
+ }
+ if (previousItem) {
+ Menu_Focus(previousItem);
+ Menu_Expand(previousItem, data.horizontalOffset, data.verticalOffset, true);
+ event.cancelBubble = true;
+ if (event.stopPropagation) event.stopPropagation();
+ return;
+ }
+ }
+ if ((!horizontal && key == 40) || (horizontal && key == 39)) {
+ if (horizontal) {
+ var subMenu = Menu_FindSubMenu(a);
+ if (subMenu && subMenu.style && subMenu.style.visibility &&
+ subMenu.style.visibility.toLowerCase() == "hidden") {
+ Menu_Expand(a, data.horizontalOffset, data.verticalOffset, true);
+ event.cancelBubble = true;
+ if (event.stopPropagation) event.stopPropagation();
+ return;
+ }
+ }
+ nextItem = Menu_FindNext(item);
+ while (nextItem && nextItem.disabled) {
+ nextItem = Menu_FindNext(nextItem);
+ }
+ if (nextItem) {
+ Menu_Focus(nextItem);
+ Menu_Expand(nextItem, data.horizontalOffset, data.verticalOffset, true);
+ event.cancelBubble = true;
+ if (event.stopPropagation) event.stopPropagation();
+ return;
+ }
+ }
+ if ((!horizontal && key == 39) || (horizontal && key == 40)) {
+ var children = Menu_Expand(a, data.horizontalOffset, data.verticalOffset, true);
+ if (children) {
+ var firstChild;
+ children = WebForm_GetElementsByTagName(children, "A");
+ for (var i = 0; i < children.length; i++) {
+ if (!children[i].disabled && Menu_IsSelectable(children[i])) {
+ firstChild = children[i];
+ break;
+ }
+ }
+ if (firstChild) {
+ Menu_Focus(firstChild);
+ Menu_Expand(firstChild, data.horizontalOffset, data.verticalOffset, true);
+ event.cancelBubble = true;
+ if (event.stopPropagation) event.stopPropagation();
+ return;
+ }
+ }
+ else {
+ parentItem = Menu_FindParentItem(item);
+ while (parentItem && !Menu_IsHorizontal(parentItem)) {
+ parentItem = Menu_FindParentItem(parentItem);
+ }
+ if (parentItem) {
+ nextItem = Menu_FindNext(parentItem);
+ while (nextItem && nextItem.disabled) {
+ nextItem = Menu_FindNext(nextItem);
+ }
+ if (nextItem) {
+ Menu_Focus(nextItem);
+ Menu_Expand(nextItem, data.horizontalOffset, data.verticalOffset, true);
+ event.cancelBubble = true;
+ if (event.stopPropagation) event.stopPropagation();
+ return;
+ }
+ }
+ }
+ }
+ if ((!horizontal && key == 37) || (horizontal && key == 38)) {
+ parentItem = Menu_FindParentItem(item);
+ if (parentItem) {
+ if (Menu_IsHorizontal(parentItem)) {
+ previousItem = Menu_FindPrevious(parentItem);
+ while (previousItem && previousItem.disabled) {
+ previousItem = Menu_FindPrevious(previousItem);
+ }
+ if (previousItem) {
+ Menu_Focus(previousItem);
+ Menu_Expand(previousItem, data.horizontalOffset, data.verticalOffset, true);
+ event.cancelBubble = true;
+ if (event.stopPropagation) event.stopPropagation();
+ return;
+ }
+ }
+ var parentA = WebForm_GetElementByTagName(parentItem, "A");
+ if (parentA) {
+ Menu_Focus(parentA);
+ }
+ Menu_ResetSiblings(parentItem);
+ event.cancelBubble = true;
+ if (event.stopPropagation) event.stopPropagation();
+ return;
+ }
+ }
+ if (key == 27) {
+ Menu_HideItems();
+ event.cancelBubble = true;
+ if (event.stopPropagation) event.stopPropagation();
+ return;
+ }
+}
+function Menu_ResetSiblings(item) {
+ var table = (item.tagName.toLowerCase() == "td") ?
+ item.parentNode.parentNode.parentNode :
+ item.parentNode.parentNode;
+ var isVertical = false;
+ for (var r = 0; r < table.rows.length; r++) {
+ if (table.rows[r].id) {
+ isVertical = true;
+ break;
+ }
+ }
+ var i, child, childNode;
+ if (isVertical) {
+ for(i = 0; i < table.rows.length; i++) {
+ childNode = table.rows[i];
+ if (childNode != item) {
+ child = WebForm_GetElementById(childNode.id + "Items");
+ if (child) {
+ Menu_HideItems(child);
+ }
+ }
+ }
+ }
+ else {
+ for(i = 0; i < table.rows[0].cells.length; i++) {
+ childNode = table.rows[0].cells[i];
+ if (childNode != item) {
+ child = WebForm_GetElementById(childNode.id + "Items");
+ if (child) {
+ Menu_HideItems(child);
+ }
+ }
+ }
+ }
+ Menu_ResetTopMenus(table, table, 0, true);
+}
+function Menu_ResetTopMenus(table, doNotReset, level, up) {
+ var i, child, childNode;
+ if (up && table.id == "") {
+ var parentTable = table.parentNode.parentNode.parentNode.parentNode;
+ if (parentTable.tagName.toLowerCase() == "table") {
+ Menu_ResetTopMenus(parentTable, doNotReset, level + 1, true);
+ }
+ }
+ else {
+ if (level == 0 && table != doNotReset) {
+ if (table.rows[0].id) {
+ for(i = 0; i < table.rows.length; i++) {
+ childNode = table.rows[i];
+ child = WebForm_GetElementById(childNode.id + "Items");
+ if (child) {
+ Menu_HideItems(child);
+ }
+ }
+ }
+ else {
+ for(i = 0; i < table.rows[0].cells.length; i++) {
+ childNode = table.rows[0].cells[i];
+ child = WebForm_GetElementById(childNode.id + "Items");
+ if (child) {
+ Menu_HideItems(child);
+ }
+ }
+ }
+ }
+ else if (level > 0) {
+ for (i = 0; i < table.rows.length; i++) {
+ for (var j = 0; j < table.rows[i].cells.length; j++) {
+ var subTable = table.rows[i].cells[j].firstChild;
+ if (subTable && subTable.tagName.toLowerCase() == "table") {
+ Menu_ResetTopMenus(subTable, doNotReset, level - 1, false);
+ }
+ }
+ }
+ }
+ }
+}
+function Menu_RestoreInterval() {
+ if (__menuInterval && __rootMenuItem) {
+ Menu_ClearInterval();
+ __menuInterval = window.setInterval("Menu_HideItems()", __disappearAfter);
+ }
+}
+function Menu_SetRoot(item) {
+ var newRoot = Menu_FindMenu(item);
+ if (newRoot) {
+ if (__rootMenuItem && __rootMenuItem != newRoot) {
+ Menu_HideItems();
+ }
+ __rootMenuItem = newRoot;
+ }
+}
+function Menu_Unhover(item) {
+ var node = (item.tagName.toLowerCase() == "td") ?
+ item:
+ item.cells[0];
+ var nodeTable = WebForm_GetElementByTagName(node, "table");
+ if (nodeTable.hoverClass) {
+ WebForm_RemoveClassName(nodeTable, nodeTable.hoverClass);
+ }
+ node = nodeTable.rows[0].cells[0].childNodes[0];
+ if (node.hoverHyperLinkClass) {
+ WebForm_RemoveClassName(node, node.hoverHyperLinkClass);
+ }
+ Menu_Collapse(node);
+}
+function PopOut_Clip(element, y, height) {
+ if (element && element.style) {
+ element.style.clip = "rect(" + y + "px auto " + (y + height) + "px auto)";
+ element.style.overflow = "hidden";
+ }
+}
+function PopOut_Down(scroller) {
+ Menu_ClearInterval();
+ var panel;
+ if (scroller) {
+ panel = scroller.parentNode
+ }
+ else {
+ panel = __scrollPanel;
+ }
+ if (panel && ((panel.offset + panel.clippedHeight) < panel.physicalHeight)) {
+ PopOut_Scroll(panel, 2)
+ __scrollPanel = panel;
+ PopOut_ShowScrollers(panel);
+ PopOut_Stop();
+ __scrollPanel.interval = window.setInterval("PopOut_Down()", 8);
+ }
+ else {
+ PopOut_ShowScrollers(panel);
+ }
+}
+function PopOut_Hide(panelId) {
+ var panel = WebForm_GetElementById(panelId);
+ if (panel && panel.tagName.toLowerCase() == "div") {
+ panel.style.visibility = "hidden";
+ panel.style.display = "none";
+ panel.offset = 0;
+ panel.scrollTop = 0;
+ var table = WebForm_GetElementByTagName(panel, "TABLE");
+ if (table) {
+ WebForm_SetElementY(table, 0);
+ }
+ if (window.navigator && window.navigator.appName == "Microsoft Internet Explorer" &&
+ !window.opera) {
+ var childFrameId = panel.id + "_MenuIFrame";
+ var childFrame = WebForm_GetElementById(childFrameId);
+ if (childFrame) {
+ childFrame.style.display = "none";
+ }
+ }
+ }
+}
+function PopOut_HideScrollers(panel) {
+ if (panel && panel.style) {
+ var up = WebForm_GetElementById(panel.id + "Up");
+ var dn = WebForm_GetElementById(panel.id + "Dn");
+ if (up) {
+ up.style.visibility = "hidden";
+ up.style.display = "none";
+ }
+ if (dn) {
+ dn.style.visibility = "hidden";
+ dn.style.display = "none";
+ }
+ }
+}
+function PopOut_Position(panel, hideScrollers) {
+ if (window.opera) {
+ panel.parentNode.removeChild(panel);
+ document.forms[0].appendChild(panel);
+ }
+ var rel = WebForm_GetElementById(panel.rel);
+ var relTable = WebForm_GetElementByTagName(rel, "TABLE");
+ var relCoordinates = WebForm_GetElementPosition(relTable ? relTable : rel);
+ var panelCoordinates = WebForm_GetElementPosition(panel);
+ var panelHeight = ((typeof(panel.physicalHeight) != "undefined") && (panel.physicalHeight != null)) ?
+ panel.physicalHeight :
+ panelCoordinates.height;
+ panel.physicalHeight = panelHeight;
+ var panelParentCoordinates;
+ if (panel.offsetParent) {
+ panelParentCoordinates = WebForm_GetElementPosition(panel.offsetParent);
+ }
+ else {
+ panelParentCoordinates = new Object();
+ panelParentCoordinates.x = 0;
+ panelParentCoordinates.y = 0;
+ }
+ var overflowElement = WebForm_GetElementById("__overFlowElement");
+ if (!overflowElement) {
+ overflowElement = document.createElement("img");
+ overflowElement.id="__overFlowElement";
+ WebForm_SetElementWidth(overflowElement, 1);
+ document.body.appendChild(overflowElement);
+ }
+ WebForm_SetElementHeight(overflowElement, panelHeight + relCoordinates.y + parseInt(panel.y ? panel.y : 0));
+ overflowElement.style.visibility = "visible";
+ overflowElement.style.display = "inline";
+ var clientHeight = 0;
+ var clientWidth = 0;
+ if (window.innerHeight) {
+ clientHeight = window.innerHeight;
+ clientWidth = window.innerWidth;
+ }
+ else if (document.documentElement && document.documentElement.clientHeight) {
+ clientHeight = document.documentElement.clientHeight;
+ clientWidth = document.documentElement.clientWidth;
+ }
+ else if (document.body && document.body.clientHeight) {
+ clientHeight = document.body.clientHeight;
+ clientWidth = document.body.clientWidth;
+ }
+ var scrollTop = 0;
+ var scrollLeft = 0;
+ if (typeof(window.pageYOffset) != "undefined") {
+ scrollTop = window.pageYOffset;
+ scrollLeft = window.pageXOffset;
+ }
+ else if (document.documentElement && (typeof(document.documentElement.scrollTop) != "undefined")) {
+ scrollTop = document.documentElement.scrollTop;
+ scrollLeft = document.documentElement.scrollLeft;
+ }
+ else if (document.body && (typeof(document.body.scrollTop) != "undefined")) {
+ scrollTop = document.body.scrollTop;
+ scrollLeft = document.body.scrollLeft;
+ }
+ overflowElement.style.visibility = "hidden";
+ overflowElement.style.display = "none";
+ var bottomWindowBorder = clientHeight + scrollTop;
+ var rightWindowBorder = clientWidth + scrollLeft;
+ var position = panel.pos;
+ if ((typeof(position) == "undefined") || (position == null) || (position == "")) {
+ position = (WebForm_GetElementDir(rel) == "rtl" ? "middleleft" : "middleright");
+ }
+ position = position.toLowerCase();
+ var y = relCoordinates.y + parseInt(panel.y ? panel.y : 0) - panelParentCoordinates.y;
+ var borderParent = (rel && rel.parentNode && rel.parentNode.parentNode && rel.parentNode.parentNode.parentNode
+ && rel.parentNode.parentNode.parentNode.tagName.toLowerCase() == "div") ?
+ rel.parentNode.parentNode.parentNode : null;
+ WebForm_SetElementY(panel, y);
+ PopOut_SetPanelHeight(panel, panelHeight, true);
+ var clip = false;
+ var overflow;
+ if (position.indexOf("top") != -1) {
+ y -= panelHeight;
+ WebForm_SetElementY(panel, y);
+ if (y < -panelParentCoordinates.y) {
+ y = -panelParentCoordinates.y;
+ WebForm_SetElementY(panel, y);
+ if (panelHeight > clientHeight - 2) {
+ clip = true;
+ PopOut_SetPanelHeight(panel, clientHeight - 2);
+ }
+ }
+ }
+ else {
+ if (position.indexOf("bottom") != -1) {
+ y += relCoordinates.height;
+ WebForm_SetElementY(panel, y);
+ }
+ overflow = y + panelParentCoordinates.y + panelHeight - bottomWindowBorder;
+ if (overflow > 0) {
+ y -= overflow;
+ WebForm_SetElementY(panel, y);
+ if (y < -panelParentCoordinates.y) {
+ y = 2 - panelParentCoordinates.y + scrollTop;
+ WebForm_SetElementY(panel, y);
+ clip = true;
+ PopOut_SetPanelHeight(panel, clientHeight - 2);
+ }
+ }
+ }
+ if (!clip) {
+ PopOut_SetPanelHeight(panel, panel.clippedHeight, true);
+ }
+ var panelParentOffsetY = 0;
+ if (panel.offsetParent) {
+ panelParentOffsetY = WebForm_GetElementPosition(panel.offsetParent).y;
+ }
+ var panelY = ((typeof(panel.originY) != "undefined") && (panel.originY != null)) ?
+ panel.originY :
+ y - panelParentOffsetY;
+ panel.originY = panelY;
+ if (!hideScrollers) {
+ PopOut_ShowScrollers(panel);
+ }
+ else {
+ PopOut_HideScrollers(panel);
+ }
+ var x = relCoordinates.x + parseInt(panel.x ? panel.x : 0) - panelParentCoordinates.x;
+ if (borderParent && borderParent.clientLeft) {
+ x += 2 * borderParent.clientLeft;
+ }
+ WebForm_SetElementX(panel, x);
+ if (position.indexOf("left") != -1) {
+ x -= panelCoordinates.width;
+ WebForm_SetElementX(panel, x);
+ if (x < -panelParentCoordinates.x) {
+ WebForm_SetElementX(panel, -panelParentCoordinates.x);
+ }
+ }
+ else {
+ if (position.indexOf("right") != -1) {
+ x += relCoordinates.width;
+ WebForm_SetElementX(panel, x);
+ }
+ overflow = x + panelParentCoordinates.x + panelCoordinates.width - rightWindowBorder;
+ if (overflow > 0) {
+ if (position.indexOf("bottom") == -1 && relCoordinates.x > panelCoordinates.width) {
+ x -= relCoordinates.width + panelCoordinates.width;
+ }
+ else {
+ x -= overflow;
+ }
+ WebForm_SetElementX(panel, x);
+ if (x < -panelParentCoordinates.x) {
+ WebForm_SetElementX(panel, -panelParentCoordinates.x);
+ }
+ }
+ }
+}
+function PopOut_Scroll(panel, offsetDelta) {
+ var table = WebForm_GetElementByTagName(panel, "TABLE");
+ if (!table) return;
+ table.style.position = "relative";
+ var tableY = (table.style.top ? parseInt(table.style.top) : 0);
+ panel.offset += offsetDelta;
+ WebForm_SetElementY(table, tableY - offsetDelta);
+}
+function PopOut_SetPanelHeight(element, height, doNotClip) {
+ if (element && element.style) {
+ var size = WebForm_GetElementPosition(element);
+ element.physicalWidth = size.width;
+ element.clippedHeight = height;
+ WebForm_SetElementHeight(element, height - (element.clientTop ? (2 * element.clientTop) : 0));
+ if (doNotClip && element.style) {
+ element.style.clip = "rect(auto auto auto auto)";
+ }
+ else {
+ PopOut_Clip(element, 0, height);
+ }
+ }
+}
+function PopOut_Show(panelId, hideScrollers, data) {
+ var panel = WebForm_GetElementById(panelId);
+ if (panel && panel.tagName.toLowerCase() == "div") {
+ panel.style.visibility = "visible";
+ panel.style.display = "inline";
+ if (!panel.offset || hideScrollers) {
+ panel.scrollTop = 0;
+ panel.offset = 0;
+ var table = WebForm_GetElementByTagName(panel, "TABLE");
+ if (table) {
+ WebForm_SetElementY(table, 0);
+ }
+ }
+ PopOut_Position(panel, hideScrollers);
+ var z = 1;
+ var isIE = window.navigator && window.navigator.appName == "Microsoft Internet Explorer" && !window.opera;
+ if (isIE && data) {
+ var childFrameId = panel.id + "_MenuIFrame";
+ var childFrame = WebForm_GetElementById(childFrameId);
+ var parent = panel.offsetParent;
+ if (!childFrame) {
+ childFrame = document.createElement("iframe");
+ childFrame.id = childFrameId;
+ childFrame.src = (data.iframeUrl ? data.iframeUrl : "about:blank");
+ childFrame.style.position = "absolute";
+ childFrame.style.display = "none";
+ childFrame.scrolling = "no";
+ childFrame.frameBorder = "0";
+ if (parent.tagName.toLowerCase() == "html") {
+ document.body.appendChild(childFrame);
+ }
+ else {
+ parent.appendChild(childFrame);
+ }
+ }
+ var pos = WebForm_GetElementPosition(panel);
+ var parentPos = WebForm_GetElementPosition(parent);
+ WebForm_SetElementX(childFrame, pos.x - parentPos.x);
+ WebForm_SetElementY(childFrame, pos.y - parentPos.y);
+ WebForm_SetElementWidth(childFrame, pos.width);
+ WebForm_SetElementHeight(childFrame, pos.height);
+ childFrame.style.display = "block";
+ if (panel.currentStyle && panel.currentStyle.zIndex && panel.currentStyle.zIndex != "auto") {
+ z = panel.currentStyle.zIndex;
+ }
+ else if (panel.style.zIndex) {
+ z = panel.style.zIndex;
+ }
+ }
+ panel.style.zIndex = z;
+ }
+}
+function PopOut_ShowScrollers(panel) {
+ if (panel && panel.style) {
+ var up = WebForm_GetElementById(panel.id + "Up");
+ var dn = WebForm_GetElementById(panel.id + "Dn");
+ var cnt = 0;
+ if (up && dn) {
+ if (panel.offset && panel.offset > 0) {
+ up.style.visibility = "visible";
+ up.style.display = "inline";
+ cnt++;
+ if (panel.clientWidth) {
+ WebForm_SetElementWidth(up, panel.clientWidth
+ - (up.clientLeft ? (2 * up.clientLeft) : 0));
+ }
+ WebForm_SetElementY(up, 0);
+ }
+ else {
+ up.style.visibility = "hidden";
+ up.style.display = "none";
+ }
+ if (panel.offset + panel.clippedHeight + 2 <= panel.physicalHeight) {
+ dn.style.visibility = "visible";
+ dn.style.display = "inline";
+ cnt++;
+ if (panel.clientWidth) {
+ WebForm_SetElementWidth(dn, panel.clientWidth
+ - (dn.clientLeft ? (2 * dn.clientLeft) : 0));
+ }
+ WebForm_SetElementY(dn, panel.clippedHeight - WebForm_GetElementPosition(dn).height
+ - (panel.clientTop ? (2 * panel.clientTop) : 0));
+ }
+ else {
+ dn.style.visibility = "hidden";
+ dn.style.display = "none";
+ }
+ if (cnt == 0) {
+ panel.style.clip = "rect(auto auto auto auto)";
+ }
+ }
+ }
+}
+function PopOut_Stop() {
+ if (__scrollPanel && __scrollPanel.interval) {
+ window.clearInterval(__scrollPanel.interval);
+ }
+ Menu_RestoreInterval();
+}
+function PopOut_Up(scroller) {
+ Menu_ClearInterval();
+ var panel;
+ if (scroller) {
+ panel = scroller.parentNode
+ }
+ else {
+ panel = __scrollPanel;
+ }
+ if (panel && panel.offset && panel.offset > 0) {
+ PopOut_Scroll(panel, -2);
+ __scrollPanel = panel;
+ PopOut_ShowScrollers(panel);
+ PopOut_Stop();
+ __scrollPanel.interval = window.setInterval("PopOut_Up()", 8);
+ }
+}