/**
* Menu 990702
* by gary smith, July 1997
* Copyright (c) 1997-1999 Netscape Communications Corp.
*
* Menu 020903
* by doron rosenberg, September 2002
* Copyright (c) 1997-2002 Netscape Communications Corp.
*
* Menu 030409
* by doron rosenberg <doron at netscape.com>, April 2003 - fix for strict doctypes
* Copyright (c) 1997-2003 Netscape Communications Corp.
*
* Netscape grants you a royalty free license to use or modify this
* software provided that this copyright notice appears on all copies.
* This software is provided "AS IS," without a warranty of any kind.
*
* The Javascript Menu Component sample code is an opensource/freeware
* product that has been approved by SMI Legal and CS&P for use with
* Sun Java Web Console and other Sun products which incorporate the Sun
* Java Web Console.
* Any proposed use with another Sun product or for other Sun internal
* development purposes requires a separate request for review and
* must be separately approved.
*/
this.type = "Menu";
this.fontSize = "12px";
this.fontWeight = "plain";
this.fontFamily = "sans-serif";
this.fontColor = "#003399";
this.fontColorHilite = "#003399";
this.bgColor = "#ffffff";
this.menuBorder = 1;
this.menuItemBorder = 1;
this.menuItemBgColor = "#ffffff";
this.menuLiteBgColor = "#333333";
this.menuBorderBgColor = "#666666";
this.menuHiliteBgColor = "#ffffff";
this.menuContainerBgColor = "#cccccc";
this.childMenuIcon = "images/arrows.gif";
this.childMenuIconHilite = "images/arrows2.gif";
this.items = new Array();
this.actions = new Array();
this.colors = new Array();
this.mouseovers = new Array();
this.mouseouts = new Array();
this.childMenus = new Array();
this.addMenuItem = addMenuItem;
this.addMenuSeparator = addMenuSeparator;
this.writeMenus = writeMenus;
this.onMenuItemOver = onMenuItemOver;
this.onMenuItemOut = onMenuItemOut;
this.onMenuItemDown = onMenuItemDown;
this.onMenuItemAction = onMenuItemAction;
this.hideChildMenu = hideChildMenu;
this.mouseTracker = mouseTracker;
this.setMouseTracker = setMouseTracker;
this.setMouseTracker();
}
}
}
function addMenuSeparator() {
this.menuItemBorder = 0;
}
if (eval("document.width"))
}
}
return;
}
var countMenus = 0;
var countItems = 0;
var top = 0;
var content = '';
var proto;
content += ''+
'<DIV ID="menuLayer'+ countMenus +'" STYLE="position:absolute;left:10px;top:'+ (i * 100) +'px;visibility:hidden;">\n'+
' <div id="menuLite'+ countMenus +'" style="position:absolute;left:'+ proto.menuBorder +'px;top:'+ proto.menuBorder +'px;visibility:hide;" onMouseOut="hideMenu(event);">\n'+
'';
var x=i;
var childMenu = false;
var defaultHeight = 18;
var defaultIndent = 10;
childMenu = true;
defaultIndent = 0;
defaultHeight = null;
}
}
var itemProps = 'visibility:hide;font-Family:' + proto.fontFamily +';font-Weight:' + proto.fontWeight + ';fontSize:' + proto.fontSize + ';';
itemProps += 'font-size:' + proto.fontSize + ';" onMouseOver="onMenuItemOver(event,this);" onMouseOut="onMenuItemOut(event,this);" onClick="onMenuItemAction(event,this);';
var dTag = '<div class="menuItemText" id="menuItem'+ countItems +'" style="position:absolute;left:0;top:'+ (i * proto.menuItemHeight) +';'+ itemProps +'">';
var dText = '<div id="menuItemText'+ countItems +'" style="position:absolute;left:' + proto.menuItemIndent + 'px;top:0;color:'+ proto.fontColor +';">'+ item +'</div>\n<div id="menuItemHilite'+ countItems +'" style="position:absolute;text-decoration:underline;cursor: pointer; cursor: hand;left:' + proto.menuItemIndent + 'px;top:0;color:'+ proto.fontColorHilite +';visibility:hidden;">'+ item +'</div>';
if (item == "separator") {
content += ( dTag + '<div id="menuSeparator'+ countItems +'" style="position:absolute;left:' + proto.menuItemIndent + 'px;cursor:default;top:1px;">'+' '+'</div>\n<div id="menuSeparatorLite'+ countItems +'" style="position:absolute;left:' + proto.menuItemIndent + 'px;top:1px;cursor:default;">'+ ' '+'</div>\n</div>');
} else if (i == 0) { // menu title
content += ( '<div class="menuItemText" id="menuItem'+ countItems +'" style="position:absolute;left:0;top:'+ (i * proto.menuItemHeight) +';'+ 'visibility:hide;font-Family:' + proto.fontFamily +';font-Weight:' + proto.fontWeight + ';fontSize:' + proto.fontSize + ';' +'">' + '<div id="menuItemText'+ countItems +'" style="font-weight:bold;position:absolute;left:' + proto.menuItemIndent + 'px;top:0;cursor:default;color:'+ proto.fontColor +';">'+ item +'</div>\n<div id="menuItemHilite'+ countItems +'" style="font-weight:bold;position:absolute;left:' + proto.menuItemIndent + 'px;top:0;color:'+ proto.fontColor +';cursor:default;visibility:hidden;">'+ item +'</div>\n</div>');
} else if (childMenu) {
content += ( dTag + dText + '<div id="childMenu'+ countItems +'" style="position:absolute;left:0;top:3;'+ itemProps +'"><img src="'+ proto.childMenuIcon +'"></div>\n</div>');
} else {
}
countItems++;
}
content += ' <div id="focusItem'+ countMenus +'" style="position:absolute;left:0;top:0;visibility:hide;" onClick="onMenuItemAction(null,this);"> </div>\n';
content += ' </DIV>\n </DIV>\n</DIV>\n';
i=x;
}
if (!container) return;
} else {
else{
}
}
proto = null;
if (n>0) l.top = body.document.layers[n-1].top + body.document.layers[n-1].clip.height + proto.menuItemBorder;
l.hilite = null;
}
}
//body.document.layers[n].onfocus = proto.onMenuItemDown;
}
}
var menuCount = 0;
}
// proto.menuItemWidth = proto.menuItemWidth || 200;
if (i>0) l.style.pixelTop = container.document.all["menuItem" + (menuCount -1)].style.pixelTop + container.document.all["menuItem" + (menuCount -1)].style.pixelHeight + proto.menuItemBorder;
if (childItem) {
}
if (sep) {
l.isSeparator = true
}
menuCount++;
}
container.menus[x].menuLayer.style.pixelWidth = proto.menuWidth || proto.menuItemWidth + (proto.menuBorder * 2) +2;
}
}
container.document.all("menuContainer").style.backgroundColor = container.menus[0].menuContainerBgColor;
var menuCount = 0;
}
if (i>0) l.style.top = (parseInt(document.getElementById("menuItem" + (menuCount -1)).style.top,10) + parseInt(document.getElementById("menuItem" + (menuCount -1)).style.height,10) + proto.menuItemBorder) + "px";
if (childItem) {
}
if (sep) {
l.isSeparator = true
}
menuCount++;
}
container.menus[x].menuLayer.style.width = (proto.menuWidth || proto.menuItemWidth + (proto.menuBorder * 2) +2) + "px";
}
}
document.getElementById("menuContainer").style.backgroundColor = container.menus[0].menuContainerBgColor;
}
}
function onMenuItemOver(e, l, a) {
l = l || this;
a = a || window.ActiveMenuItem;
if (a) {
} else {
a = new Object();
}
} else {
}
}
}
if (l.hilite) {
l.zIndex = 1;
}
l.Menu.hideChildMenu(l);
if (a) {
} else {
a = new Object();
}
} else {
}
}
}
if (l.isSeparator) return;
if (l.hilite) {
}
l.zIndex = 1;
l.Menu.hideChildMenu(l);
} else if (document.getElementById){
if (a) {
} else {
a = new Object();
}
} else {
}
}
}
if (l.hilite) {
}
l.zIndex = 1;
l.Menu.hideChildMenu(l);
}
window.ActiveMenuItem = l;
}
function onMenuItemOut(e, l, a) {
if (!document.all && !document.layers && e.currentTarget.nodeType == 1 && e.currentTarget.tagName == 'DIV')
return true;
l = l || this;
a = a || window.ActiveMenuItem;
if (a && l.top) {
l.top = -30;
} else {
}
}
}
} else if (a && l.style) {
document.onmousedown=null;
else
e.cancelBubble=true;
if (l.mouseout) {
} else {
}
}
}
}
}
}
function onMenuItemAction(e, l) {
l = window.ActiveMenuItem;
if (!l) return;
// if (!ActiveMenu.Menu.disableHide) hideActiveMenus(ActiveMenu.menuLayer);
if (l.action) {
}
}
if (menu) {
if (typeof(menu) == "string") {
if (l) break;
}
}
if (!l) return;
}
l.left = 1;
l.top = 1;
hideActiveMenus(l);
if (this.visibility) l = this;
window.ActiveMenu = l;
} else {
var l = child;
}
if (!l) return;
}
if (l.parentLayer) {
if (x != "relative")
if (y != "relative")
if (l.parentLayer.isContainer) {
if (l.parentLayer.menuContainerBgColor) l.parentLayer.document.bgColor = l.parentLayer.menuContainerBgColor;
}
}
l.visibility = "inherit";
hideActiveMenus(l);
if (typeof(menu) == "string") {
if (l) break;
}
}
}
window.ActiveMenu = l;
if (x != "relative")
if (y != "relative")
} else if (document.getElementById) {
hideActiveMenus(l);
if (typeof(menu) == "string") {
if (l) break;
}
}
}
window.ActiveMenu = l;
if (x != "relative")
if (y != "relative")
}
if (menu) {
}
}
function hideMenu(e) {
if (!document.all && e.currentTarget && e.currentTarget.tagName && e.currentTarget.tagName == 'DIV')
return true;
var l = e || window.ActiveMenu;
if (!l) return true;
if (l.menuLayer) {
l = l.menuLayer;
} else if (this.visibility) {
l = this;
}
if (l.menuLayer) {
l = l.menuLayer;
}
var a = window.ActiveMenuItem;
if (mDrag.oldX <= e.pageX+3 && mDrag.oldX >= e.pageX-3 && mDrag.oldY <= e.pageY+3 && mDrag.oldY >= e.pageY-3) {
if (window.ActiveMenu) return true;
}
document.onmousedown=null;
if (a) {
}
return true;
}
document.onmousedown=null;
if (a) {
}
return true;
}
}
if (window.ActiveMenu) {
}
}
hideActiveMenus(l);
return true;
}
var l = menuLayer || this;
}
}
if (l.childMenu) {
} else {
}
//l.childMenu.style.pixelLeft = l.parentLayer.left - l.parentLayer.clip.width;
} else {
l.childMenu.style.pixelLeft = l.Menu.menuLayer.style.pixelWidth + l.Menu.menuLayer.style.pixelLeft -5;
}
} else if (document.getElementById) {
l.childMenu.style.top = (parseInt(l.style.top,10) + parseInt(l.Menu.menuLayer.style.top, 10)) + "px";
l.childMenu.style.left = (parseInt(l.childMenu.style.width,10) + parseInt(l.Menu.menuLayer.style.top,10) + 15) + "px";
//l.childMenu.style.pixelLeft = l.parentLayer.left - l.parentLayer.clip.width;
} else {
l.childMenu.style.left = (parseInt(l.Menu.menuLayer.style.width,10) + parseInt(l.Menu.menuLayer.style.left,10) -5) + "px";
}
}
if (!l.childMenu.disableHide)
}
}
function hideActiveMenus(l) {
if (!window.activeMenus) return;
if (!activeMenus[i]) return;
} else if (activeMenus[i].style) {
}
}
}
function mouseTracker(e) {
}
function setMouseTracker() {
if (document.captureEvents) {
}
}
}
function menuTracker() {
if (off < 0) {
} else if (off > 0) {
}
}
if (off < 0) {
} else if (off > 0) {
}
}
if (off < 0) {
} else if (off > 0) {
}
}
if (off < 0) {
} else if (off > 0) {
}
}
}
}
function onMenuItemDown(e, l) {
l = l || window.ActiveMenuItem || this;
if (!l.Menu) {
} else {
mDrag.startMenuDrag(e);
mDrag.startMenuDrag(e);
} else if (document.getElementById) {
mDrag.startMenuDrag(e);
}
}
}
function startMenuDrag(e) {
if (e.which > 1) {
window.ActiveMenu = null;
return true;
}
var x = e.pageX;
var y = e.pageY;
} else if (document.getElementById) {
if (e.which > 1) {
window.ActiveMenu = null;
return true;
}
var x = e.pageX;
var y = e.pageY;
}
return false;
}
function doMenuDrag(e) {
return false; //for IE
} else if (document.getElementById){
// alert(mDrag.dragLayer.left)
}
}