home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2001-03-20 | 58.4 KB | 1,494 lines
WmbConst = { // menu types T_HOR : 1, T_VER : 2, // menu item open events E_OVER : 'onmouseover', E_CLICK : 'onclick', // cursor types C_HAND : 'hand', C_ARROW : 'arrow', C_MOVE : 'move', C_TEXT : 'text', C_HOURGLASS : 'hourglass', C_HELP : 'help', C_NRESIZE : 'n-resize', C_SRESIZE : 's-resize', C_ERESIZE : 'e-resize', C_WRESIZE : 'w-resize', C_NERESIZE : 'ne-resize', C_NWRESIZE : 'nw-resize', C_SERESIZE : 'se-resize', C_SWRESIZE : 'sw-resize', // placement P_LEFT : 1, P_RIGHT : 2, P_TOP : 3, P_BOTTOM: 4, // alignment (hor & ver) A_LEFT : 'left', A_RIGHT : 'right', A_CENTER : 'center', A_TOP : 'top', A_BOTTOM : 'bottom', // submenu opening effects EF_NORMAL : 1, EF_SMOOTHHOR : 2, EF_SMOOTHVER : 3, EF_SMOOTHDIAG : 4, stub : 'end' // end stub.. ignore } var wmbBrowser = new WmbBrowser(); var wmbLayers = []; var wmbSubLayers = []; var wmbMDStack = new WmbStack(); // to keep proper mousedown event handling var wmbMMStack = new WmbStack(); // to keep proper mousemove event handling function wmbMakeMenu(id, type, x, y, isMoveable, bgimg, bgcolor, border, borderColor, borderLightColor, borderDarkColor) { var a = arguments; var i = 0; var m = new Menu(id, type, x, y); _wmbsetval(m, "isMoveable", isMoveable); _wmbsetval(m, "bgimg", bgimg); m.bgcolor = bgcolor; m.border = border; _wmbsetval(m, "borderColor", borderColor); _wmbsetval(m, "borderLightColor", borderLightColor); _wmbsetval(m, "borderDarkColor", borderDarkColor); return m; } function Menu(id, type, x, y) { this.id = id || 'submenu' + Menu.idcount++; this.type = type;// || WmbConst.T_HOR; this.x = x; this.y = y; this.items = []; this.ancestor = this; // keep in master lists Menu.menus[Menu.menus.length]=this; Menu.menusbyid[this.id]=this; // set these individually if you want them to be different this.isMoveable = false; this.bgimg = null; this.bgcolor = '#cccccc'; this.border = 2; this.borderColor=null; this.borderLightColor = '#eeeeee'; this.borderDarkColor = '#aaaaaa'; // not supported this.roimg = null; } Menu.voidgif="void.gif"; Menu.menus=[] //all menus Menu.menusbyid=[] //a hash to all menus Menu.idcount=0 // for anonymous submenus Menu.oldonload=document.onload // keep for safekeeping Menu.shortonload=false // short circuit onload Menu.onload=function() { // make sure this runs only once if (Menu.shortonload) return; Menu.shortonload = true; for (i = 0; i < Menu.menus.length; i++) { menu = Menu.menus[i]; // if it is an ancestor write it if (menu.ancestor == menu) menu.write(); } if (wmbBrowser.is_nav) { document.captureEvents(Event.CLICK); document.captureEvents(Event.MOUSEDOWN); } // for some reason all browser will require two clicks unless mousedown // is bound as well if (document.onmousedown) { wmbMDStack.push(document.onmousedown); } document.onmousedown=_wmbclosemenus; document.onclick=_wmbclosemenus; // call old onload if there was one if (Menu.oldonload && Menu.oldonload != Menu.onload) { Menu.oldonload(); } } Menu.prototype.addChild=function(menuItem) { this.items[this.items.length]=menuItem; this.menuitemsbyid[menuItem.id] = menuItem; menuItem.parent = this; if (menuItem.submenu) menuItem.submenu.ancestor = this.ancestor; } Menu.prototype.menuitemsbyid=[] // a hash to all menuitems Menu.prototype.getChild=function(itemid) { return this.menuitemsbyid[itemid]; } Menu.prototype.render=function(type) { // debug check if (type && type != "") {} else alert("Invalid type in Menu.render()"); // adjust menu type to reasonable default if (this.type != WmbConst.T_VER) this.type = WmbConst.T_HOR; // netscape border var border = this.border || 0; if (--border < 1) border++; var debug=0; var nsborder =''; if (wmbBrowser.is_nav4 && this.border > 0) { nsborder= '<tr bgcolor='+this.borderLightColor+'><td rowspan=2><table cellspacing=0 cellpadding='+border+' border='+debug+'><tr><td></td></tr></table></td><td colspan=2><table width=100% cellspacing=0 cellpadding='+border+' border='+debug+'><tr><td></td></tr></table></td></tr>'; } // the basic outer wrapper var html = '<table cellspacing=0 cellpadding=0 ' + all_noth('bgcolor="', this.bgcolor, '" ') + (wmbBrowser.is_nav4?'border=0':all_noth('border=', this.border, ' ')) + all_noth('borderColor="', this.borderColor, '" ') + all_noth('borderColorLight="', this.borderLightColor, '" ') + all_noth('borderColorDark="', this.borderDarkColor, '" ') + ((0==this.border)?' frame=void ': '') + ' rules=none class=wmbouter>' + nsborder + '<tr><td><table cellspacing=0 cellpadding=0 border=0 class=tbl' + type + ' ' + all_noth('background="',this.bgimg,'" ') + '><tr valign=center>'; // Go to next line if vertical menu var vopen=' '; var vclose= ' '; if (this.type == WmbConst.T_VER) { vclose = '</tr>'; vopen = '<tr valign=bottom>'; } // Render all items var prefix = ""; // don't start new row on vertical if not necessary for (var i = 0; i < this.items.length; i++) { // leave the last row open on vertical menus var suffix=(i + 1 < this.items.length) ? vclose : ""; html += prefix + this.items[i].render() + suffix; prefix = vopen; // after the first start opening new lines } nsborder = ''; if (wmbBrowser.is_nav4 && this.border > 0) { nsborder= '<td bgcolor='+this.borderDarkColor+' rowspan=3><table cellspacing=0 cellpadding='+border+' border='+debug+'><tr><td></td></tr></table></td></tr><tr><td colspan=2 bgcolor='+this.borderDarkColor+'><table width=100% cellspacing=0 cellpadding='+border+' border='+debug+'><tr><td></td></tr></table></td>'; } // close the tables return html + '</tr></table></td>'+nsborder+'</tr></table>'; } Menu.prototype.write=function() { text = this.render('wmbmenubar'); if (wmbBrowser.is_ie4up) { document.all[this.id].innerHTML = text; // remember this baby wmbLayers[this.id] = document.all[this.id]; } else if (wmbBrowser.is_nav4 ) { var lyr; //alert(this.id + " " + this.ancestor.id); lyr = document.layers[this.id].document; // remember this baby wmbLayers[this.id] = document.layers[this.id]; lyr.open(); lyr.write( text ); lyr.close(); } else { document.getElementById(this.id).innerHTML = text; // remember this baby // wmbLayers[this.id] = document.getElementById(this.id); } // remember to use later wmbLayers[this.id].items = this.items; // if we have a pin, then move the menu there if (this.idpin) { this.moveMenu(wmb_get_xpos(this.idpin), wmb_get_ypos(this.idpin)); // move to my default position } else if (!isNaN(this.x) && !isNaN(this.y) && 'null' != ''+this.x && 'null' != ''+this.y) { this.moveMenu(this.x,this.y); } } Menu.prototype.createLayer=function(layerID, text) { // All layers will be top-level for simpler repositioning if (wmbBrowser.is_ie4up) { //alert(layerID + " " + this.ancestor + " " + text); document.all[this.ancestor.id].insertAdjacentHTML("AfterEnd", '<div id="' + layerID + '" class=wmbsubmenu>' + text + '</div>' ); // hide this layer document.all[layerID].style.visibility = "hidden"; // keep a ref for later wmbLayers[layerID] = document.all[layerID]; } else if (wmbBrowser.is_nav4){ var thisLayer = new Layer(1); thisLayer.document.open(); thisLayer.document.writeln(text); thisLayer.document.close(); // hide layer thisLayer.visibility = "hidden"; // keep a ref for later wmbLayers[layerID] = thisLayer; } else { var newObj = document.createElement("div"); newObj.style.position="absolute"; newObj.setAttribute("id", layerID); newObj.setAttribute("class", "wmbsubmenu"); document.documentElement.appendChild(newObj); var rng = newObj.ownerDocument.createRange(); rng.selectNodeContents(newObj); rng.collapse(true); var frag = rng.createContextualFragment(text); newObj.appendChild(frag); // hide this layer newObj.style.visibility = "hidden"; // keep a ref for later wmbLayers[layerID] = newObj; } wmbSubLayers[wmbSubLayers.length] = layerID; } Menu.prototype.moveMenu=function(x,y) { if (wmbBrowser.is_nav4) { eval("document." + this.id + ".moveTo(x,y)"); } else if (wmbBrowser.is_ie4up) { document.all[this.id].style.pixelLeft = x; document.all[this.id].style.pixelTop = y; } else { document.getElementById(this.id).style.left = '' + x + 'px'; document.getElementById(this.id).style.top = '' + y + 'px'; } this.x = x; this.y = y; } Menu.prototype.setPin=function(pinname) { this.idpin = pinname; } function wmbMakeMenuItem(title, description, link, target, titleAlign, font, fontSize, isBold, isItalic, isUnderlined, color, rofont, rofontSize, roisBold, roisItalic, roisUnderlined, rocolor, icon, roicon, iconAlign, iconPlacement, bgcolor, robgcolor, cursor, paddingLeft, paddingRight, paddingBottom, paddingTop ) { var m = new MenuItem(title, description, link, target); _wmbMakeBaseItem(m, titleAlign, font, fontSize, isBold, isItalic, isUnderlined, color, rofont, rofontSize, roisBold, roisItalic, roisUnderlined, rocolor, icon, roicon, iconAlign, iconPlacement, bgcolor, robgcolor, cursor, paddingLeft, paddingRight, paddingBottom, paddingTop ); return m; } function _wmbMakeBaseItem(m, titleAlign, font, fontSize, isBold, isItalic, isUnderlined, color, rofont, rofontSize, roisBold, roisItalic, roisUnderlined, rocolor, icon, roicon, iconAlign, iconPlacement, bgcolor, robgcolor, cursor, paddingLeft, paddingRight, paddingBottom, paddingTop ) { _wmbsetval(m, "titleAlign", titleAlign); _wmbsetval(m, "font", font); _wmbsetval(m, "fontSize", fontSize); _wmbsetval(m, "isBold", isBold); _wmbsetval(m, "isItalic", isItalic); _wmbsetval(m, "isUnderlined", isUnderlined); _wmbsetval(m, "color", color); _wmbsetval(m, "rofont", rofont); _wmbsetval(m, "rofontSize", rofontSize); _wmbsetval(m, "roisBold", roisBold); _wmbsetval(m, "roisItalic", roisItalic); _wmbsetval(m, "roisUnderlined", roisUnderlined); _wmbsetval(m, "rocolor", rocolor); _wmbsetval(m, "icon", icon); _wmbsetval(m, "roicon", roicon); _wmbsetval(m, "iconAlign", iconAlign); _wmbsetval(m, "iconPlacement", iconPlacement); _wmbsetval(m, "bgcolor", bgcolor); _wmbsetval(m, "robgcolor", robgcolor); _wmbsetval(m, "cursor", cursor); _wmbsetval(m, "paddingLeft", paddingLeft); _wmbsetval(m, "paddingRight", paddingRight); _wmbsetval(m, "paddingBottom", paddingBottom); _wmbsetval(m, "paddingTop", paddingTop); return m; } function MenuItem(title, description, link, target) { this.id = 'menuitem' + MenuItem.idcount++; this.title = title; this.description = description; this.link = link; this.target = target; this.parent = null; // set when added to menu // set these individually if you want them to be different this.titleAlign = WmbConst.A_LEFT; this.font = null; this.fontSize = null; this.isBold = null; this.isItalic = null; this.isUnderlined = null; this.color = null; this.rofont = null; this.rofontSize = null; this.roisBold = null; this.roisItalic = null; this.roisUnderlined = null; this.rocolor = null; this.icon = null; this.roicon = null; this.iconAlign = WmbConst.A_CENTER; this.iconPlacement = WmbConst.P_LEFT; this.bgcolor = null; this.robgcolor = null; this.cursor = WmbConst.C_HAND; this.paddingLeft = 5; this.paddingRight = 5; this.paddingBottom = 2; this.paddingTop = 2; } MenuItem.idcount = 0 // to generate ids MenuItem.prototype.addSubMenu=function(submenu, suboptions) { this.submenu = submenu || new Menu(); this.suboptions = suboptions || new WmbSubOptions(); this.submenu.parent = this; // adjust menu type to reasonable default if (this.submenu.type != WmbConst.T_HOR) this.submenu.type = WmbConst.T_VER; if (this.parent) this.submenu.ancestor = this.parent.ancestor; } MenuItem.prototype.bindEvent=function(event, handler) { } MenuItem.tableidcount=0 MenuItem.prototype.render=function() { ////////////////////////////////////////////////// // calculate the submenu handler code (if any) var submenuhandler = ''; var hoverhandler='wmbrolleffects(\'' + this.parent.id + '\', \'' + this.id + '\', true);'; var outhandler='wmbrolleffects(\'' + this.parent.id + '\', \'' + this.id + '\', false);'; var clickhandler=''; if (this.submenu) { // call wmbopensubmenu(parentmenu, submenu, marker, ishorizontal) submenuhandler ='wmbopensubmenu(\'' + this.parent.id +'\',\''+ this.submenu.id +'\',\''+ 'mark' + this.submenu.id +'\', ' + ((this.parent.type != WmbConst.T_VER)?'true':'false') + ', \'' + this.id + '\', event);'; // if submenus should open on hover.. use this if (this.suboptions.openevent == WmbConst.E_OVER) { hoverhandler += submenuhandler; } else { clickhandler += submenuhandler; } } else { hoverhandler += 'wmbclosemenus(\'' + this.parent.id +'\')'; } ////////////////////////////////////////////////// // implement padding // var pad = this.computePadding(this.paddingLeft, this.paddingTop, this.paddingRight, this.paddingBottom); var style = this.computeStyle(); ////////////////////////////////////////////////// // menu item header var tableid = 'tableid'+MenuItem.tableidcount++; var html = '<table id=\'' + tableid + '\'' + all_noth(' bgcolor=\'', this.bgcolor, '\' ') + ' onmouseover="wmbsetbg(\'' + tableid + '\'' + all_noth(',\'',this.robgcolor,'\'')+');' + hoverhandler + '" onmouseout="wmbsetbg(\'' + tableid + '\'' + all_noth(',\'',this.bgcolor,'\'')+ ');' + outhandler + '" onclick="' + clickhandler + '" onmousedown="wmbStopBubbling=true" cellspacing=0 cellpadding=0 border=0 width=100% height=100%><tr>'; ////////////////////////////////////////////////// // if there's a submenu, create a marker for it var submenuStr = ""; //this.submenu.type = WmbConst.T_VER; // make submenu vertical // if there's a submenuimg use it var submenuimg='';//'<img height=2 width=10 src="'+Menu.voidgif+'" border=0>'; if (this.suboptions && this.suboptions.submenuimg) { submenuimg = '<img src="' + this.suboptions.submenuimg + '" border=0>'; } else if (wmbBrowser.is_nav4) { // bug workaround: if there's nothing here the system won't work submenuimg= '<table cellspacing=0 cellpadding=0><tr><td></td></tr></table>'; } // a submenu.. the marker will help us position the menu later var submenuid = this.submenu?' id="mark'+this.submenu.id+'"':''; var valign='top';//'center'; var align = 'right'; if (this.suboptions && this.suboptions.placement == WmbConst.P_BOTTOM) align='left'; var tmarker = '<tr height=0%><td><span ' + submenuid + ' class=wmbmarker></span></td></tr>'; var bmarker = ''; if (this.parent.type == WmbConst.T_HOR || (this.suboptions && this.suboptions.placement == WmbConst.P_BOTTOM)) { valign="bottom"; bmarker = tmarker; tmarker = ''; } if (this.parent.type == WmbConst.T_HOR) align="left"; submenuStr = '<td valign=' + valign +' align='+align+' width="1px">' + '<table cellspacing=0 cellpadding=1 border=0 height=100% valign=center>' + tmarker + '<tr height=100%><td valign=center>'+ submenuimg+'</td></tr>' + bmarker + '</table></td>'; if (this.submenu) { // creates a layer based on the recursive call this.parent.createLayer(this.submenu.id, this.submenu.render("wmbsubmenu")); // make a pointer to subitems that we'll need later wmbLayers[this.submenu.id].items = this.submenu.items; } // figure out where we'll need to place the submenu var vsubmenu = ''; var hsubmenu = ""; var hsuffix= ""; if (this.submenu && (this.parent.type == WmbConst.T_HOR || this.suboptions.placement == WmbConst.P_LEFT) && this.suboptions.placement != WmbConst.P_RIGHT) { hsubmenu = submenuStr; hsuffix = '<td></td>'; } else { vsubmenu = submenuStr; } // continue with the item itself html += hsubmenu + '<td '+style+' nowrap align="' + this.titleAlign + '">' + pad.beg + '<a class=wmbmenuitem onmousedown="wmbStopBubbling=true" ' + ' onmouseover="' + hoverhandler + '" ' + ' onmouseout="' + outhandler + '" ' + all_noth(' title="', this.description, '" '); var href = ''; if (!wmbBrowser.is_ie4up) { href = ' href="javascript:noop();" '; } ////////////////////////////////////////////////// // link: if there's a submenu we need to catch // events otherwise just a standard link if (this.submenu) { html += // do nothing on click href + // use the spec'd event to open this.suboptions.openevent + '="' + submenuhandler + '"'; } else { html += ((this.link)?'href="'+this.link+'"':href) + all_noth('target="',this.target, '" ') + ' onmouseover="' + hoverhandler +'" '; } ////////////////////////////////////////////////// // text attributes // var title = MenuItem.renderTitle(this); ////////////////////////////////////////////////// // icon and icon alignment // // def placement: left var iconPlacement = this.iconPlacement?this.iconPlacement:WmbConst.P_LEFT; var iconStr = all_noth('<IMG BORDER=0 ' + all_noth(' align="',this.iconAlign,'" ') + all_noth(' valign="',this.iconAlign,'" ') + ' NAME="img' + this.id + '" SRC="', this.icon, '">'); // figure out where it needs to go var liconStr = iconPlacement == WmbConst.P_LEFT?iconStr:''; liconStr = iconPlacement == WmbConst.P_TOP?iconStr+'<br>': liconStr; var riconStr = iconPlacement == WmbConst.P_RIGHT?iconStr:''; riconStr = iconPlacement == WmbConst.P_BOTTOM?'<br>'+iconStr: riconStr; ////////////////////////////////////////////////// // put it all together and send it html += '>' + liconStr + title + riconStr + '</a>' + pad.end + '</td>' + hsuffix + all_noth(null, vsubmenu) + '</tr></table>'; return '<td '+style+'>' + html + '</td>'; } MenuItem.prototype.computePadding=function() { var result = []; result.beg=''; result.end=''; if (!wmbBrowser.is_nav4) return result; var paddingLeft = this.paddingLeft;//-4; var paddingRight = this.paddingRight;//-4; var paddingTop = this.paddingTop;//-4; var paddingBottom = this.paddingBottom;//-4; paddingLeft = paddingLeft<0?0:paddingLeft; paddingRight = paddingRight<0?0:paddingRight; paddingTop = paddingTop<0?0:paddingTop; paddingBottom = paddingBottom<0?0:paddingBottom; var isPadded = paddingLeft || paddingRight || paddingTop || paddingBottom; var bpad=''; var epad=''; if (isPadded) { var debug = 0; bpad = '<table cellspacing=0 cellpadding=0 border='+debug+'><tr><td></td>'; if (paddingTop > 0) { bpad += '<td><table border='+debug+' cellspacing=0 cellpadding='+paddingTop+'><tr><td></td></tr></table></td>'; } else { bpad += '<td></td>'; } bpad += '<td></td></tr><tr>'; if (paddingLeft > 0) { bpad += '<td><table border='+debug+' cellspacing=0 cellpadding='+paddingLeft+'><tr><td></td></tr></table></td>'; } else { bpad += '<td></td>'; } bpad += '<td>'; epad += '</td>'; if (paddingRight > 0) { epad += '<td><table border='+debug+' cellspacing=0 cellpadding='+paddingRight+'><tr><td></td></tr></table></td>'; } else { epad += '<td></td>'; } epad += '</tr><tr><td></td>'; if (paddingBottom > 0) { epad += '<td><table border='+debug+' cellspacing=0 cellpadding='+paddingBottom+'><tr><td></td></tr></table></td>'; } else { epad += '<td></td>'; } epad += '<td></td></tr></table>'; } result.beg = bpad; result.end = epad; return result; } MenuItem.prototype.computeStyle=function() { var style = ''; if (!wmbBrowser.is_nav4) { style = ' style = "' + all_noth(' padding-top:', this.paddingTop,'px; ') + all_noth(' padding-left:',this.paddingLeft,'px; ') + all_noth(' padding-right:',this.paddingRight,'px; ') + all_noth(' padding-bottom:',this.paddingBottom,'px; ') + all_noth(' cursor:', this.cursor, ';') + ' align: middle; " '; } return style; } MenuItem.renderTitle=function(menuItem) { var title = ''; // netscape needs special handling because CSS doesn't work at // this level if (wmbBrowser.is_nav4) { title ='<font ' + all_noth(' face="',menuItem.font,'" ') + all_noth('point-size="', (parseInt(menuItem.fontSize) - 2), '" ') + // convert netscape point size to css point size all_noth('color="',menuItem.color,'" ') + '>' + true_noth(menuItem.isBold, '<b>') + true_noth(menuItem.isItalic, '<i>') + true_noth(menuItem.isUnderlined, '<u>') + all_noth(null, menuItem.title) + true_noth(menuItem.isUnderlined, '</u>') + true_noth(menuItem.isItalic, '</i>') + true_noth(menuItem.isBold, '</b>') + '</font>'; } else { title ='<span id="' + menuItem.id + '" style="' + all_noth('font-family: ',menuItem.font,'; ') + all_noth('font-size: ',menuItem.fontSize,'; ') + all_noth_conv('font-weight: ', menuItem.isBold,'; ','bold','normal') + all_noth_conv('font-style: ', menuItem.isItalic,'; ','italic','normal') + all_noth_conv('text-decoration: ', menuItem.isUnderlined,'; ','underline','none') + all_noth('color: ',menuItem.color,'; ') + all_noth('cursor: ', menuItem.cursor,'; ') + '">' + all_noth(null, menuItem.title) + '</span>'; } return title; } function wmbMakeDragItem(title, description, titleAlign, font, fontSize, isBold, isItalic, isUnderlined, color, rofont, rofontSize, roisBold, roisItalic, roisUnderlined, rocolor, icon, roicon, iconAlign, iconPlacement, bgcolor, robgcolor, cursor, paddingLeft, paddingRight, paddingBottom, paddingTop ) { var m = new WmbDragItem(title, description); _wmbMakeBaseItem(m, titleAlign, font, fontSize, isBold, isItalic, isUnderlined, color, rofont, rofontSize, roisBold, roisItalic, roisUnderlined, rocolor, icon, roicon, iconAlign, iconPlacement, bgcolor, robgcolor, cursor, paddingLeft, paddingRight, paddingBottom, paddingTop ); return m; } function WmbDragItem(title, description) { this.id = 'dragitem' + WmbDragItem.idcount++; this.title = title; this.description = description; this.parent = null; // set when added to menu // set these individually if you want them to be different this.titleAlign = WmbConst.A_CENTER; this.font = null; this.fontSize = null; this.isBold = null; this.isItalic = null; this.isUnderlined = null; this.color = null; this.rofont = null; this.rofontSize = null; this.roisBold = null; this.roisItalic = null; this.roisUnderlined = null; this.rocolor = null; this.icon = null; this.roicon = null; this.iconAlign = WmbConst.A_CENTER; this.bgcolor = null; this.robgcolor = null; this.cursor = WmbConst.C_HAND; this.paddingLeft = 5; this.paddingRight = 5; this.paddingBottom = 2; this.paddingTop = 2; } WmbDragItem.idcount = 0 // to generate ids WmbDragItem.tableidcount=0 WmbDragItem.prototype.render=function() { ////////////////////////////////////////////////// // implement padding // var pad = this.computePadding(); var style = this.computeStyle(); ////////////////////////////////////////////////// // menu item header var tableid = 'dragtableid'+MenuItem.tableidcount++; var hoverhandler='wmbrolleffects(\'' + this.parent.id + '\', \'' + this.id + '\', true);'; var outhandler='wmbrolleffects(\'' + this.parent.id + '\', \'' + this.id + '\', false);'; var html = '<table id=\'' + tableid + '\'' + all_noth(' bgcolor=\'', this.bgcolor, '\' ') + ' onmouseover="wmbsetbg(\'' + tableid + '\'' + all_noth(',\'',this.robgcolor,'\'')+');' + hoverhandler + '" onmouseout="wmbsetbg(\'' + tableid + '\'' + all_noth(',\'',this.bgcolor,'\'')+ ');' + outhandler + '" cellspacing=0 cellpadding=0 border=0 width=100% height=100%><tr>'; ////////////////////////////////////////////////// // event handling // // error checks if (!this.parent.isMoveable) alert("Error: why have a drag item if you can't move the menu?"); var href = ''; if (!wmbBrowser.is_ie4up) { href = ' href="javascript:noop();" '; } // header for moveable menus html += '<td '+style+' nowrap align="' + this.titleAlign + '">' + pad.beg + '<a class=wmbmenuitem ' + all_noth(' title="', this.description, '" ') + href + ' onclick="return false;"' + ' onmouseover="' + hoverhandler + '" ' + ' onmouseout="' + outhandler + '" ' + ' onmousedown="wmbfloatmenu(event, \''+ this.parent.id +'\')"'; ////////////////////////////////////////////////// // text attributes // var title = MenuItem.renderTitle(this); ////////////////////////////////////////////////// // icon and icon alignment // // def placement: left var iconPlacement = this.iconPlacement?this.iconPlacement:WmbConst.P_LEFT; var iconStr = all_noth('<IMG BORDER=0 ' + all_noth(' align="',this.iconAlign,'" ') + all_noth(' valign="',this.iconAlign,'" ') + ' NAME="img' + this.id + '" SRC="', this.icon, '">'); // figure out where it needs to go var liconStr = iconPlacement == WmbConst.P_LEFT?iconStr:''; liconStr = iconPlacement == WmbConst.P_TOP?iconStr+'<br>': liconStr; var riconStr = iconPlacement == WmbConst.P_RIGHT?iconStr:''; riconStr = iconPlacement == WmbConst.P_BOTTOM?'<br>'+iconStr: riconStr; ////////////////////////////////////////////////// // put it all together and send it html += '>' + liconStr + title + riconStr + '</a>' + pad.end + '</td>' + '</tr></table>'; return '<td '+style+'>' + html + '</td>'; } WmbDragItem.prototype.computePadding=MenuItem.prototype.computePadding WmbDragItem.prototype.computeStyle=MenuItem.prototype.computeStyle function WmbSubOptions(effect, speed, openevent, submenuimg, distX, distY, placement) { // override these for different effects // supported attributes this.effect = effect || WmbConst.EF_NORMAL; this.speed = speed || 20; this.openevent = openevent || WmbConst.E_OVER; this.submenuimg = submenuimg || null; this.distX = distX || 0; this.distY = distY || 0; this.placement = placement || null; } WmbSubOptions.prototype.doClipStep=function(submenuid, top, right, bottom, left) { // do some validation // if (this.speed < 1) this.speed = 20; if (this.effect == WmbConst.EF_SMOOTHHOR) { if (100 <= right) return null; top = 0; right += this.speed; if (right > 100) right = 100; bottom = 100; left = 0; } else if (this.effect == WmbConst.EF_SMOOTHVER) { if (100 <= bottom) return null; top = 0; right = 100; bottom += this.speed; if (bottom > 100) bottom = 100; left = 0; } else if (this.effect == WmbConst.EF_SMOOTHDIAG) { if (100 <= right && 100 <= bottom) return null; top = 0; right += this.speed; if (right > 100) right = 100; bottom += this.speed; if (bottom > 100) bottom = 100; left = 0; } else { wmbclip(wmbLayers[submenuid], 0, 100, 100, 0); return null; }; wmbclip(wmbLayers[submenuid], top, right, bottom, left); return new WmbRect(top, right, bottom, left); } function WmbSeparator(firstColor, secondColor) { this.firstColor = firstColor || '#999999'; this.secondColor = secondColor || '#cccccc'; } WmbSeparator.prototype.render=function() { if (WmbConst.T_HOR != this.parent.type) { if (wmbBrowser.is_nav5up) { return '<tr><td><div style="position: relative; background-color: '+this.secondColor+'; height: 2px; width: 100%; "><div style="position: relative; background-color: '+this.firstColor+'; height: 1px; width: 100%;"></div></div></td></tr>'; } else { return '<tr><td><table width=100% height=2 cellpadding=0 cellspacing=0 border=0><tr align=left valign=bottom><td bgcolor=' + this.firstColor + '><img src="'+Menu.voidgif+'" width=1 height=1 border=0></td></tr><tr align=left valign=top><td bgcolor=' + this.secondColor+ '><img src="'+Menu.voidgif+'" width=1 height=1 border=0></td></tr></table></td></tr>'; } /* if (wmbBrowser.is_nav4) { return '<tr><td><table width=100% height=2 cellpadding=0 cellspacing=0 border=0><tr align=left valign=bottom><td bgcolor=' + this.firstColor + '><img src="'+Menu.voidgif+'" width=1 height=1 border=0></td></tr><tr align=left valign=top><td bgcolor=' + this.secondColor+ '><img src="'+Menu.voidgif+'" width=1 height=1 border=0></td></tr></table></td></tr>'; } else if (wmbBrowser.is_nav5up) { return '<tr><td><div style="position: relative; background-color: '+this.secondColor+'; height: 2px; width: 100%; "><div style="position: relative; background-color: '+this.firstColor+'; height: 1px; width: 100%;"></div></div></td></tr>'; } else { return '<tr height=1px><td bgcolor="'+this.firstColor+'"></td></tr><tr height=1px><td bgcolor="'+this.secondColor+'"></td></tr>'; } */ } else { if (wmbBrowser.is_nav4) { return '<td height=100% width=1 bgcolor="'+ this.firstColor+'"><table height=100% cellspacing=0 cellpadding=1 border=0><tr><td></td></tr></table></td><td height=100% width=1 bgcolor="'+ this.secondColor+'"><table height=100% cellspacing=0 cellpadding=1 border=0><tr><td></td></tr></table></td>'; } else if (wmbBrowser.is_nav5up) { return '<td><div style="position: relative; background-color: '+this.secondColor+'; height: 100%; width: 2px; padding-top: 0px; padding-bottom: 0px; margin-top: 0px; margin-bottom: 0px;"><div style="position: relative; background-color: '+this.firstColor+'; height: 100%; width: 1px;padding-top: 0px; padding-bottom: 0px; margin-top: 0px; margin-bottom: 0px;"><hr height=0 width=0></div></div></td>' } else { return '<td><table width=2 height=100% cellpadding=0 cellspacing=0 border=0><tr height=100% align=left><td bgcolor=' + this.firstColor + '><img src="'+Menu.voidgif+'" width=1 height=100% border=0></td><td bgcolor=' + this.secondColor+ '><img src="'+Menu.voidgif+'" width=1 height=100% border=0></td></tr></table></td>'; } /* if (wmbBrowser.is_nav4) { return '';//return '<td bgcolor="'+ this.firstColor+'" width=1px></td><td bgcolor="'+ this.secondColor+'" width=1px></td>'; } else if (wmbBrowser.is_nav5up) { return '<td><div style="position: relative; background-color: '+this.secondColor+'; height: 100%; width: 2px; padding-top: 0px; padding-bottom: 0px; margin-top: 0px; margin-bottom: 0px;"><div style="position: relative; background-color: '+this.firstColor+'; height: 100%; width: 1px;padding-top: 0px; padding-bottom: 0px; margin-top: 0px; margin-bottom: 0px;"><hr height=0 width=0></div></div></td>'; } else { return '<td><div style="position: relative; background-color: '+this.secondColor+'; height: 100%; width: 2px; "><div style="position: relative; background-color: '+this.firstColor+'; height: 100%; width: 1px;"></div></div></td>'; } */ } } function WmbBrowser() { var agt=navigator.userAgent.toLowerCase(); this.is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1)); var is_major = parseInt(navigator.appVersion); var is_minor = parseFloat(navigator.appVersion); this.is_ie = (agt.indexOf("msie") != -1); this.is_nav4 = (this.is_nav && (is_major == 4)); this.is_nav5up = (this.is_nav && (is_major >= 5)); var is_ie3 = (this.is_ie && (is_major < 4)); var is_ie4 = (this.is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) ); this.is_ie4up = (this.is_ie && (is_major >= 4)); this.is_ie5up = (this.is_ie && !is_ie3 && !is_ie4); } function WmbStack() { this.arr=[]; } WmbStack.prototype.pt=0 WmbStack.prototype.push=function(value) { this.arr[this.pt++]=value; } WmbStack.prototype.pop=function(defvalue) { --this.pt; if (this.pt < 0) { this.pt=0; return defvalue; } return this.arr[this.pt]; } WmbStack.prototype.size=function() { return this.pt; } function all_noth(pref, value, suff) { pref = pref || ""; suff = suff || ""; if (value && value != "") { return pref + value + suff; } return ""; } function true_noth(expr, text) { return (expr && expr == true)?text:""; } function all_noth_conv(pref, value, suff, trueVal, falseVal) { pref = pref || ""; suff = suff || ""; if (value && value != "") { return pref + (value?trueVal:falseVal) + suff; } return ""; } function _wmbsetval(obj, item, value) { if ("" != value && null != value) { // NN 4.7x bug workaround: nulls are marked as 'undefined' if (!wmbBrowser.is_nav4 || 'undefined' != ''+value) { obj[item] = value; } } } function wmb_get_xpos(idobj) { var x = 0; if (wmbBrowser.is_ie4up) { var obj = document.all[idobj]; while(obj) { x += obj.offsetLeft; obj = obj.offsetParent; } } else if (wmbBrowser.is_nav4) { x = document[idobj].pageX; } else { x = parseInt(document.getElementById(idobj).style.left); } return x; } function wmb_get_ypos(idobj) { var y = 0; if (wmbBrowser.is_ie4up) { var obj = document.all[idobj]; while(obj) { y += obj.offsetTop; obj = obj.offsetParent; } } else if (wmbBrowser.is_nav4) { y = document[idobj].pageY; } else { y = parseInt(document.getElementById(idobj).style.top); } return y; } var menuinmotion; var wmbmotionoffset=[]; function wmbfloatmenu(event, menu) { wmbclosemenus(); if (wmbBrowser.is_nav) { document.captureEvents(Event.MOUSEMOVE); } menuinmotion = menu; // calc offset if (wmbBrowser.is_nav4) { wmbmotionoffset.x = event.pageX - document[menuinmotion].left; wmbmotionoffset.y = event.pageY - document[menuinmotion].top; } else if (wmbBrowser.is_ie4up) { wmbmotionoffset.x = window.event.clientX - document.all[menuinmotion].offsetLeft; wmbmotionoffset.y = window.event.clientY - document.all[menuinmotion].offsetTop; } else { wmbmotionoffset.x = event.pageX - parseInt(document.getElementById(menuinmotion).style.left); wmbmotionoffset.y = event.pageY - parseInt(document.getElementById(menuinmotion).style.top); } // bug fix: Netscape 6 doesn't seem to have a notion of offsetLeft and offsetTop if (null == wmbmotionoffset.x || isNaN(wmbmotionoffset.x)) {wmbmotionoffset.x = 0;} if (null == wmbmotionoffset.y || isNaN(wmbmotionoffset.y)) {wmbmotionoffset.y = 0;} if (document.onmousemove && document.onmousemove != wmbmovemenu) { wmbMMStack.push(document.onmousemove); // remember old value } document.onmousemove=wmbmovemenu; } function wmbhide(sub, hide) { if (sub && wmbLayers[sub.id]) { wmbhidelyr(wmbLayers[sub.id], hide); } } function wmbhidelyr(lyr, hide) { if (wmbBrowser.is_nav4) { lyr.visibility = (hide)?"hidden":"visible"; } else { lyr.style.visibility = (hide)?"hidden":"visible"; } // bug fix: move layer so it disappears in NS 6 if (wmbBrowser.is_nav5up) { lyr.style.left = parseInt(lyr.style.left) + 5 + 'px'; } } var wmbStopBubbling=false; function _wmbclosemenus(evt) { if (wmbBrowser.is_nav) { document.routeEvent(evt); } if (!wmbStopBubbling) { wmbclosemenus(); } wmbStopBubbling=false; } function wmbclosemenus(menuid) { // if called for a specific subset if (menuid && wmbLayers[menuid]) { for(var i=0; i < wmbLayers[menuid].items.length; i++) { wmbhide(wmbLayers[menuid].items[i].submenu, true); // if there is a submenu.. recursively close its children if (wmbLayers[menuid].items[i].submenu) { wmbclosemenus(wmbLayers[menuid].items[i].submenu.id, true); } } // to close all submenus } else { for(var i=0; i < wmbSubLayers.length; i++) { wmbhidelyr(wmbLayers[wmbSubLayers[i]], true); } } } function wmbmovemenu(event) { if (wmbBrowser.is_nav4) { Menu.menusbyid[menuinmotion].moveMenu(event.pageX-wmbmotionoffset.x, event.pageY-wmbmotionoffset.y); document.captureEvents(Event.MOUSEDOWN); } else if (wmbBrowser.is_ie4up) { Menu.menusbyid[menuinmotion].moveMenu(window.event.clientX - wmbmotionoffset.x, window.event.clientY - wmbmotionoffset.y); } else { Menu.menusbyid[menuinmotion].moveMenu(event.pageX-wmbmotionoffset.x, event.pageY-wmbmotionoffset.y); } if (document.onmousedown != wmbsinkmenu) { if (document.onmousedown) { wmbMDStack.push(document.onmousedown); // preserve handler } document.onmousedown=wmbsinkmenu; } } function wmbsinkmenu() { if (wmbBrowser.is_nav) { document.releaseEvents(Event.MOUSEDOWN | Event.MOUSEMOVE); } document.onmousemove=wmbMMStack.pop(noop); // restore to prev handler document.onmousedown=wmbMDStack.pop(noop); // restore to prev handler } function noop() {} function wmbopensubmenu(parentmenu, submenu, marker, ishorizontal, itemid, event) { // look up menu info if (!Menu.menusbyid[submenu]) alert("Could not find " + submenu); if (!Menu.menusbyid[submenu].parent) alert("Expected a parent item in " + submenu); var suboptions = Menu.menusbyid[submenu].parent.suboptions || new WmbSubOptions(); var borderOffset = Menu.menusbyid[parentmenu].border; var subBorderOffset = Menu.menusbyid[submenu].border; // placement defaults var placement = suboptions.placement; if (!placement) { placement = ishorizontal?WmbConst.P_BOTTOM:WmbConst.P_RIGHT; } // if already open.. don't reopen (because effects will make this look dumb) if (wmbBrowser.is_nav4) { if (wmbLayers[submenu].visibility != 'hide') return; } else { if (wmbLayers[submenu].style.visibility != 'hidden') return; } // stop further event processing (for onclick it may interfere) wmbStopBubbling=true; wmbclosemenus(parentmenu); if (wmbBrowser.is_nav4) { var verpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingBottom + Menu.menusbyid[parentmenu].getChild(itemid).paddingTop; var horpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingLeft; // position the submenu // submenu.moveToAbsolute(parentmenu.marker.pageX, parentmenu.marker.pageY + parentmenu.marker.clip.height); // var mrkLyr = wmbLayers[parentmenu].document.layers[marker]; if (placement == WmbConst.P_BOTTOM) { var verpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingBottom; var horpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingLeft; var pixelLeft = (ishorizontal?mrkLyr.pageX- horpadding - borderOffset:wmbLayers[parentmenu].pageX) + suboptions.distX; var pixelTop = (ishorizontal?wmbLayers[parentmenu].pageY + wmbLayers[parentmenu].clip.height:mrkLyr.clip.height+mrkLyr.pageY+verpadding) + suboptions.distY;// + subBorderOffset; wmbLayers[submenu].moveToAbsolute(pixelLeft, pixelTop); // wmbLayers[submenu].moveToAbsolute(mrkLyr.pageX + suboptions.distX - horpadding - subBorderOffset, wmbLayers[parentmenu].clip.height + wmbLayers[parentmenu].pageY + suboptions.distY/*mrkLyr.pageY + mrkLyr.clip.height + suboptions.distY + verpadding + borderOffset + subBorderOffset*/); } else if (placement == WmbConst.P_TOP) { var verpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingTop-1; // -1 to compensate for padding in menu marker table var horpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingLeft; var pixelLeft = (ishorizontal?mrkLyr.pageX- horpadding - borderOffset:wmbLayers[parentmenu].pageX) + suboptions.distX; var pixelTop = (ishorizontal?wmbLayers[parentmenu].pageY:mrkLyr.pageY - verpadding - borderOffset) + suboptions.distY - wmbLayers[submenu].clip.height; wmbLayers[submenu].moveToAbsolute(pixelLeft, pixelTop); // wmbLayers[submenu].moveToAbsolute(mrkLyr.pageX + suboptions.distX - horpadding - subBorderOffset, mrkLyr.pageY + suboptions.distY - verpadding - borderOffset - subBorderOffset - wmbLayers[submenu].clip.height); } else if (placement == WmbConst.P_RIGHT) { var verpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingTop-1; var horpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingRight; var pixelLeft = (ishorizontal?mrkLyr.pageX + horpadding:wmbLayers[parentmenu].pageX + wmbLayers[parentmenu].clip.width) + suboptions.distX; var pixelTop = (ishorizontal?wmbLayers[parentmenu].pageY + borderOffset - subBorderOffset:mrkLyr.pageY - subBorderOffset - verpadding) + suboptions.distY ; wmbLayers[submenu].moveToAbsolute(pixelLeft, pixelTop); /* var verpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingTop-1; var horpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingRight+2; wmbLayers[submenu].moveToAbsolute((ishorizontal?mrkLyr.pageX+horpadding:wmbLayers[parentmenu].clip.width + wmbLayers[parentmenu].pageX) + suboptions.distX, (ishorizontal?wmbLayers[parentmenu].pageY:mrkLyr.pageY - verpadding - subBorderOffset) + suboptions.distY); */ } else if (placement == WmbConst.P_LEFT) { verpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingTop-1; var horpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingLeft; var pixelLeft = (ishorizontal?mrkLyr.pageX - horpadding:wmbLayers[parentmenu].pageX) + suboptions.distX - wmbLayers[submenu].clip.width; var pixelTop = (ishorizontal?wmbLayers[parentmenu].pageY + borderOffset - subBorderOffset:mrkLyr.pageY - subBorderOffset - verpadding) + suboptions.distY; wmbLayers[submenu].moveToAbsolute(pixelLeft, pixelTop); /* var verpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingTop-1; var horpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingRight+2; wmbLayers[submenu].moveToAbsolute(mrkLyr.pageX + suboptions.distX + horpadding + borderOffset, (ishorizontal?wmbLayers[parentmenu].pageY:mrkLyr.pageY - verpadding - subBorderOffset) + suboptions.distY); */ } else { alert("Unexpected submenu placement: " + placement); } // adjust z order // wmbLayers[submenu].moveAbove(wmbLayers[parentmenu]); } else if (wmbBrowser.is_ie4up) { // position submenu var mrkLyr = document.all[marker]; if (placement == WmbConst.P_BOTTOM) { var verpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingBottom + Menu.menusbyid[parentmenu].getChild(itemid).paddingTop; var horpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingLeft; wmbLayers[submenu].style.pixelLeft = (ishorizontal?mrkLyr.offsetLeft- horpadding - borderOffset:0) + mrkLyr.offsetParent.offsetLeft + suboptions.distX; wmbLayers[submenu].style.pixelTop = mrkLyr.offsetParent.offsetTop + (ishorizontal?mrkLyr.offsetParent.offsetHeight:mrkLyr.offsetHeight+mrkLyr.offsetTop+verpadding+2) + suboptions.distY;// + subBorderOffset; } else if (placement == WmbConst.P_TOP) { var verpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingBottom + Menu.menusbyid[parentmenu].getChild(itemid).paddingTop-1; // -1 to compensate for padding in menu marker table var horpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingLeft; wmbLayers[submenu].style.pixelLeft = (ishorizontal?mrkLyr.offsetLeft- horpadding - borderOffset:0) + mrkLyr.offsetParent.offsetLeft + suboptions.distX; wmbLayers[submenu].style.pixelTop = mrkLyr.offsetParent.offsetTop + (ishorizontal?0:mrkLyr.offsetTop - verpadding - borderOffset) + suboptions.distY - wmbLayers[submenu].offsetHeight; } else if (placement == WmbConst.P_RIGHT) { verpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingTop+1; // +1 to compensate for padding in menu marker table var horpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingRight; wmbLayers[submenu].style.pixelLeft = mrkLyr.offsetParent.offsetLeft + (ishorizontal?mrkLyr.offsetLeft + horpadding:mrkLyr.offsetParent.offsetWidth) + suboptions.distX; wmbLayers[submenu].style.pixelTop = mrkLyr.offsetParent.offsetTop + (ishorizontal?borderOffset - subBorderOffset:mrkLyr.offsetTop - subBorderOffset - verpadding) + suboptions.distY ; } else if (placement == WmbConst.P_LEFT) { verpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingTop+1; // +1 to compensate for padding in menu marker table var horpadding = Menu.menusbyid[parentmenu].getChild(itemid).paddingLeft; wmbLayers[submenu].style.pixelLeft = mrkLyr.offsetParent.offsetLeft + (ishorizontal?mrkLyr.offsetLeft - horpadding:0) + suboptions.distX - wmbLayers[submenu].offsetWidth; wmbLayers[submenu].style.pixelTop = mrkLyr.offsetParent.offsetTop + (ishorizontal?borderOffset - subBorderOffset:mrkLyr.offsetTop - subBorderOffset - verpadding) + suboptions.distY ; } else { alert("Unexpected submenu placement: " + placement); } // adjust z order wmbLayers[submenu].style.zIndex = wmbLayers[parentmenu].style.zIndex + 1; } else { // position submenu var mrkLyr = document.getElementById(marker); document.getElementById(submenu).style.left='' + (event.pageX + suboptions.distX) + 'px'; document.getElementById(submenu).style.top='' + (event.pageY + suboptions.distY) + 'px'; // adjust z order document.getElementById(submenu).style.zIndex = document.getElementById(parentmenu).style.zIndex + 1; } // for NN 4.x we need to record the clip size because // it doesn't understand percentages so wmbclip will need this // wmbrecordclipsize(wmbLayers[submenu]); // clip the menu so it doesn't become visible too fast // wmbclip(wmbLayers[submenu], 0,0,0,0); // make visible // wmbhidelyr(wmbLayers[submenu],false); // now open with the appropriate effect // wmbopeneffect(submenu); } function WmbRect(top, right, bottom, left) { this.top = top || 0; this.right = right || 0; this.bottom = bottom || 0; this.left = left || 0; } var wmbTimeOut; function wmbopeneffect(submenu) { // some validity checks // if (!Menu.menusbyid[submenu]) alert("Unexpected error: Expected to find " + submenu); if (!Menu.menusbyid[submenu].parent) alert("Unexpected error: Expected to find " + submenu + " parent"); // lookup effect info (if none.. create one) // var suboptions = Menu.menusbyid[submenu].parent.suboptions; if (!suboptions) { Menu.menusbyid[submenu].parent.suboptions= new WmbSubOptions(); } // now recursively adjust the clipping // wmbTimeOut= setTimeout("_wmbopeneffect('" + submenu + "', 0,0,0,0)", 10); } function _wmbopeneffect(submenu, top, right, bottom, left) { // clear the old timeout // clearTimeout(wmbTimeOut); // lookup effect info (if none.. create one) // var suboptions = Menu.menusbyid[submenu].parent.suboptions; // returns null if there's no more to do // var rect = suboptions.doClipStep(submenu, top, right, bottom, left); // if there's more work.. do it // if (rect) { wmbTimeOut= setTimeout("_wmbopeneffect('" + submenu + "'," + rect.top + "," + rect.right + "," + rect.bottom + "," + rect.left + ")", 25); } } function wmbsetbg(id,color) { color = color || ""; if (wmbBrowser.is_nav5up) { document.getElementById(id).style.backgroundColor=color; } else if(wmbBrowser.is_ie4up) { if (color=="hand") alert("" + id + " " + color); document.all[id].style.backgroundColor=color; } } function wmbrolleffects(menuid, itemid, isover) { // find the menu structure we're referring to // if (!Menu.menusbyid[menuid]) alert("Invalid menu id " + menuid); if (!Menu.menusbyid[menuid].items) alert("No menu items in " + menuid); var menuItem; for (var i = 0; i < Menu.menusbyid[menuid].items.length; i++) { if (itemid == Menu.menusbyid[menuid].items[i].id) { menuItem = Menu.menusbyid[menuid].items[i]; break; } } if (!menuItem) alert("Could not find " + itemid); /////////////////////////////////////////////////////////////////////////// // icon changes // if (menuItem.roicon) { if (isover) { if (wmbBrowser.is_nav4) { wmbLayers[menuid].document.images["img" + itemid].src = menuItem.roicon; } else { document.images["img" + itemid].src = menuItem.roicon; } } else { if (wmbBrowser.is_nav4) { wmbLayers[menuid].document.images["img" + itemid].src = menuItem.icon; } else { document.images["img" + itemid].src = menuItem.icon; } } } /////////////////////////////////////////////////////////////////////////// // scroll changes // if (isover) { window.status = menuItem.description||window.defaultStatus; } else { window.status = window.defaultStatus; } /////////////////////////////////////////////////////////////////////////// // text changes // // text changes won't work for NN 4.x so don't bother if (wmbBrowser.is_nav4) return; // find the object // var obj; if (wmbBrowser.is_nav4) { obj = eval("document." + itemid); } else if (wmbBrowser.is_ie4up) { obj = document.all[itemid].style; } else { obj = document.getElementById(itemid).style; } // modify the attributes (only if there is rollover behavior defined) // if (!isover) { if (menuItem.rofont) obj.fontFamily = menuItem.font; if (menuItem.rofontSize) obj.fontSize = menuItem.fontSize; if (null != menuItem.roisBold) obj.fontWeight = menuItem.isBold?'bold':'normal'; if (null != menuItem.roisItalic) obj.fontStyle = menuItem.isItalic?'italic':'normal'; if (null != menuItem.roisUnderlined) obj.textDecoration = menuItem.isUnderlined?'underline':'none'; if (menuItem.rocolor) obj.color = menuItem.color; } else { if (menuItem.rofont) obj.fontFamily = menuItem.rofont; if (menuItem.rofontSize) obj.fontSize = menuItem.rofontSize; if (null != menuItem.roisBold) obj.fontWeight = menuItem.roisBold?'bold':'normal'; if (null != menuItem.roisItalic) obj.fontStyle = menuItem.roisItalic?'italic':'normal'; if (null != menuItem.roisUnderlined) obj.textDecoration = menuItem.roisUnderlined?'underline':'none'; if (menuItem.rocolor) obj.color = menuItem.rocolor; } } function wmbclip(lyr, top, right, bottom, left) { if (wmbBrowser.is_nav4) { lyr.clip.top = lyr.clip.orgTop * top / 100; lyr.clip.right = lyr.clip.orgRight * right / 100; lyr.clip.bottom = lyr.clip.orgBottom * bottom / 100; lyr.clip.left = lyr.clip.orgLeft * left / 100; } else { lyr.style.clip = "rect(" + top + "% " + right + "% " + bottom + "% " + left + "%)"; } } function wmbrecordclipsize(lyr) { if (wmbBrowser.is_nav4) { lyr.clip.orgTop = lyr.clip.top; lyr.clip.orgRight = lyr.clip.right; lyr.clip.orgBottom = lyr.clip.bottom; lyr.clip.orgLeft = lyr.clip.left; } } window.onload=Menu.onload function wmbwritestyles(wnd, style) { wnd.document.writeln('<style type="text/css"><!--'); wnd.document.writeln('div.wmbmenubar { width: 4px; position: absolute;}'); wnd.document.writeln('.wmbmenupin { position: relative;}'); wnd.document.writeln('table.tblwmbmenubar { border-collapse: collapse; }'); wnd.document.writeln('table.wmbouter {border-collapse: collapse; }'); wnd.document.writeln('table.tblwmbsubmenu {border-collapse: collapse;}'); wnd.document.writeln('table.tblwmbmenubar td, table.tblwmbsubmenu td {align: middle; }'); wnd.document.writeln('.wmbsubmenu { width: 4px; position: absolute; visibility: hidden; z-index: 10; }'); wnd.document.writeln('.wmbmarker {position: relative; font-size: 1pt; height: 0; width: 0; }'); wnd.document.writeln('.wmbmenuitem:link { text-decoration: none; font-size: 8pt; font-family: verdana, arial, helvetica, sans serif; color: black; }'); wnd.document.writeln('.wmbmenuitem:visited { text-decoration: none; font-size: 8pt; font-family: verdana, arial, helvetica, sans serif; color: black; }'); wnd.document.writeln('.wmbmenuitem:hover { text-decoration: none;}'); if (style) { wnd.document.writeln(style); } wnd.document.writeln('--></style>'); } wmbwritestyles(window); onload=Menu.onload