00001: var __rootMenuItem;
00002: var __menuInterval;
00003: var __scrollPanel;
00004: var __disappearAfter = 500;
00005: function Menu_ClearInterval() {
00006: if (__menuInterval) {
00007: window.clearInterval(__menuInterval);
00008: }
00009: }
00010: function Menu_Collapse(item) {
00011: Menu_SetRoot(item);
00012: if (__rootMenuItem) {
00013: Menu_ClearInterval();
00014: if (__disappearAfter >= 0) {
00015: __menuInterval = window.setInterval("Menu_HideItems()", __disappearAfter);
00016: }
00017: }
00018: }
00019: function Menu_Expand(item, horizontalOffset, verticalOffset, hideScrollers) {
00020: Menu_ClearInterval();
00021: var tr = item.parentNode.parentNode.parentNode.parentNode.parentNode;
00022: var horizontal = true;
00023: if (!tr.id) {
00024: horizontal = false;
00025: tr = tr.parentNode;
00026: }
00027: var child = Menu_FindSubMenu(item);
00028: if (child) {
00029: var data = Menu_GetData(item);
00030: if (!data) {
00031: return null;
00032: }
00033: child.rel = tr.id;
00034: child.x = horizontalOffset;
00035: child.y = verticalOffset;
00036: if (horizontal) child.pos = "bottom";
00037: PopOut_Show(child.id, hideScrollers, data);
00038: }
00039: Menu_SetRoot(item);
00040: if (child) {
00041: if (!document.body.__oldOnClick && document.body.onclick) {
00042: document.body.__oldOnClick = document.body.onclick;
00043: }
00044: if (__rootMenuItem) {
00045: document.body.onclick = Menu_HideItems;
00046: }
00047: }
00048: Menu_ResetSiblings(tr);
00049: return child;
00050: }
00051: function Menu_FindMenu(item) {
00052: if (item && item.menu) return item.menu;
00053: var tr = item.parentNode.parentNode.parentNode.parentNode.parentNode;
00054: if (!tr.id) {
00055: tr = tr.parentNode;
00056: }
00057: for (var i = tr.id.length - 1; i >= 0; i--) {
00058: if (tr.id.charAt(i) < '0' || tr.id.charAt(i) > '9') {
00059: var menu = WebForm_GetElementById(tr.id.substr(0, i));
00060: if (menu) {
00061: item.menu = menu;
00062: return menu;
00063: }
00064: }
00065: }
00066: return null;
00067: }
00068: function Menu_FindNext(item) {
00069: var a = WebForm_GetElementByTagName(item, "A");
00070: var parent = Menu_FindParentContainer(item);
00071: var first = null;
00072: if (parent) {
00073: var links = WebForm_GetElementsByTagName(parent, "A");
00074: var match = false;
00075: for (var i = 0; i < links.length; i++) {
00076: var link = links[i];
00077: if (Menu_IsSelectable(link)) {
00078: if (Menu_FindParentContainer(link) == parent) {
00079: if (match) {
00080: return link;
00081: }
00082: else if (!first) {
00083: first = link;
00084: }
00085: }
00086: if (!match && link == a) {
00087: match = true;
00088: }
00089: }
00090: }
00091: }
00092: return first;
00093: }
00094: function Menu_FindParentContainer(item) {
00095: if (item.menu_ParentContainerCache) return item.menu_ParentContainerCache;
00096: var a = (item.tagName.toLowerCase() == "a") ? item : WebForm_GetElementByTagName(item, "A");
00097: var menu = Menu_FindMenu(a);
00098: if (menu) {
00099: var parent = item;
00100: while (parent && parent.tagName &&
00101: parent.id != menu.id &&
00102: parent.tagName.toLowerCase() != "div") {
00103: parent = parent.parentNode;
00104: }
00105: item.menu_ParentContainerCache = parent;
00106: return parent;
00107: }
00108: }
00109: function Menu_FindParentItem(item) {
00110: var parentContainer = Menu_FindParentContainer(item);
00111: var parentContainerID = parentContainer.id;
00112: var len = parentContainerID.length;
00113: if (parentContainerID && parentContainerID.substr(len - 5) == "Items") {
00114: var parentItemID = parentContainerID.substr(0, len - 5);
00115: return WebForm_GetElementById(parentItemID);
00116: }
00117: return null;
00118: }
00119: function Menu_FindPrevious(item) {
00120: var a = WebForm_GetElementByTagName(item, "A");
00121: var parent = Menu_FindParentContainer(item);
00122: var last = null;
00123: if (parent) {
00124: var links = WebForm_GetElementsByTagName(parent, "A");
00125: for (var i = 0; i < links.length; i++) {
00126: var link = links[i];
00127: if (Menu_IsSelectable(link)) {
00128: if (link == a && last) {
00129: return last;
00130: }
00131: if (Menu_FindParentContainer(link) == parent) {
00132: last = link;
00133: }
00134: }
00135: }
00136: }
00137: return last;
00138: }
00139: function Menu_FindSubMenu(item) {
00140: var tr = item.parentNode.parentNode.parentNode.parentNode.parentNode;
00141: if (!tr.id) {
00142: tr=tr.parentNode;
00143: }
00144: return WebForm_GetElementById(tr.id + "Items");
00145: }
00146: function Menu_Focus(item) {
00147: if (item && item.focus) {
00148: var pos = WebForm_GetElementPosition(item);
00149: var parentContainer = Menu_FindParentContainer(item);
00150: if (!parentContainer.offset) {
00151: parentContainer.offset = 0;
00152: }
00153: var posParent = WebForm_GetElementPosition(parentContainer);
00154: var delta;
00155: if (pos.y + pos.height > posParent.y + parentContainer.offset + parentContainer.clippedHeight) {
00156: delta = pos.y + pos.height - posParent.y - parentContainer.offset - parentContainer.clippedHeight;
00157: PopOut_Scroll(parentContainer, delta);
00158: }
00159: else if (pos.y < posParent.y + parentContainer.offset) {
00160: delta = posParent.y + parentContainer.offset - pos.y;
00161: PopOut_Scroll(parentContainer, -delta);
00162: }
00163: PopOut_HideScrollers(parentContainer);
00164: item.focus();
00165: }
00166: }
00167: function Menu_GetData(item) {
00168: if (!item.data) {
00169: var a = (item.tagName.toLowerCase() == "a" ? item : WebForm_GetElementByTagName(item, "a"));
00170: var menu = Menu_FindMenu(a);
00171: try {
00172: item.data = eval(menu.id + "_Data");
00173: }
00174: catch(e) {}
00175: }
00176: return item.data;
00177: }
00178: function Menu_HideItems(items) {
00179: if (document.body.__oldOnClick) {
00180: document.body.onclick = document.body.__oldOnClick;
00181: document.body.__oldOnClick = null;
00182: }
00183: Menu_ClearInterval();
00184: if (!items || ((typeof(items.tagName) == "undefined") && (items instanceof Event))) {
00185: items = __rootMenuItem;
00186: }
00187: var table = items;
00188: if ((typeof(table) == "undefined") || (table == null) || !table.tagName || (table.tagName.toLowerCase() != "table")) {
00189: table = WebForm_GetElementByTagName(table, "TABLE");
00190: }
00191: if ((typeof(table) == "undefined") || (table == null) || !table.tagName || (table.tagName.toLowerCase() != "table")) {
00192: return;
00193: }
00194: var rows = table.rows ? table.rows : table.firstChild.rows;
00195: var isVertical = false;
00196: for (var r = 0; r < rows.length; r++) {
00197: if (rows[r].id) {
00198: isVertical = true;
00199: break;
00200: }
00201: }
00202: var i, child, nextLevel;
00203: if (isVertical) {
00204: for(i = 0; i < rows.length; i++) {
00205: if (rows[i].id) {
00206: child = WebForm_GetElementById(rows[i].id + "Items");
00207: if (child) {
00208: Menu_HideItems(child);
00209: }
00210: }
00211: else if (rows[i].cells[0]) {
00212: nextLevel = WebForm_GetElementByTagName(rows[i].cells[0], "TABLE");
00213: if (nextLevel) {
00214: Menu_HideItems(nextLevel);
00215: }
00216: }
00217: }
00218: }
00219: else {
00220: for(i = 0; i < rows[0].cells.length; i++) {
00221: if (rows[0].cells[i].id) {
00222: child = WebForm_GetElementById(rows[0].cells[i].id + "Items");
00223: if (child) {
00224: Menu_HideItems(child);
00225: }
00226: }
00227: else {
00228: nextLevel = WebForm_GetElementByTagName(rows[0].cells[i], "TABLE");
00229: if (nextLevel) {
00230: Menu_HideItems(rows[0].cells[i].firstChild);
00231: }
00232: }
00233: }
00234: }
00235: if (items && items.id) {
00236: PopOut_Hide(items.id);
00237: }
00238: }
00239: function Menu_HoverDisabled(item) {
00240: var node = (item.tagName.toLowerCase() == "td") ?
00241: item:
00242: item.cells[0];
00243: var data = Menu_GetData(item);
00244: if (!data) return;
00245: node = WebForm_GetElementByTagName(node, "table").rows[0].cells[0].childNodes[0];
00246: if (data.disappearAfter >= 200) {
00247: __disappearAfter = data.disappearAfter;
00248: }
00249: Menu_Expand(node, data.horizontalOffset, data.verticalOffset);
00250: }
00251: function Menu_HoverDynamic(item) {
00252: var node = (item.tagName.toLowerCase() == "td") ?
00253: item:
00254: item.cells[0];
00255: var data = Menu_GetData(item);
00256: if (!data) return;
00257: var nodeTable = WebForm_GetElementByTagName(node, "table");
00258: if (data.hoverClass) {
00259: nodeTable.hoverClass = data.hoverClass;
00260: WebForm_AppendToClassName(nodeTable, data.hoverClass);
00261: }
00262: node = nodeTable.rows[0].cells[0].childNodes[0];
00263: if (data.hoverHyperLinkClass) {
00264: node.hoverHyperLinkClass = data.hoverHyperLinkClass;
00265: WebForm_AppendToClassName(node, data.hoverHyperLinkClass);
00266: }
00267: if (data.disappearAfter >= 200) {
00268: __disappearAfter = data.disappearAfter;
00269: }
00270: Menu_Expand(node, data.horizontalOffset, data.verticalOffset);
00271: }
00272: function Menu_HoverRoot(item) {
00273: var node = (item.tagName.toLowerCase() == "td") ?
00274: item:
00275: item.cells[0];
00276: var data = Menu_GetData(item);
00277: if (!data) {
00278: return null;
00279: }
00280: var nodeTable = WebForm_GetElementByTagName(node, "table");
00281: if (data.staticHoverClass) {
00282: nodeTable.hoverClass = data.staticHoverClass;
00283: WebForm_AppendToClassName(nodeTable, data.staticHoverClass);
00284: }
00285: node = nodeTable.rows[0].cells[0].childNodes[0];
00286: if (data.staticHoverHyperLinkClass) {
00287: node.hoverHyperLinkClass = data.staticHoverHyperLinkClass;
00288: WebForm_AppendToClassName(node, data.staticHoverHyperLinkClass);
00289: }
00290: return node;
00291: }
00292: function Menu_HoverStatic(item) {
00293: var node = Menu_HoverRoot(item);
00294: var data = Menu_GetData(item);
00295: if (!data) return;
00296: __disappearAfter = data.disappearAfter;
00297: Menu_Expand(node, data.horizontalOffset, data.verticalOffset);
00298: }
00299: function Menu_IsHorizontal(item) {
00300: if (item) {
00301: var a = ((item.tagName && (item.tagName.toLowerCase == "a")) ? item : WebForm_GetElementByTagName(item, "A"));
00302: if (!a) {
00303: return false;
00304: }
00305: var td = a.parentNode.parentNode.parentNode.parentNode.parentNode;
00306: if (td.id) {
00307: return true;
00308: }
00309: }
00310: return false;
00311: }
00312: function Menu_IsSelectable(link) {
00313: return (link && link.href)
00314: }
00315: function Menu_Key(item) {
00316: var event;
00317: if (window.event) {
00318: event = window.event;
00319: }
00320: else {
00321: event = item;
00322: item = event.currentTarget;
00323: }
00324: var key = (event ? event.keyCode : -1);
00325: var data = Menu_GetData(item);
00326: if (!data) return;
00327: var horizontal = Menu_IsHorizontal(item);
00328: var a = WebForm_GetElementByTagName(item, "A");
00329: var nextItem, parentItem, previousItem;
00330: if ((!horizontal && key == 38) || (horizontal && key == 37)) {
00331: previousItem = Menu_FindPrevious(item);
00332: while (previousItem && previousItem.disabled) {
00333: previousItem = Menu_FindPrevious(previousItem);
00334: }
00335: if (previousItem) {
00336: Menu_Focus(previousItem);
00337: Menu_Expand(previousItem, data.horizontalOffset, data.verticalOffset, true);
00338: event.cancelBubble = true;
00339: if (event.stopPropagation) event.stopPropagation();
00340: return;
00341: }
00342: }
00343: if ((!horizontal && key == 40) || (horizontal && key == 39)) {
00344: if (horizontal) {
00345: var subMenu = Menu_FindSubMenu(a);
00346: if (subMenu && subMenu.style && subMenu.style.visibility &&
00347: subMenu.style.visibility.toLowerCase() == "hidden") {
00348: Menu_Expand(a, data.horizontalOffset, data.verticalOffset, true);
00349: event.cancelBubble = true;
00350: if (event.stopPropagation) event.stopPropagation();
00351: return;
00352: }
00353: }
00354: nextItem = Menu_FindNext(item);
00355: while (nextItem && nextItem.disabled) {
00356: nextItem = Menu_FindNext(nextItem);
00357: }
00358: if (nextItem) {
00359: Menu_Focus(nextItem);
00360: Menu_Expand(nextItem, data.horizontalOffset, data.verticalOffset, true);
00361: event.cancelBubble = true;
00362: if (event.stopPropagation) event.stopPropagation();
00363: return;
00364: }
00365: }
00366: if ((!horizontal && key == 39) || (horizontal && key == 40)) {
00367: var children = Menu_Expand(a, data.horizontalOffset, data.verticalOffset, true);
00368: if (children) {
00369: var firstChild;
00370: children = WebForm_GetElementsByTagName(children, "A");
00371: for (var i = 0; i < children.length; i++) {
00372: if (!children[i].disabled && Menu_IsSelectable(children[i])) {
00373: firstChild = children[i];
00374: break;
00375: }
00376: }
00377: if (firstChild) {
00378: Menu_Focus(firstChild);
00379: Menu_Expand(firstChild, data.horizontalOffset, data.verticalOffset, true);
00380: event.cancelBubble = true;
00381: if (event.stopPropagation) event.stopPropagation();
00382: return;
00383: }
00384: }
00385: else {
00386: parentItem = Menu_FindParentItem(item);
00387: while (parentItem && !Menu_IsHorizontal(parentItem)) {
00388: parentItem = Menu_FindParentItem(parentItem);
00389: }
00390: if (parentItem) {
00391: nextItem = Menu_FindNext(parentItem);
00392: while (nextItem && nextItem.disabled) {
00393: nextItem = Menu_FindNext(nextItem);
00394: }
00395: if (nextItem) {
00396: Menu_Focus(nextItem);
00397: Menu_Expand(nextItem, data.horizontalOffset, data.verticalOffset, true);
00398: event.cancelBubble = true;
00399: if (event.stopPropagation) event.stopPropagation();
00400: return;
00401: }
00402: }
00403: }
00404: }
00405: if ((!horizontal && key == 37) || (horizontal && key == 38)) {
00406: parentItem = Menu_FindParentItem(item);
00407: if (parentItem) {
00408: if (Menu_IsHorizontal(parentItem)) {
00409: previousItem = Menu_FindPrevious(parentItem);
00410: while (previousItem && previousItem.disabled) {
00411: previousItem = Menu_FindPrevious(previousItem);
00412: }
00413: if (previousItem) {
00414: Menu_Focus(previousItem);
00415: Menu_Expand(previousItem, data.horizontalOffset, data.verticalOffset, true);
00416: event.cancelBubble = true;
00417: if (event.stopPropagation) event.stopPropagation();
00418: return;
00419: }
00420: }
00421: var parentA = WebForm_GetElementByTagName(parentItem, "A");
00422: if (parentA) {
00423: Menu_Focus(parentA);
00424: }
00425: Menu_ResetSiblings(parentItem);
00426: event.cancelBubble = true;
00427: if (event.stopPropagation) event.stopPropagation();
00428: return;
00429: }
00430: }
00431: if (key == 27) {
00432: Menu_HideItems();
00433: event.cancelBubble = true;
00434: if (event.stopPropagation) event.stopPropagation();
00435: return;
00436: }
00437: }
00438: function Menu_ResetSiblings(item) {
00439: var table = (item.tagName.toLowerCase() == "td") ?
00440: item.parentNode.parentNode.parentNode :
00441: item.parentNode.parentNode;
00442: var isVertical = false;
00443: for (var r = 0; r < table.rows.length; r++) {
00444: if (table.rows[r].id) {
00445: isVertical = true;
00446: break;
00447: }
00448: }
00449: var i, child, childNode;
00450: if (isVertical) {
00451: for(i = 0; i < table.rows.length; i++) {
00452: childNode = table.rows[i];
00453: if (childNode != item) {
00454: child = WebForm_GetElementById(childNode.id + "Items");
00455: if (child) {
00456: Menu_HideItems(child);
00457: }
00458: }
00459: }
00460: }
00461: else {
00462: for(i = 0; i < table.rows[0].cells.length; i++) {
00463: childNode = table.rows[0].cells[i];
00464: if (childNode != item) {
00465: child = WebForm_GetElementById(childNode.id + "Items");
00466: if (child) {
00467: Menu_HideItems(child);
00468: }
00469: }
00470: }
00471: }
00472: Menu_ResetTopMenus(table, table, 0, true);
00473: }
00474: function Menu_ResetTopMenus(table, doNotReset, level, up) {
00475: var i, child, childNode;
00476: if (up && table.id == "") {
00477: var parentTable = table.parentNode.parentNode.parentNode.parentNode;
00478: if (parentTable.tagName.toLowerCase() == "table") {
00479: Menu_ResetTopMenus(parentTable, doNotReset, level + 1, true);
00480: }
00481: }
00482: else {
00483: if (level == 0 && table != doNotReset) {
00484: if (table.rows[0].id) {
00485: for(i = 0; i < table.rows.length; i++) {
00486: childNode = table.rows[i];
00487: child = WebForm_GetElementById(childNode.id + "Items");
00488: if (child) {
00489: Menu_HideItems(child);
00490: }
00491: }
00492: }
00493: else {
00494: for(i = 0; i < table.rows[0].cells.length; i++) {
00495: childNode = table.rows[0].cells[i];
00496: child = WebForm_GetElementById(childNode.id + "Items");
00497: if (child) {
00498: Menu_HideItems(child);
00499: }
00500: }
00501: }
00502: }
00503: else if (level > 0) {
00504: for (i = 0; i < table.rows.length; i++) {
00505: for (var j = 0; j < table.rows[i].cells.length; j++) {
00506: var subTable = table.rows[i].cells[j].firstChild;
00507: if (subTable && subTable.tagName.toLowerCase() == "table") {
00508: Menu_ResetTopMenus(subTable, doNotReset, level - 1, false);
00509: }
00510: }
00511: }
00512: }
00513: }
00514: }
00515: function Menu_RestoreInterval() {
00516: if (__menuInterval && __rootMenuItem) {
00517: Menu_ClearInterval();
00518: __menuInterval = window.setInterval("Menu_HideItems()", __disappearAfter);
00519: }
00520: }
00521: function Menu_SetRoot(item) {
00522: var newRoot = Menu_FindMenu(item);
00523: if (newRoot) {
00524: if (__rootMenuItem && __rootMenuItem != newRoot) {
00525: Menu_HideItems();
00526: }
00527: __rootMenuItem = newRoot;
00528: }
00529: }
00530: function Menu_Unhover(item) {
00531: var node = (item.tagName.toLowerCase() == "td") ?
00532: item:
00533: item.cells[0];
00534: var nodeTable = WebForm_GetElementByTagName(node, "table");
00535: if (nodeTable.hoverClass) {
00536: WebForm_RemoveClassName(nodeTable, nodeTable.hoverClass);
00537: }
00538: node = nodeTable.rows[0].cells[0].childNodes[0];
00539: if (node.hoverHyperLinkClass) {
00540: WebForm_RemoveClassName(node, node.hoverHyperLinkClass);
00541: }
00542: Menu_Collapse(node);
00543: }
00544: function PopOut_Clip(element, y, height) {
00545: if (element && element.style) {
00546: element.style.clip = "rect(" + y + "px auto " + (y + height) + "px auto)";
00547: element.style.overflow = "hidden";
00548: }
00549: }
00550: function PopOut_Down(scroller) {
00551: Menu_ClearInterval();
00552: var panel;
00553: if (scroller) {
00554: panel = scroller.parentNode
00555: }
00556: else {
00557: panel = __scrollPanel;
00558: }
00559: if (panel && ((panel.offset + panel.clippedHeight) < panel.physicalHeight)) {
00560: PopOut_Scroll(panel, 2)
00561: __scrollPanel = panel;
00562: PopOut_ShowScrollers(panel);
00563: PopOut_Stop();
00564: __scrollPanel.interval = window.setInterval("PopOut_Down()", 8);
00565: }
00566: else {
00567: PopOut_ShowScrollers(panel);
00568: }
00569: }
00570: function PopOut_Hide(panelId) {
00571: var panel = WebForm_GetElementById(panelId);
00572: if (panel && panel.tagName.toLowerCase() == "div") {
00573: panel.style.visibility = "hidden";
00574: panel.style.display = "none";
00575: panel.offset = 0;
00576: panel.scrollTop = 0;
00577: var table = WebForm_GetElementByTagName(panel, "TABLE");
00578: if (table) {
00579: WebForm_SetElementY(table, 0);
00580: }
00581: if (window.navigator && window.navigator.appName == "Microsoft Internet Explorer" &&
00582: !window.opera) {
00583: var childFrameId = panel.id + "_MenuIFrame";
00584: var childFrame = WebForm_GetElementById(childFrameId);
00585: if (childFrame) {
00586: childFrame.style.display = "none";
00587: }
00588: }
00589: }
00590: }
00591: function PopOut_HideScrollers(panel) {
00592: if (panel && panel.style) {
00593: var up = WebForm_GetElementById(panel.id + "Up");
00594: var dn = WebForm_GetElementById(panel.id + "Dn");
00595: if (up) {
00596: up.style.visibility = "hidden";
00597: up.style.display = "none";
00598: }
00599: if (dn) {
00600: dn.style.visibility = "hidden";
00601: dn.style.display = "none";
00602: }
00603: }
00604: }
00605: function PopOut_Position(panel, hideScrollers) {
00606: if (window.opera) {
00607: panel.parentNode.removeChild(panel);
00608: document.forms[0].appendChild(panel);
00609: }
00610: var rel = WebForm_GetElementById(panel.rel);
00611: var relTable = WebForm_GetElementByTagName(rel, "TABLE");
00612: var relCoordinates = WebForm_GetElementPosition(relTable ? relTable : rel);
00613: var panelCoordinates = WebForm_GetElementPosition(panel);
00614: var panelHeight = ((typeof(panel.physicalHeight) != "undefined") && (panel.physicalHeight != null)) ?
00615: panel.physicalHeight :
00616: panelCoordinates.height;
00617: panel.physicalHeight = panelHeight;
00618: var panelParentCoordinates;
00619: if (panel.offsetParent) {
00620: panelParentCoordinates = WebForm_GetElementPosition(panel.offsetParent);
00621: }
00622: else {
00623: panelParentCoordinates = new Object();
00624: panelParentCoordinates.x = 0;
00625: panelParentCoordinates.y = 0;
00626: }
00627: var overflowElement = WebForm_GetElementById("__overFlowElement");
00628: if (!overflowElement) {
00629: overflowElement = document.createElement("img");
00630: overflowElement.id="__overFlowElement";
00631: WebForm_SetElementWidth(overflowElement, 1);
00632: document.body.appendChild(overflowElement);
00633: }
00634: WebForm_SetElementHeight(overflowElement, panelHeight + relCoordinates.y + parseInt(panel.y ? panel.y : 0));
00635: overflowElement.style.visibility = "visible";
00636: overflowElement.style.display = "inline";
00637: var clientHeight = 0;
00638: var clientWidth = 0;
00639: if (window.innerHeight) {
00640: clientHeight = window.innerHeight;
00641: clientWidth = window.innerWidth;
00642: }
00643: else if (document.documentElement && document.documentElement.clientHeight) {
00644: clientHeight = document.documentElement.clientHeight;
00645: clientWidth = document.documentElement.clientWidth;
00646: }
00647: else if (document.body && document.body.clientHeight) {
00648: clientHeight = document.body.clientHeight;
00649: clientWidth = document.body.clientWidth;
00650: }
00651: var scrollTop = 0;
00652: var scrollLeft = 0;
00653: if (typeof(window.pageYOffset) != "undefined") {
00654: scrollTop = window.pageYOffset;
00655: scrollLeft = window.pageXOffset;
00656: }
00657: else if (document.documentElement && (typeof(document.documentElement.scrollTop) != "undefined")) {
00658: scrollTop = document.documentElement.scrollTop;
00659: scrollLeft = document.documentElement.scrollLeft;
00660: }
00661: else if (document.body && (typeof(document.body.scrollTop) != "undefined")) {
00662: scrollTop = document.body.scrollTop;
00663: scrollLeft = document.body.scrollLeft;
00664: }
00665: overflowElement.style.visibility = "hidden";
00666: overflowElement.style.display = "none";
00667: var bottomWindowBorder = clientHeight + scrollTop;
00668: var rightWindowBorder = clientWidth + scrollLeft;
00669: var position = panel.pos;
00670: if ((typeof(position) == "undefined") || (position == null) || (position == "")) {
00671: position = (WebForm_GetElementDir(rel) == "rtl" ? "middleleft" : "middleright");
00672: }
00673: position = position.toLowerCase();
00674: var y = relCoordinates.y + parseInt(panel.y ? panel.y : 0) - panelParentCoordinates.y;
00675: var borderParent = (rel && rel.parentNode && rel.parentNode.parentNode && rel.parentNode.parentNode.parentNode
00676: && rel.parentNode.parentNode.parentNode.tagName.toLowerCase() == "div") ?
00677: rel.parentNode.parentNode.parentNode : null;
00678: WebForm_SetElementY(panel, y);
00679: PopOut_SetPanelHeight(panel, panelHeight, true);
00680: var clip = false;
00681: var overflow;
00682: if (position.indexOf("top") != -1) {
00683: y -= panelHeight;
00684: WebForm_SetElementY(panel, y);
00685: if (y < -panelParentCoordinates.y) {
00686: y = -panelParentCoordinates.y;
00687: WebForm_SetElementY(panel, y);
00688: if (panelHeight > clientHeight - 2) {
00689: clip = true;
00690: PopOut_SetPanelHeight(panel, clientHeight - 2);
00691: }
00692: }
00693: }
00694: else {
00695: if (position.indexOf("bottom") != -1) {
00696: y += relCoordinates.height;
00697: WebForm_SetElementY(panel, y);
00698: }
00699: overflow = y + panelParentCoordinates.y + panelHeight - bottomWindowBorder;
00700: if (overflow > 0) {
00701: y -= overflow;
00702: WebForm_SetElementY(panel, y);
00703: if (y < -panelParentCoordinates.y) {
00704: y = 2 - panelParentCoordinates.y + scrollTop;
00705: WebForm_SetElementY(panel, y);
00706: clip = true;
00707: PopOut_SetPanelHeight(panel, clientHeight - 2);
00708: }
00709: }
00710: }
00711: if (!clip) {
00712: PopOut_SetPanelHeight(panel, panel.clippedHeight, true);
00713: }
00714: var panelParentOffsetY = 0;
00715: if (panel.offsetParent) {
00716: panelParentOffsetY = WebForm_GetElementPosition(panel.offsetParent).y;
00717: }
00718: var panelY = ((typeof(panel.originY) != "undefined") && (panel.originY != null)) ?
00719: panel.originY :
00720: y - panelParentOffsetY;
00721: panel.originY = panelY;
00722: if (!hideScrollers) {
00723: PopOut_ShowScrollers(panel);
00724: }
00725: else {
00726: PopOut_HideScrollers(panel);
00727: }
00728: var x = relCoordinates.x + parseInt(panel.x ? panel.x : 0) - panelParentCoordinates.x;
00729: if (borderParent && borderParent.clientLeft) {
00730: x += 2 * borderParent.clientLeft;
00731: }
00732: WebForm_SetElementX(panel, x);
00733: if (position.indexOf("left") != -1) {
00734: x -= panelCoordinates.width;
00735: WebForm_SetElementX(panel, x);
00736: if (x < -panelParentCoordinates.x) {
00737: WebForm_SetElementX(panel, -panelParentCoordinates.x);
00738: }
00739: }
00740: else {
00741: if (position.indexOf("right") != -1) {
00742: x += relCoordinates.width;
00743: WebForm_SetElementX(panel, x);
00744: }
00745: overflow = x + panelParentCoordinates.x + panelCoordinates.width - rightWindowBorder;
00746: if (overflow > 0) {
00747: if (position.indexOf("bottom") == -1 && relCoordinates.x > panelCoordinates.width) {
00748: x -= relCoordinates.width + panelCoordinates.width;
00749: }
00750: else {
00751: x -= overflow;
00752: }
00753: WebForm_SetElementX(panel, x);
00754: if (x < -panelParentCoordinates.x) {
00755: WebForm_SetElementX(panel, -panelParentCoordinates.x);
00756: }
00757: }
00758: }
00759: }
00760: function PopOut_Scroll(panel, offsetDelta) {
00761: var table = WebForm_GetElementByTagName(panel, "TABLE");
00762: if (!table) return;
00763: table.style.position = "relative";
00764: var tableY = (table.style.top ? parseInt(table.style.top) : 0);
00765: panel.offset += offsetDelta;
00766: WebForm_SetElementY(table, tableY - offsetDelta);
00767: }
00768: function PopOut_SetPanelHeight(element, height, doNotClip) {
00769: if (element && element.style) {
00770: var size = WebForm_GetElementPosition(element);
00771: element.physicalWidth = size.width;
00772: element.clippedHeight = height;
00773: WebForm_SetElementHeight(element, height - (element.clientTop ? (2 * element.clientTop) : 0));
00774: if (doNotClip && element.style) {
00775: element.style.clip = "rect(auto auto auto auto)";
00776: }
00777: else {
00778: PopOut_Clip(element, 0, height);
00779: }
00780: }
00781: }
00782: function PopOut_Show(panelId, hideScrollers, data) {
00783: var panel = WebForm_GetElementById(panelId);
00784: if (panel && panel.tagName.toLowerCase() == "div") {
00785: panel.style.visibility = "visible";
00786: panel.style.display = "inline";
00787: if (!panel.offset || hideScrollers) {
00788: panel.scrollTop = 0;
00789: panel.offset = 0;
00790: var table = WebForm_GetElementByTagName(panel, "TABLE");
00791: if (table) {
00792: WebForm_SetElementY(table, 0);
00793: }
00794: }
00795: PopOut_Position(panel, hideScrollers);
00796: var z = 1;
00797: var isIE = window.navigator && window.navigator.appName == "Microsoft Internet Explorer" && !window.opera;
00798: if (isIE && data) {
00799: var childFrameId = panel.id + "_MenuIFrame";
00800: var childFrame = WebForm_GetElementById(childFrameId);
00801: var parent = panel.offsetParent;
00802: if (!childFrame) {
00803: childFrame = document.createElement("iframe");
00804: childFrame.id = childFrameId;
00805: childFrame.src = (data.iframeUrl ? data.iframeUrl : "about:blank");
00806: childFrame.style.position = "absolute";
00807: childFrame.style.display = "none";
00808: childFrame.scrolling = "no";
00809: childFrame.frameBorder = "0";
00810: if (parent.tagName.toLowerCase() == "html") {
00811: document.body.appendChild(childFrame);
00812: }
00813: else {
00814: parent.appendChild(childFrame);
00815: }
00816: }
00817: var pos = WebForm_GetElementPosition(panel);
00818: var parentPos = WebForm_GetElementPosition(parent);
00819: WebForm_SetElementX(childFrame, pos.x - parentPos.x);
00820: WebForm_SetElementY(childFrame, pos.y - parentPos.y);
00821: WebForm_SetElementWidth(childFrame, pos.width);
00822: WebForm_SetElementHeight(childFrame, pos.height);
00823: childFrame.style.display = "block";
00824: if (panel.currentStyle && panel.currentStyle.zIndex) {
00825: z = panel.currentStyle.zIndex;
00826: }
00827: else if (panel.style.zIndex) {
00828: z = panel.style.zIndex;
00829: }
00830: }
00831: panel.style.zIndex = z;
00832: }
00833: }
00834: function PopOut_ShowScrollers(panel) {
00835: if (panel && panel.style) {
00836: var up = WebForm_GetElementById(panel.id + "Up");
00837: var dn = WebForm_GetElementById(panel.id + "Dn");
00838: var cnt = 0;
00839: if (up && dn) {
00840: if (panel.offset && panel.offset > 0) {
00841: up.style.visibility = "visible";
00842: up.style.display = "inline";
00843: cnt++;
00844: if (panel.clientWidth) {
00845: WebForm_SetElementWidth(up, panel.clientWidth
00846: - (up.clientLeft ? (2 * up.clientLeft) : 0));
00847: }
00848: WebForm_SetElementY(up, 0);
00849: }
00850: else {
00851: up.style.visibility = "hidden";
00852: up.style.display = "none";
00853: }
00854: if (panel.offset + panel.clippedHeight + 2 <= panel.physicalHeight) {
00855: dn.style.visibility = "visible";
00856: dn.style.display = "inline";
00857: cnt++;
00858: if (panel.clientWidth) {
00859: WebForm_SetElementWidth(dn, panel.clientWidth
00860: - (dn.clientLeft ? (2 * dn.clientLeft) : 0));
00861: }
00862: WebForm_SetElementY(dn, panel.clippedHeight - WebForm_GetElementPosition(dn).height
00863: - (panel.clientTop ? (2 * panel.clientTop) : 0));
00864: }
00865: else {
00866: dn.style.visibility = "hidden";
00867: dn.style.display = "none";
00868: }
00869: if (cnt == 0) {
00870: panel.style.clip = "rect(auto auto auto auto)";
00871: }
00872: }
00873: }
00874: }
00875: function PopOut_Stop() {
00876: if (__scrollPanel && __scrollPanel.interval) {
00877: window.clearInterval(__scrollPanel.interval);
00878: }
00879: Menu_RestoreInterval();
00880: }
00881: function PopOut_Up(scroller) {
00882: Menu_ClearInterval();
00883: var panel;
00884: if (scroller) {
00885: panel = scroller.parentNode
00886: }
00887: else {
00888: panel = __scrollPanel;
00889: }
00890: if (panel && panel.offset && panel.offset > 0) {
00891: PopOut_Scroll(panel, -2);
00892: __scrollPanel = panel;
00893: PopOut_ShowScrollers(panel);
00894: PopOut_Stop();
00895: __scrollPanel.interval = window.setInterval("PopOut_Up()", 8);
00896: }
00897: }
00001: function WebForm_PostBackOptions(eventTarget, eventArgument, validation, validationGroup, actionUrl, trackFocus, clientSubmit) {
00002: this.eventTarget = eventTarget;
00003: this.eventArgument = eventArgument;
00004: this.validation = validation;
00005: this.validationGroup = validationGroup;
00006: this.actionUrl = actionUrl;
00007: this.trackFocus = trackFocus;
00008: this.clientSubmit = clientSubmit;
00009: }
00010: function WebForm_DoPostBackWithOptions(options) {
00011: var validationResult = true;
00012: if (options.validation) {
00013: if (typeof(Page_ClientValidate) == 'function') {
00014: validationResult = Page_ClientValidate(options.validationGroup);
00015: }
00016: }
00017: if (validationResult) {
00018: if ((typeof(options.actionUrl) != "undefined") && (options.actionUrl != null) && (options.actionUrl.length > 0)) {
00019: theForm.action = options.actionUrl;
00020: }
00021: if (options.trackFocus) {
00022: var lastFocus = theForm.elements["__LASTFOCUS"];
00023: if ((typeof(lastFocus) != "undefined") && (lastFocus != null)) {
00024: if (typeof(document.activeElement) == "undefined") {
00025: lastFocus.value = options.eventTarget;
00026: }
00027: else {
00028: var active = document.activeElement;
00029: if ((typeof(active) != "undefined") && (active != null)) {
00030: if ((typeof(active.id) != "undefined") && (active.id != null) && (active.id.length > 0)) {
00031: lastFocus.value = active.id;
00032: }
00033: else if (typeof(active.name) != "undefined") {
00034: lastFocus.value = active.name;
00035: }
00036: }
00037: }
00038: }
00039: }
00040: }
00041: if (options.clientSubmit) {
00042: __doPostBack(options.eventTarget, options.eventArgument);
00043: }
00044: }
00045: var __pendingCallbacks = new Array();
00046: var __synchronousCallBackIndex = -1;
00047: function WebForm_DoCallback(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync) {
00048: var postData = __theFormPostData +
00049: "__CALLBACKID=" + WebForm_EncodeCallback(eventTarget) +
00050: "&__CALLBACKPARAM=" + WebForm_EncodeCallback(eventArgument);
00051: if (theForm["__EVENTVALIDATION"]) {
00052: postData += "&__EVENTVALIDATION=" + WebForm_EncodeCallback(theForm["__EVENTVALIDATION"].value);
00053: }
00054: var xmlRequest,e;
00055: try {
00056: xmlRequest = new XMLHttpRequest();
00057: }
00058: catch(e) {
00059: try {
00060: xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
00061: }
00062: catch(e) {
00063: }
00064: }
00065: var setRequestHeaderMethodExists = true;
00066: try {
00067: setRequestHeaderMethodExists = (xmlRequest && xmlRequest.setRequestHeader);
00068: }
00069: catch(e) {}
00070: var callback = new Object();
00071: callback.eventCallback = eventCallback;
00072: callback.context = context;
00073: callback.errorCallback = errorCallback;
00074: callback.async = useAsync;
00075: var callbackIndex = WebForm_FillFirstAvailableSlot(__pendingCallbacks, callback);
00076: if (!useAsync) {
00077: if (__synchronousCallBackIndex != -1) {
00078: __pendingCallbacks[__synchronousCallBackIndex] = null;
00079: }
00080: __synchronousCallBackIndex = callbackIndex;
00081: }
00082: if (setRequestHeaderMethodExists) {
00083: xmlRequest.onreadystatechange = WebForm_CallbackComplete;
00084: callback.xmlRequest = xmlRequest;
00085: xmlRequest.open("POST", theForm.action, true);
00086: xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
00087: xmlRequest.send(postData);
00088: return;
00089: }
00090: callback.xmlRequest = new Object();
00091: var callbackFrameID = "__CALLBACKFRAME" + callbackIndex;
00092: var xmlRequestFrame = document.frames[callbackFrameID];
00093: if (!xmlRequestFrame) {
00094: xmlRequestFrame = document.createElement("IFRAME");
00095: xmlRequestFrame.width = "1";
00096: xmlRequestFrame.height = "1";
00097: xmlRequestFrame.frameBorder = "0";
00098: xmlRequestFrame.id = callbackFrameID;
00099: xmlRequestFrame.name = callbackFrameID;
00100: xmlRequestFrame.style.position = "absolute";
00101: xmlRequestFrame.style.top = "-100px"
00102: xmlRequestFrame.style.left = "-100px";
00103: try {
00104: if (callBackFrameUrl) {
00105: xmlRequestFrame.src = callBackFrameUrl;
00106: }
00107: }
00108: catch(e) {}
00109: document.body.appendChild(xmlRequestFrame);
00110: }
00111: var interval = window.setInterval(function() {
00112: xmlRequestFrame = document.frames[callbackFrameID];
00113: if (xmlRequestFrame && xmlRequestFrame.document) {
00114: window.clearInterval(interval);
00115: xmlRequestFrame.document.write("");
00116: xmlRequestFrame.document.close();
00117: xmlRequestFrame.document.write('<html><body><form method="post"><input type="hidden" name="__CALLBACKLOADSCRIPT" value="t"></form></body></html>');
00118: xmlRequestFrame.document.close();
00119: xmlRequestFrame.document.forms[0].action = theForm.action;
00120: var count = __theFormPostCollection.length;
00121: var element;
00122: for (var i = 0; i < count; i++) {
00123: element = __theFormPostCollection[i];
00124: if (element) {
00125: var fieldElement = xmlRequestFrame.document.createElement("INPUT");
00126: fieldElement.type = "hidden";
00127: fieldElement.name = element.name;
00128: fieldElement.value = element.value;
00129: xmlRequestFrame.document.forms[0].appendChild(fieldElement);
00130: }
00131: }
00132: var callbackIdFieldElement = xmlRequestFrame.document.createElement("INPUT");
00133: callbackIdFieldElement.type = "hidden";
00134: callbackIdFieldElement.name = "__CALLBACKID";
00135: callbackIdFieldElement.value = eventTarget;
00136: xmlRequestFrame.document.forms[0].appendChild(callbackIdFieldElement);
00137: var callbackParamFieldElement = xmlRequestFrame.document.createElement("INPUT");
00138: callbackParamFieldElement.type = "hidden";
00139: callbackParamFieldElement.name = "__CALLBACKPARAM";
00140: callbackParamFieldElement.value = eventArgument;
00141: xmlRequestFrame.document.forms[0].appendChild(callbackParamFieldElement);
00142: if (theForm["__EVENTVALIDATION"]) {
00143: var callbackValidationFieldElement = xmlRequestFrame.document.createElement("INPUT");
00144: callbackValidationFieldElement.type = "hidden";
00145: callbackValidationFieldElement.name = "__EVENTVALIDATION";
00146: callbackValidationFieldElement.value = theForm["__EVENTVALIDATION"].value;
00147: xmlRequestFrame.document.forms[0].appendChild(callbackValidationFieldElement);
00148: }
00149: var callbackIndexFieldElement = xmlRequestFrame.document.createElement("INPUT");
00150: callbackIndexFieldElement.type = "hidden";
00151: callbackIndexFieldElement.name = "__CALLBACKINDEX";
00152: callbackIndexFieldElement.value = callbackIndex;
00153: xmlRequestFrame.document.forms[0].appendChild(callbackIndexFieldElement);
00154: xmlRequestFrame.document.forms[0].submit();
00155: }
00156: }, 10);
00157: }
00158: function WebForm_CallbackComplete() {
00159: for (i = 0; i < __pendingCallbacks.length; i++) {
00160: callbackObject = __pendingCallbacks[i];
00161: if (callbackObject && callbackObject.xmlRequest && (callbackObject.xmlRequest.readyState == 4)) {
00162: WebForm_ExecuteCallback(callbackObject);
00163: if (!__pendingCallbacks[i].async) {
00164: __synchronousCallBackIndex = -1;
00165: }
00166: __pendingCallbacks[i] = null;
00167: var callbackFrameID = "__CALLBACKFRAME" + i;
00168: var xmlRequestFrame = document.getElementById(callbackFrameID);
00169: if (xmlRequestFrame) {
00170: xmlRequestFrame.parentNode.removeChild(xmlRequestFrame);
00171: }
00172: }
00173: }
00174: }
00175: function WebForm_ExecuteCallback(callbackObject) {
00176: var response = callbackObject.xmlRequest.responseText;
00177: if (response.charAt(0) == "s") {
00178: if ((typeof(callbackObject.eventCallback) != "undefined") && (callbackObject.eventCallback != null)) {
00179: callbackObject.eventCallback(response.substring(1), callbackObject.context);
00180: }
00181: }
00182: else if (response.charAt(0) == "e") {
00183: if ((typeof(callbackObject.errorCallback) != "undefined") && (callbackObject.errorCallback != null)) {
00184: callbackObject.errorCallback(response.substring(1), callbackObject.context);
00185: }
00186: }
00187: else {
00188: var separatorIndex = response.indexOf("|");
00189: if (separatorIndex != -1) {
00190: var validationFieldLength = parseInt(response.substring(0, separatorIndex));
00191: if (!isNaN(validationFieldLength)) {
00192: var validationField = response.substring(separatorIndex + 1, separatorIndex + validationFieldLength + 1);
00193: if (validationField != "") {
00194: var validationFieldElement = theForm["__EVENTVALIDATION"];
00195: if (!validationFieldElement) {
00196: validationFieldElement = document.createElement("INPUT");
00197: validationFieldElement.type = "hidden";
00198: validationFieldElement.name = "__EVENTVALIDATION";
00199: theForm.appendChild(validationFieldElement);
00200: }
00201: validationFieldElement.value = validationField;
00202: }
00203: if ((typeof(callbackObject.eventCallback) != "undefined") && (callbackObject.eventCallback != null)) {
00204: callbackObject.eventCallback(response.substring(separatorIndex + validationFieldLength + 1), callbackObject.context);
00205: }
00206: }
00207: }
00208: }
00209: }
00210: function WebForm_FillFirstAvailableSlot(array, element) {
00211: var i;
00212: for (i = 0; i < array.length; i++) {
00213: if (!array[i]) break;
00214: }
00215: array[i] = element;
00216: return i;
00217: }
00218: var __nonMSDOMBrowser = (window.navigator.appName.toLowerCase().indexOf('explorer') == -1);
00219: var __theFormPostData = "";
00220: var __theFormPostCollection = new Array();
00221: function WebForm_InitCallback() {
00222: var count = theForm.elements.length;
00223: var element;
00224: for (var i = 0; i < count; i++) {
00225: element = theForm.elements[i];
00226: var tagName = element.tagName.toLowerCase();
00227: if (tagName == "input") {
00228: var type = element.type;
00229: if ((type == "text" || type == "hidden" || type == "password" ||
00230: ((type == "checkbox" || type == "radio") && element.checked)) &&
00231: (element.id != "__EVENTVALIDATION")) {
00232: WebForm_InitCallbackAddField(element.name, element.value);
00233: }
00234: }
00235: else if (tagName == "select") {
00236: var selectCount = element.options.length;
00237: for (var j = 0; j < selectCount; j++) {
00238: var selectChild = element.options[j];
00239: if (selectChild.selected == true) {
00240: WebForm_InitCallbackAddField(element.name, element.value);
00241: }
00242: }
00243: }
00244: else if (tagName == "textarea") {
00245: WebForm_InitCallbackAddField(element.name, element.value);
00246: }
00247: }
00248: }
00249: function WebForm_InitCallbackAddField(name, value) {
00250: var nameValue = new Object();
00251: nameValue.name = name;
00252: nameValue.value = value;
00253: __theFormPostCollection[__theFormPostCollection.length] = nameValue;
00254: __theFormPostData += name + "=" + WebForm_EncodeCallback(value) + "&";
00255: }
00256: function WebForm_EncodeCallback(parameter) {
00257: if (encodeURIComponent) {
00258: return encodeURIComponent(parameter);
00259: }
00260: else {
00261: return escape(parameter);
00262: }
00263: }
00264: var __disabledControlArray = new Array();
00265: function WebForm_ReEnableControls() {
00266: if (typeof(__enabledControlArray) == 'undefined') {
00267: return false;
00268: }
00269: var disabledIndex = 0;
00270: for (var i = 0; i < __enabledControlArray.length; i++) {
00271: var c;
00272: if (__nonMSDOMBrowser) {
00273: c = document.getElementById(__enabledControlArray[i]);
00274: }
00275: else {
00276: c = document.all[__enabledControlArray[i]];
00277: }
00278: if ((typeof(c) != "undefined") && (c != null) && (c.disabled == true)) {
00279: c.disabled = false;
00280: __disabledControlArray[disabledIndex++] = c;
00281: }
00282: }
00283: setTimeout("WebForm_ReDisableControls()", 0);
00284: return true;
00285: }
00286: function WebForm_ReDisableControls() {
00287: for (var i = 0; i < __disabledControlArray.length; i++) {
00288: __disabledControlArray[i].disabled = true;
00289: }
00290: }
00291: function WebForm_FireDefaultButton(event, target) {
00292: if (event.keyCode == 13 && !(event.srcElement && (event.srcElement.tagName.toLowerCase() == "textarea"))) {
00293: var defaultButton;
00294: if (__nonMSDOMBrowser) {
00295: defaultButton = document.getElementById(target);
00296: }
00297: else {
00298: defaultButton = document.all[target];
00299: }
00300: if (defaultButton && typeof(defaultButton.click) != "undefined") {
00301: defaultButton.click();
00302: event.cancelBubble = true;
00303: if (event.stopPropagation) event.stopPropagation();
00304: return false;
00305: }
00306: }
00307: return true;
00308: }
00309: function WebForm_GetScrollX() {
00310: if (__nonMSDOMBrowser) {
00311: return window.pageXOffset;
00312: }
00313: else {
00314: if (document.documentElement && document.documentElement.scrollLeft) {
00315: return document.documentElement.scrollLeft;
00316: }
00317: else if (document.body) {
00318: return document.body.scrollLeft;
00319: }
00320: }
00321: return 0;
00322: }
00323: function WebForm_GetScrollY() {
00324: if (__nonMSDOMBrowser) {
00325: return window.pageYOffset;
00326: }
00327: else {
00328: if (document.documentElement && document.documentElement.scrollTop) {
00329: return document.documentElement.scrollTop;
00330: }
00331: else if (document.body) {
00332: return document.body.scrollTop;
00333: }
00334: }
00335: return 0;
00336: }
00337: function WebForm_SaveScrollPositionSubmit() {
00338: if (__nonMSDOMBrowser) {
00339: theForm.elements['__SCROLLPOSITIONY'].value = window.pageYOffset;
00340: theForm.elements['__SCROLLPOSITIONX'].value = window.pageXOffset;
00341: }
00342: else {
00343: theForm.__SCROLLPOSITIONX.value = WebForm_GetScrollX();
00344: theForm.__SCROLLPOSITIONY.value = WebForm_GetScrollY();
00345: }
00346: if ((typeof(this.oldSubmit) != "undefined") && (this.oldSubmit != null)) {
00347: return this.oldSubmit();
00348: }
00349: return true;
00350: }
00351: function WebForm_SaveScrollPositionOnSubmit() {
00352: theForm.__SCROLLPOSITIONX.value = WebForm_GetScrollX();
00353: theForm.__SCROLLPOSITIONY.value = WebForm_GetScrollY();
00354: if ((typeof(this.oldOnSubmit) != "undefined") && (this.oldOnSubmit != null)) {
00355: return this.oldOnSubmit();
00356: }
00357: return true;
00358: }
00359: function WebForm_RestoreScrollPosition() {
00360: if (__nonMSDOMBrowser) {
00361: window.scrollTo(theForm.elements['__SCROLLPOSITIONX'].value, theForm.elements['__SCROLLPOSITIONY'].value);
00362: }
00363: else {
00364: window.scrollTo(theForm.__SCROLLPOSITIONX.value, theForm.__SCROLLPOSITIONY.value);
00365: }
00366: if ((typeof(theForm.oldOnLoad) != "undefined") && (theForm.oldOnLoad != null)) {
00367: return theForm.oldOnLoad();
00368: }
00369: return true;
00370: }
00371: function WebForm_TextBoxKeyHandler(event) {
00372: if (event.keyCode == 13) {
00373: var target;
00374: if (__nonMSDOMBrowser) {
00375: target = event.target;
00376: }
00377: else {
00378: target = event.srcElement;
00379: }
00380: if ((typeof(target) != "undefined") && (target != null)) {
00381: if (typeof(target.onchange) != "undefined") {
00382: target.onchange();
00383: event.cancelBubble = true;
00384: if (event.stopPropagation) event.stopPropagation();
00385: return false;
00386: }
00387: }
00388: }
00389: return true;
00390: }
00391: function WebForm_AppendToClassName(element, className) {
00392: var current = element.className;
00393: if (current) {
00394: if (current.charAt(current.length - 1) != ' ') {
00395: current += ' ';
00396: }
00397: current += className;
00398: }
00399: else {
00400: current = className;
00401: }
00402: element.className = current;
00403: }
00404: function WebForm_RemoveClassName(element, className) {
00405: var current = element.className;
00406: if (current) {
00407: if (current.substring(current.length - className.length - 1, current.length) == ' ' + className) {
00408: element.className = current.substring(0, current.length - className.length - 1);
00409: return;
00410: }
00411: if (current == className) {
00412: element.className = "";
00413: return;
00414: }
00415: var index = current.indexOf(' ' + className + ' ');
00416: if (index != -1) {
00417: element.className = current.substring(0, index) + current.substring(index + className.length + 2, current.length);
00418: return;
00419: }
00420: if (current.substring(0, className.length) == className + ' ') {
00421: element.className = current.substring(className.length + 1, current.length);
00422: }
00423: }
00424: }
00425: function WebForm_GetElementById(elementId) {
00426: if (document.getElementById) {
00427: return document.getElementById(elementId);
00428: }
00429: else if (document.all) {
00430: return document.all[elementId];
00431: }
00432: else return null;
00433: }
00434: function WebForm_GetElementByTagName(element, tagName) {
00435: var elements = WebForm_GetElementsByTagName(element, tagName);
00436: if (elements && elements.length > 0) {
00437: return elements[0];
00438: }
00439: else return null;
00440: }
00441: function WebForm_GetElementsByTagName(element, tagName) {
00442: if (element && tagName) {
00443: if (element.getElementsByTagName) {
00444: return element.getElementsByTagName(tagName);
00445: }
00446: if (element.all && element.all.tags) {
00447: return element.all.tags(tagName);
00448: }
00449: }
00450: return null;
00451: }
00452: function WebForm_GetElementDir(element) {
00453: if (element) {
00454: if (element.dir) {
00455: return element.dir;
00456: }
00457: return WebForm_GetElementDir(element.parentNode);
00458: }
00459: return "ltr";
00460: }
00461: function WebForm_GetElementPosition(element) {
00462: var result = new Object();
00463: result.x = 0;
00464: result.y = 0;
00465: result.width = 0;
00466: result.height = 0;
00467: if (element.offsetParent) {
00468: result.x = element.offsetLeft;
00469: result.y = element.offsetTop;
00470: var parent = element.offsetParent;
00471: while (parent) {
00472: result.x += parent.offsetLeft;
00473: result.y += parent.offsetTop;
00474: var parentTagName = parent.tagName.toLowerCase();
00475: if (parentTagName != "table" &&
00476: parentTagName != "body" &&
00477: parentTagName != "html" &&
00478: parentTagName != "div" &&
00479: parent.clientTop &&
00480: parent.clientLeft) {
00481: result.x += parent.clientLeft;
00482: result.y += parent.clientTop;
00483: }
00484: parent = parent.offsetParent;
00485: }
00486: }
00487: else if (element.left && element.top) {
00488: result.x = element.left;
00489: result.y = element.top;
00490: }
00491: else {
00492: if (element.x) {
00493: result.x = element.x;
00494: }
00495: if (element.y) {
00496: result.y = element.y;
00497: }
00498: }
00499: if (element.offsetWidth && element.offsetHeight) {
00500: result.width = element.offsetWidth;
00501: result.height = element.offsetHeight;
00502: }
00503: else if (element.style && element.style.pixelWidth && element.style.pixelHeight) {
00504: result.width = element.style.pixelWidth;
00505: result.height = element.style.pixelHeight;
00506: }
00507: return result;
00508: }
00509: function WebForm_GetParentByTagName(element, tagName) {
00510: var parent = element.parentNode;
00511: var upperTagName = tagName.toUpperCase();
00512: while (parent && (parent.tagName.toUpperCase() != upperTagName)) {
00513: parent = parent.parentNode ? parent.parentNode : parent.parentElement;
00514: }
00515: return parent;
00516: }
00517: function WebForm_SetElementHeight(element, height) {
00518: if (element && element.style) {
00519: element.style.height = height + "px";
00520: }
00521: }
00522: function WebForm_SetElementWidth(element, width) {
00523: if (element && element.style) {
00524: element.style.width = width + "px";
00525: }
00526: }
00527: function WebForm_SetElementX(element, x) {
00528: if (element && element.style) {
00529: element.style.left = x + "px";
00530: }
00531: }
00532: function WebForm_SetElementY(element, y) {
00533: if (element && element.style) {
00534: element.style.top = y + "px";
00535: }
00536: }
00001: function TreeView_HoverNode(data, node) {
00002: node.hoverClass = data.hoverClass;
00003: WebForm_AppendToClassName(node, data.hoverClass);
00004: if (__nonMSDOMBrowser) {
00005: node = node.childNodes[node.childNodes.length - 1];
00006: }
00007: else {
00008: node = node.children[node.children.length - 1];
00009: }
00010: node.hoverHyperLinkClass = data.hoverHyperLinkClass;
00011: WebForm_AppendToClassName(node, data.hoverHyperLinkClass);
00012: }
00013: function TreeView_GetNodeText(node) {
00014: var trNode = WebForm_GetParentByTagName(node, "TR");
00015: var outerNodes;
00016: if (trNode.childNodes[trNode.childNodes.length - 1].getElementsByTagName) {
00017: outerNodes = trNode.childNodes[trNode.childNodes.length - 1].getElementsByTagName("A");
00018: if (!outerNodes || outerNodes.length == 0) {
00019: outerNodes = trNode.childNodes[trNode.childNodes.length - 1].getElementsByTagName("SPAN");
00020: }
00021: }
00022: var textNode = (outerNodes && outerNodes.length > 0) ?
00023: outerNodes[0].childNodes[0] :
00024: trNode.childNodes[trNode.childNodes.length - 1].childNodes[0];
00025: return (textNode && textNode.nodeValue) ? textNode.nodeValue : "";
00026: }
00027: function TreeView_PopulateNode(data, index, node, selectNode, selectImageNode, lineType, text, path, databound, datapath, parentIsLast) {
00028: var context = new Object();
00029: context.data = data;
00030: context.node = node;
00031: context.selectNode = selectNode;
00032: context.selectImageNode = selectImageNode;
00033: context.lineType = lineType;
00034: context.index = index;
00035: context.isChecked = "f";
00036: var tr = WebForm_GetParentByTagName(node, "TR");
00037: if (tr) {
00038: var checkbox = tr.getElementsByTagName("INPUT");
00039: if (checkbox && (checkbox.length > 0)) {
00040: for (var i = 0; i < checkbox.length; i++) {
00041: if (checkbox[i].type.toLowerCase() == "checkbox") {
00042: if (checkbox[i].checked) {
00043: context.isChecked = "t";
00044: }
00045: break;
00046: }
00047: }
00048: }
00049: }
00050: var param = index + "|" + data.lastIndex + "|" + databound + context.isChecked + parentIsLast + "|" +
00051: text.length + "|" + text + datapath.length + "|" + datapath + path;
00052: TreeView_PopulateNodeDoCallBack(context, param);
00053: }
00054: function TreeView_ProcessNodeData(result, context) {
00055: var treeNode = context.node;
00056: if (result.length > 0) {
00057: var ci = result.indexOf("|", 0);
00058: context.data.lastIndex = result.substring(0, ci);
00059: ci = result.indexOf("|", ci + 1);
00060: var newExpandState = result.substring(context.data.lastIndex.length + 1, ci);
00061: context.data.expandState.value += newExpandState;
00062: var chunk = result.substr(ci + 1);
00063: var newChildren, table;
00064: if (__nonMSDOMBrowser) {
00065: var newDiv = document.createElement("div");
00066: newDiv.innerHTML = chunk;
00067: table = WebForm_GetParentByTagName(treeNode, "TABLE");
00068: newChildren = null;
00069: if ((typeof(table.nextSibling) == "undefined") || (table.nextSibling == null)) {
00070: table.parentNode.insertBefore(newDiv.firstChild, table.nextSibling);
00071: newChildren = table.previousSibling;
00072: }
00073: else {
00074: table = table.nextSibling;
00075: table.parentNode.insertBefore(newDiv.firstChild, table);
00076: newChildren = table.previousSibling;
00077: }
00078: newChildren = document.getElementById(treeNode.id + "Nodes");
00079: }
00080: else {
00081: table = WebForm_GetParentByTagName(treeNode, "TABLE");
00082: table.insertAdjacentHTML("afterEnd", chunk);
00083: newChildren = document.all[treeNode.id + "Nodes"];
00084: }
00085: if ((typeof(newChildren) != "undefined") && (newChildren != null)) {
00086: TreeView_ToggleNode(context.data, context.index, treeNode, context.lineType, newChildren);
00087: treeNode.href = document.getElementById ?
00088: "javascript:TreeView_ToggleNode(" + context.data.name + "," + context.index + ",document.getElementById('" + treeNode.id + "'),'" + context.lineType + "',document.getElementById('" + newChildren.id + "'))" :
00089: "javascript:TreeView_ToggleNode(" + context.data.name + "," + context.index + "," + treeNode.id + ",'" + context.lineType + "'," + newChildren.id + ")";
00090: if ((typeof(context.selectNode) != "undefined") && (context.selectNode != null) && context.selectNode.href &&
00091: (context.selectNode.href.indexOf("javascript:TreeView_PopulateNode", 0) == 0)) {
00092: context.selectNode.href = treeNode.href;
00093: }
00094: if ((typeof(context.selectImageNode) != "undefined") && (context.selectImageNode != null) && context.selectNode.href &&
00095: (context.selectImageNode.href.indexOf("javascript:TreeView_PopulateNode", 0) == 0)) {
00096: context.selectImageNode.href = treeNode.href;
00097: }
00098: }
00099: context.data.populateLog.value += context.index + ",";
00100: }
00101: else {
00102: var img = treeNode.childNodes ? treeNode.childNodes[0] : treeNode.children[0];
00103: if ((typeof(img) != "undefined") && (img != null)) {
00104: var lineType = context.lineType;
00105: if (lineType == "l") {
00106: img.src = context.data.images[13];
00107: }
00108: else if (lineType == "t") {
00109: img.src = context.data.images[10];
00110: }
00111: else if (lineType == "-") {
00112: img.src = context.data.images[16];
00113: }
00114: else {
00115: img.src = context.data.images[3];
00116: }
00117: var pe;
00118: if (__nonMSDOMBrowser) {
00119: pe = treeNode.parentNode;
00120: pe.insertBefore(img, treeNode);
00121: pe.removeChild(treeNode);
00122: }
00123: else {
00124: pe = treeNode.parentElement;
00125: treeNode.style.visibility="hidden";
00126: treeNode.style.display="none";
00127: pe.insertAdjacentElement("afterBegin", img);
00128: }
00129: }
00130: }
00131: }
00132: function TreeView_SelectNode(data, node, nodeId) {
00133: if ((typeof(data.selectedClass) != "undefined") && (data.selectedClass != null)) {
00134: var id = data.selectedNodeID.value;
00135: if (id.length > 0) {
00136: var selectedNode = document.getElementById(id);
00137: if ((typeof(selectedNode) != "undefined") && (selectedNode != null)) {
00138: WebForm_RemoveClassName(selectedNode, data.selectedHyperLinkClass);
00139: selectedNode = WebForm_GetParentByTagName(selectedNode, "TD");
00140: WebForm_RemoveClassName(selectedNode, data.selectedClass);
00141: }
00142: }
00143: WebForm_AppendToClassName(node, data.selectedHyperLinkClass);
00144: node = WebForm_GetParentByTagName(node, "TD");
00145: WebForm_AppendToClassName(node, data.selectedClass)
00146: }
00147: data.selectedNodeID.value = nodeId;
00148: }
00149: function TreeView_ToggleNode(data, index, node, lineType, children) {
00150: var img = node.childNodes[0];
00151: var newExpandState;
00152: try {
00153: if (children.style.display == "none") {
00154: children.style.display = "block";
00155: newExpandState = "e";
00156: if ((typeof(img) != "undefined") && (img != null)) {
00157: if (lineType == "l") {
00158: img.src = data.images[15];
00159: }
00160: else if (lineType == "t") {
00161: img.src = data.images[12];
00162: }
00163: else if (lineType == "-") {
00164: img.src = data.images[18];
00165: }
00166: else {
00167: img.src = data.images[5];
00168: }
00169: img.alt = data.collapseToolTip.replace(/\0\/, TreeView_GetNodeText(node));
00170: }
00171: }
00172: else {
00173: children.style.display = "none";
00174: newExpandState = "c";
00175: if ((typeof(img) != "undefined") && (img != null)) {
00176: if (lineType == "l") {
00177: img.src = data.images[14];
00178: }
00179: else if (lineType == "t") {
00180: img.src = data.images[11];
00181: }
00182: else if (lineType == "-") {
00183: img.src = data.images[17];
00184: }
00185: else {
00186: img.src = data.images[4];
00187: }
00188: img.alt = data.expandToolTip.replace(/\0\/, TreeView_GetNodeText(node));
00189: }
00190: }
00191: }
00192: catch(e) {}
00193: data.expandState.value = data.expandState.value.substring(0, index) + newExpandState + data.expandState.value.slice(index + 1);
00194: }
00195: function TreeView_UnhoverNode(node) {
00196: WebForm_RemoveClassName(node, node.hoverClass);
00197: if (__nonMSDOMBrowser) {
00198: node = node.childNodes[node.childNodes.length - 1];
00199: }
00200: else {
00201: node = node.children[node.children.length - 1];
00202: }
00203: WebForm_RemoveClassName(node, node.hoverHyperLinkClass);
00204: }
Comments (
)
)
Link to this page:
//www.vb-net.com/asp2/14/9.htm
|
|