var Menu_Supported = false; if (navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.appVersion.substring(0,1) > 3) { Menu_Supported = true; } if (Menu_Supported) { var newLineChar = String.fromCharCode(10); var char34 = String.fromCharCode(34); var CurMenu = ""; var IsMenuDropDown = true; var HTMLStr; var x = 0; var y = 0; var x2 = 0; var y2 = 0; var MenuMinWidth = 995; // Izpolzwam go za shirochina na menuto var ToolbarMenu; var aDefColor = new Array(3); var aCurColor = new Array(3); var Font; var MaxMenu = 10; var TotalMenu = 0; var arrMenuInfo = new Array(10); document.write(""); HTMLStr = ""; document.write(HTMLStr); Menu.style.backgroundColor = aDefColor[0]; resizeMenu(); for (i = 0; i < TotalMenu; i++) { thisMenu = document.all(arrMenuInfo[i].IDStr); if (thisMenu != null) thisMenu.style.width = arrMenuInfo[i].width + 'ex'; } } function resizeMenu() { Menu.style.width = MenuMinWidth // tova e izmisleno za shirochina // tova otdolu beshe originalnoto // w = Math.max(MenuMinWidth, document.body.clientWidth) - MenuMinWidth; // Menu.style.width = MenuMinWidth + w; } function setDefaultMenuColor(bgColor, fontColor, mouseoverColor) { if (bgColor != "") aDefColor[0] = bgColor; if (fontColor != "") aDefColor[1] = fontColor; if (mouseoverColor != "") aDefColor[2] = mouseoverColor; } function setSubMenuWidth(MenuIDStr) { var fFound = false; if (TotalMenu == MaxMenu) { alert("Unable to process menu. Maximum of " + MaxMenu + " reached."); return; } for (i = 0; i < TotalMenu; i++) if (arrMenuInfo[i].IDStr == MenuIDStr) { fFound = true; break; } if (!fFound) { arrMenuInfo[i] = new menuInfo(MenuIDStr); TotalMenu += 1; } } // This function creates a menuInfo object instance. function menuInfo(MenuIDStr) { this.IDStr = MenuIDStr; this.width = 0; this.count = 0; } function updateSubMenuWidth(MenuIDStr, SubMenuStr) { for (i = 0; i < TotalMenu; i++) if (arrMenuInfo[i].IDStr == MenuIDStr) { if (arrMenuInfo[i].width < SubMenuStr.length) arrMenuInfo[i].width = SubMenuStr.length; arrMenuInfo[i].count = arrMenuInfo[i].count + 1; break; } } function addMenu(MenuIDStr, MenuDisplayStr, MenuURLStr) { /* if (addMenu.arguments.length > 3) TargetStr = addMenu.arguments[3]; else TargetStr = "_top"; */ tagStr = ""; MenuStr = newLineChar; MenuStr += "" + " " + MenuDisplayStr + " "; MenuStr += tagStr; HTMLStr = HTMLStr.replace(tagStr, MenuStr); setSubMenuWidth(MenuIDStr); } function addSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr) { /* if (addSubMenu.arguments.length > 3) TargetStr = addSubMenu.arguments[3]; else TargetStr = "_top"; */ var MenuPos = MenuIDStr.toUpperCase().indexOf("MENU"); if (MenuPos == -1) MenuPos = MenuIDStr.length; var LookUpTag = ""; var sPos = HTMLStr.indexOf(LookUpTag); if (sPos <= 0) HTMLStr += newLineChar + newLineChar + ""; else HTMLStr = HTMLStr.replace(LookUpTag, TempStr); updateSubMenuWidth(MenuIDStr, SubMenuStr); } function mouseMenu(id, MenuIDStr) { IsMouseout = (id.toUpperCase().indexOf("OUT") != -1); if (IsMouseout) { color = aDefColor[1]; if (MenuIDStr == CurMenu && aCurColor[1] != "") color = aCurColor[1]; } else { color = aDefColor[2]; if (MenuIDStr == CurMenu && aCurColor[2] != "") color = aCurColor[2]; } window.event.srcElement.style.color = color; } function doMenu(MenuIDStr) { var thisMenu = document.all(MenuIDStr); if (ToolbarMenu == null || thisMenu == null || thisMenu == ToolbarMenu) { window.event.cancelBubble = true; return false; } // Reset dropdown menu window.event.cancelBubble = true; ToolbarMenu.style.display = "none"; showElement("SELECT"); showElement("OBJECT"); ToolbarMenu = thisMenu; // Set dropdown menu display position x = window.event.srcElement.offsetLeft + window.event.srcElement.offsetParent.offsetLeft; x2 = x + window.event.srcElement.offsetWidth; y = Menu.offsetHeight; thisMenu.style.top = y; thisMenu.style.left = x; thisMenu.style.clip = "rect(0 0 0 0)"; thisMenu.style.display = "block"; // delay 2 millsecond to allow the value of ToolbarMenu.offsetHeight be set window.setTimeout("showMenu()", 2); return true; } function showMenu() { if (ToolbarMenu != null) { y2 = y + ToolbarMenu.offsetHeight; ToolbarMenu.style.clip = "rect(auto auto auto auto)"; hideElement("SELECT"); hideElement("OBJECT"); } } function hideMenu() { if (ToolbarMenu != null && ToolbarMenu != StartMenu) { // Don't hide the menu if the mouse move between the menu and submenus cY = event.clientY + document.body.scrollTop; if ( (event.clientX >= (x+5) && event.clientX <= x2) && ((IsMenuDropDown == true && cY > (y-10) && cY <= y2) || (IsMenuDropDown == false && cY >= y && cY <= (y2+10)) )) { window.event.cancelBubble = true; return; } ToolbarMenu.style.display = "none"; ToolbarMenu = StartMenu; window.event.cancelBubble = true; showElement("SELECT"); showElement("OBJECT"); } } function hideElement(elmID) { for (i = 0; i < document.all.tags(elmID).length; i++) { obj = document.all.tags(elmID)[i]; if (! obj || ! obj.offsetParent) continue; // Find the element's offsetTop and offsetLeft relative to the BODY tag. objLeft = obj.offsetLeft; objTop = obj.offsetTop; objParent = obj.offsetParent; while (objParent.tagName.toUpperCase() != "BODY") { objLeft += objParent.offsetLeft; objTop += objParent.offsetTop; objParent = objParent.offsetParent; } // Adjust the element's offsetTop relative to the dropdown menu objTop = objTop - y; if (x > (objLeft + obj.offsetWidth) || objLeft > (x + ToolbarMenu.offsetWidth)) ; else if (objTop > ToolbarMenu.offsetHeight) ; else if (IsMSMenu && (y + ToolbarMenu.offsetHeight) <= 80) ; else obj.style.visibility = "hidden"; } } function showElement(elmID) { for (i = 0; i < document.all.tags(elmID).length; i++) { obj = document.all.tags(elmID)[i]; if (! obj || ! obj.offsetParent) continue; obj.style.visibility = ""; } }