///////////////////////////////////////////////////////// // // Copyright (c) 2002-2003 Softpress Systems Ltd. // All rights reserved. // http://www.softpress.com/ // ///////////////////////////////////////////////////////// var fwActiveMenus = new Array; if (NS4) document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE); if (NS4 || NS6) document.onmousemove = FWGetMousePos; document.onmouseup = HideAllMenus; /* ============= class "FWArea" ============= */ function FWArea(l, t, r, b) { this.left = l; this.top = t; this.right = r; this.bottom = b; } /* ============= class "FWMenu" ============= */ function FWMenu() { this.obj = null; this.submenuID = null; this.parentID = "_top"; this.itemArea = null; this.submenuArea = null; this.linkID = null; this.color = null; this.bgColor = null; } function SetFontColor(linkID, color) { if (!linkID) return; var obj; if (IE5 || NS6) obj = document.getElementById(linkID); else if (IE4) obj = document.all[linkID]; else if (NS4) obj = document[linkID]; if (!obj || !obj.style) return; obj.style.color = color; } function ChangeBGColor(obj, bgColor, linkID, color) { if (!obj) return; if (IE4 && obj.tagName.toUpperCase() == "TR") { for (var i = 0; i < obj.children.length; i++) obj.children[i].style.backgroundColor = bgColor; } else if (obj.style && !Opera) obj.style.backgroundColor = bgColor; if (linkID && color) SetFontColor(linkID, color); } function ResetBGColor(obj, linkID, color) { if (!obj) return; if (IE4 && obj.tagName.toUpperCase() == "TR") { for (var i = 0; i < obj.children.length; i++) obj.children[i].style.backgroundColor = "transparent"; } else if (obj.style && !Opera) obj.style.backgroundColor = "transparent"; if (linkID && color) SetFontColor(linkID, color); } function IsInArea(area) { if (!area) return false; return mouseX >= area.left && mouseX <= area.right && mouseY >= area.top && mouseY <= area.bottom; } function IsInMenu(menu) { if (IsInArea(menu.submenuArea)) return true; if (IsInArea(menu.itemArea)) return true; return false; } function Check() { var index = fwActiveMenus.length - 1; while (index >= 0 && !IsInMenu(fwActiveMenus[index])) { HideLayer(fwActiveMenus[index].submenuID); if (fwActiveMenus[index].obj) ResetBGColor(fwActiveMenus[index].obj, fwActiveMenus[index].linkID, fwActiveMenus[index].color); fwActiveMenus.length--; index--; } } function FWGetMousePos(e) { GetMousePosition(e); Check(); } function HideAllMenus() { var index = fwActiveMenus.length - 1; while (index >= 0) { HideLayer(fwActiveMenus[index].submenuID); if (fwActiveMenus[index].obj) ResetBGColor(fwActiveMenus[index].obj, fwActiveMenus[index].linkID, fwActiveMenus[index].color); index--; } fwActiveMenus.length = 0; } function SetPosBelow(obj, layer) { layer.left = GetObjectLeft(obj)+"px"; layer.top = (GetObjectTop(obj) + GetObjectHeight(obj)) + "px"; } function SetPosRight(obj, layer) { layer.left = (GetObjectLeft(obj) + GetObjectWidth(obj) - kDMMoveLeft)+"px"; layer.top = (GetObjectTop(obj) - kDMMoveTop) + "px"; }