/[informatika.old]/html/menu.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /html/menu.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Thu Feb 17 13:54:15 2000 UTC (24 years, 2 months ago) by dpavlin
Branch point for: MAIN, PLIVA
File MIME type: application/javascript
Initial revision

1 dpavlin 1.1 /**
2     * Menu 990702
3     * by gary smith, July 1997
4     * Copyright (c) 1997-1999 Netscape Communications Corp.
5     *
6     * Netscape grants you a royalty free license to use or modify this
7     * software provided that this copyright notice appears on all copies.
8     * This software is provided "AS IS," without a warranty of any kind.
9     */
10    
11     function Menu(label) {
12     this.version = "990702 [Menu; menu.js]";
13     this.type = "Menu";
14     this.fontSize = 14;
15     this.fontWeight = "plain";
16     this.fontFamily = "arial,helvetica,espy,sans-serif";
17     this.fontColor = "#000000";
18     this.fontColorHilite = "#ffffff";
19     this.bgColor = "#555555";
20     this.menuBorder = 1;
21     this.menuItemBorder = 1;
22     this.menuItemBgColor = "#cccccc";
23     this.menuLiteBgColor = "#ffffff";
24     this.menuBorderBgColor = "#777777";
25     this.menuHiliteBgColor = "#000084";
26     this.menuContainerBgColor = "#cccccc";
27     this.childMenuIcon = "images/arrows.gif";
28     this.childMenuIconHilite = "images/arrows2.gif";
29     this.items = new Array();
30     this.actions = new Array();
31     this.colors = new Array();
32     this.mouseovers = new Array();
33     this.mouseouts = new Array();
34     this.childMenus = new Array();
35    
36     this.addMenuItem = addMenuItem;
37     this.addMenuSeparator = addMenuSeparator;
38     this.writeMenus = writeMenus;
39     this.showMenu = showMenu;
40     this.onMenuItemOver = onMenuItemOver;
41     this.onMenuItemOut = onMenuItemOut;
42     this.onMenuItemDown = onMenuItemDown;
43     this.onMenuItemAction = onMenuItemAction;
44     this.hideMenu = hideMenu;
45     this.hideChildMenu = hideChildMenu;
46     this.mouseTracker = mouseTracker;
47     this.setMouseTracker = setMouseTracker;
48    
49     if (!window.menus) window.menus = new Array();
50     this.label = label || "menuLabel" + window.menus.length;
51     window.menus[this.label] = this;
52     window.menus[window.menus.length] = this;
53     if (!window.activeMenus) window.activeMenus = new Array();
54     if (!window.menuContainers) window.menuContainers = new Array();
55     if (!window.mDrag) {
56     window.mDrag = new Object();
57     mDrag.startMenuDrag = startMenuDrag;
58     mDrag.doMenuDrag = doMenuDrag;
59     this.setMouseTracker();
60     }
61     if (window.MenuAPI) MenuAPI(this);
62     }
63    
64     function addMenuItem(label, action, color, mouseover, mouseout) {
65     this.items[this.items.length] = label;
66     this.actions[this.actions.length] = action;
67     this.colors[this.colors.length] = color;
68     this.mouseovers[this.mouseovers.length] = mouseover;
69     this.mouseouts[this.mouseouts.length] = mouseout;
70     }
71    
72     function addMenuSeparator() {
73     this.items[this.items.length] = "separator";
74     this.actions[this.actions.length] = "";
75     this.menuItemBorder = 0;
76     }
77    
78     function writeMenus(container) {
79     if (!container && document.layers) {
80     if (eval("document.width"))
81     container = new Layer(1000);
82     } else if (!container && document.all) {
83     if (!document.all["menuContainer"])
84     document.writeln('<SPAN ID="menuContainer"></SPAN>');
85     container = document.all["menuContainer"];
86     }
87     if (!container && !window.delayWriteMenus) {
88     window.delayWriteMenus = this.writeMenus;
89     window.menuContainerBgColor = this.menuContainerBgColor;
90     setTimeout('delayWriteMenus()', 3000);
91     return;
92     }
93     container.isContainer = "menuContainer" + menuContainers.length;
94     menuContainers[menuContainers.length] = container;
95     container.menus = new Array();
96     for (var i=0; i<window.menus.length; i++)
97     container.menus[i] = window.menus[i];
98     window.menus.length = 0;
99     var countMenus = 0;
100     var countItems = 0;
101     var top = 0;
102     var content = '';
103     var proto;
104     for (var i=0; i<container.menus.length; i++, countMenus++) {
105     var menu = container.menus[i];
106     proto = menu.prototypeStyles || this.prototypeStyles || menu;
107     content += ''+
108     '<DIV ID="menuLayer'+ countMenus +'" STYLE="position:absolute;left:10;top:'+ (i * 100) +';visibility:hidden;">\n'+
109     ' <DIV ID="menuLite'+ countMenus +'" STYLE="position:absolute;left:'+ proto.menuBorder +';top:'+ proto.menuBorder +';visibility:hide;" onMouseOut="hideMenu(this);">\n'+
110     ' <DIV ID="menuFg'+ countMenus +'" STYLE="position:absolute;left:1;top:1;visibility:hide;">\n'+
111     '';
112     var x=i;
113     for (var i=0; i<menu.items.length; i++) {
114     var item = menu.items[i];
115     var childMenu = false;
116     var defaultHeight = 20;
117     var defaultIndent = 15;
118     if (item.label) {
119     item = item.label;
120     childMenu = true;
121     } else if (item.indexOf(".gif") != -1 && item.indexOf("<IMG") == -1) {
122     item = '<IMG SRC="' + item + '" NAME="menuItem'+ countItems +'Img">';
123     defaultIndent = 0;
124     if (document.layers) {
125     defaultHeight = null;
126     }
127     }
128     proto.menuItemHeight = proto.menuItemHeight || defaultHeight;
129     proto.menuItemIndent = proto.menuItemIndent || defaultIndent;
130     var itemProps = 'visibility:hide;font-Family:' + proto.fontFamily +';font-Weight:' + proto.fontWeight + ';fontSize:' + proto.fontSize + ';';
131     if (document.all)
132     itemProps += 'font-size:' + proto.fontSize + ';" onMouseOver="onMenuItemOver(null,this);" onMouseOut="onMenuItemOut(null,this);" onClick="onMenuItemAction(null,this);';
133     var dTag = '<DIV ID="menuItem'+ countItems +'" STYLE="position:absolute;left:0;top:'+ (i * proto.menuItemHeight) +';'+ itemProps +'">';
134     var dText = '<DIV ID="menuItemText'+ countItems +'" STYLE="position:absolute;left:' + proto.menuItemIndent + ';top:0;color:'+ proto.fontColor +';">'+ item +'</DIV>\n<DIV ID="menuItemHilite'+ countItems +'" STYLE="position:absolute;left:' + proto.menuItemIndent + ';top:0;color:'+ proto.fontColorHilite +';visibility:hidden;">'+ item +'</DIV>';
135     if (item == "separator") {
136     content += ( dTag + '<DIV ID="menuSeparator'+ countItems +'" STYLE="position:absolute;left:1;top:2;"></DIV>\n<DIV ID="menuSeparatorLite'+ countItems +'" STYLE="position:absolute;left:1;top:2;"></DIV>\n</DIV>');
137     } else if (childMenu) {
138     content += ( dTag + dText + '<DIV ID="childMenu'+ countItems +'" STYLE="position:absolute;left:0;top:3;'+ itemProps +'"><IMG SRC="'+ proto.childMenuIcon +'"></DIV>\n</DIV>');
139     } else {
140     content += ( dTag + dText + '</DIV>');
141     }
142     countItems++;
143     }
144     content += ' <DIV ID="focusItem'+ countMenus +'" STYLE="position:absolute;left:0;top:0;visibility:hide;" onClick="onMenuItemAction(null,this);">&nbsp;</DIV>\n';
145     content += ' </DIV>\n </DIV>\n</DIV>\n';
146     i=x;
147     }
148     if (!container) return;
149     if (container.innerHTML) {
150     container.innerHTML=content;
151     } else {
152     container.document.open("text/html");
153     container.document.writeln(content);
154     container.document.close();
155     }
156     proto = null;
157     if (container.document.layers) {
158     container.clip.width = window.innerWidth;
159     container.clip.height = window.innerHeight;
160     container.onmouseout = this.hideMenu;
161     container.menuContainerBgColor = this.menuContainerBgColor;
162     for (var i=0; i<container.document.layers.length; i++) {
163     proto = container.menus[i].prototypeStyles || this.prototypeStyles || container.menus[i];
164     var menu = container.document.layers[i];
165     container.menus[i].menuLayer = menu;
166     container.menus[i].menuLayer.Menu = container.menus[i];
167     container.menus[i].menuLayer.Menu.container = container;
168     var body = menu.document.layers[0].document.layers[0];
169     body.clip.width = proto.menuWidth || body.clip.width;
170     body.clip.height = proto.menuHeight || body.clip.height;
171     for (var n=0; n<body.document.layers.length-1; n++) {
172     var l = body.document.layers[n];
173     l.Menu = container.menus[i];
174     l.menuHiliteBgColor = proto.menuHiliteBgColor;
175     l.document.bgColor = proto.menuItemBgColor;
176     l.saveColor = proto.menuItemBgColor;
177     l.mouseout = l.Menu.mouseouts[n];
178     l.mouseover = l.Menu.mouseovers[n];
179     l.onmouseover = proto.onMenuItemOver;
180     l.onclick = proto.onMenuItemAction;
181     l.action = container.menus[i].actions[n];
182     l.focusItem = body.document.layers[body.document.layers.length-1];
183     l.clip.width = proto.menuItemWidth || body.clip.width + proto.menuItemIndent;
184     l.clip.height = proto.menuItemHeight || l.clip.height;
185     if (n>0) l.top = body.document.layers[n-1].top + body.document.layers[n-1].clip.height + proto.menuItemBorder;
186     l.hilite = l.document.layers[1];
187     l.document.layers[1].isHilite = true;
188     if (l.document.layers[0].id.indexOf("menuSeparator") != -1) {
189     l.hilite = null;
190     l.clip.height -= l.clip.height / 2;
191     l.document.layers[0].document.bgColor = proto.bgColor;
192     l.document.layers[0].clip.width = l.clip.width -2;
193     l.document.layers[0].clip.height = 1;
194     l.document.layers[1].document.bgColor = proto.menuLiteBgColor;
195     l.document.layers[1].clip.width = l.clip.width -2;
196     l.document.layers[1].clip.height = 1;
197     l.document.layers[1].top = l.document.layers[0].top + 1;
198     } else if (l.document.layers.length > 2) {
199     l.childMenu = container.menus[i].items[n].menuLayer;
200     l.icon = proto.childMenuIcon;
201     l.iconHilite = proto.childMenuIconHilite;
202     l.document.layers[2].left = l.clip.width -13;
203     l.document.layers[2].top = (l.clip.height / 2) -4;
204     l.document.layers[2].clip.left += 3;
205     l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;
206     }
207     }
208     body.document.bgColor = proto.bgColor;
209     body.clip.width = l.clip.width +1;
210     body.clip.height = l.top + l.clip.height +1;
211     body.document.layers[n].clip.width = body.clip.width;
212     body.document.layers[n].captureEvents(Event.MOUSEDOWN);
213     body.document.layers[n].onmousedown = proto.onMenuItemDown;
214     //body.document.layers[n].onfocus = proto.onMenuItemDown;
215     body.document.layers[n].onmouseout = proto.onMenuItemOut;
216     body.document.layers[n].Menu = l.Menu;
217     body.document.layers[n].top = -30;
218     menu.document.bgColor = proto.menuBorderBgColor;
219     menu.document.layers[0].document.bgColor = proto.menuLiteBgColor;
220     menu.document.layers[0].clip.width = body.clip.width +1;
221     menu.document.layers[0].clip.height = body.clip.height +1;
222     menu.clip.width = body.clip.width + (proto.menuBorder * 2) +1;
223     menu.clip.height = body.clip.height + (proto.menuBorder * 2) +1;
224     if (menu.Menu.enableTracker) {
225     menu.Menu.disableHide = true;
226     setMenuTracker(menu.Menu);
227     }
228     }
229     } else if (container.document.all) {
230     var menuCount = 0;
231     for (var x=0; x<container.menus.length; x++) {
232     var menu = container.document.all("menuLayer" + x);
233     container.menus[x].menuLayer = menu;
234     container.menus[x].menuLayer.Menu = container.menus[x];
235     container.menus[x].menuLayer.Menu.container = menu;
236     proto = container.menus[x].prototypeStyles || this.prototypeStyles || container.menus[x];
237     proto.menuItemWidth = proto.menuItemWidth || 200;
238     menu.style.backgroundColor = proto.menuBorderBgColor;
239     for (var i=0; i<container.menus[x].items.length; i++) {
240     var l = container.document.all["menuItem" + menuCount];
241     l.Menu = container.menus[x];
242     proto = container.menus[x].prototypeStyles || this.prototypeStyles || container.menus[x];
243     l.style.pixelWidth = proto.menuItemWidth;
244     l.style.pixelHeight = proto.menuItemHeight;
245     if (i>0) l.style.pixelTop = container.document.all["menuItem" + (menuCount -1)].style.pixelTop + container.document.all["menuItem" + (menuCount -1)].style.pixelHeight + proto.menuItemBorder;
246     l.style.fontSize = proto.fontSize;
247     l.style.backgroundColor = proto.menuItemBgColor;
248     l.style.visibility = "inherit";
249     l.saveColor = proto.menuItemBgColor;
250     l.menuHiliteBgColor = proto.menuHiliteBgColor;
251     l.action = container.menus[x].actions[i];
252     l.hilite = container.document.all["menuItemHilite" + menuCount];
253     l.focusItem = container.document.all["focusItem" + x];
254     l.focusItem.style.pixelTop = -30;
255     l.mouseover = l.Menu.mouseovers[x];
256     l.mouseout = l.Menu.mouseouts[x];
257     var childItem = container.document.all["childMenu" + menuCount];
258     if (childItem) {
259     l.childMenu = container.menus[x].items[i].menuLayer;
260     childItem.style.pixelLeft = l.style.pixelWidth -11;
261     childItem.style.pixelTop = (l.style.pixelHeight /2) -4;
262     childItem.style.pixelWidth = 30 || 7;
263     childItem.style.clip = "rect(0 7 7 3)";
264     l.Menu.childMenus[l.Menu.childMenus.length] = l.childMenu;
265     }
266     var sep = container.document.all["menuSeparator" + menuCount];
267     if (sep) {
268     sep.style.clip = "rect(0 " + (proto.menuItemWidth - 3) + " 1 0)";
269     sep.style.backgroundColor = proto.bgColor;
270     sep = container.document.all["menuSeparatorLite" + menuCount];
271     sep.style.clip = "rect(1 " + (proto.menuItemWidth - 3) + " 2 0)";
272     sep.style.backgroundColor = proto.menuLiteBgColor;
273     l.style.pixelHeight = proto.menuItemHeight/2;
274     l.isSeparator = true
275     }
276     menuCount++;
277     }
278     proto.menuHeight = (l.style.pixelTop + l.style.pixelHeight);
279     var lite = container.document.all["menuLite" + x];
280     lite.style.pixelHeight = proto.menuHeight +2;
281     lite.style.pixelWidth = proto.menuItemWidth + 2;
282     lite.style.backgroundColor = proto.menuLiteBgColor;
283     var body = container.document.all["menuFg" + x];
284     body.style.pixelHeight = proto.menuHeight + 1;
285     body.style.pixelWidth = proto.menuItemWidth + 1;
286     body.style.backgroundColor = proto.bgColor;
287     container.menus[x].menuLayer.style.pixelWidth = proto.menuWidth || proto.menuItemWidth + (proto.menuBorder * 2) +2;
288     container.menus[x].menuLayer.style.pixelHeight = proto.menuHeight + (proto.menuBorder * 2) +2;
289     if (menu.Menu.enableTracker) {
290     menu.Menu.disableHide = true;
291     setMenuTracker(menu.Menu);
292     }
293     }
294     container.document.all("menuContainer").style.backgroundColor = container.menus[0].menuContainerBgColor;
295     container.document.saveBgColor = container.document.bgColor;
296     }
297     window.wroteMenu = true;
298     }
299    
300     function onMenuItemOver(e, l, a) {
301     l = l || this;
302     a = a || window.ActiveMenuItem;
303     if (document.layers) {
304     if (a) {
305     a.document.bgColor = a.saveColor;
306     if (a.hilite) a.hilite.visibility = "hidden";
307     if (a.childMenu) a.document.layers[1].document.images[0].src = a.icon;
308     } else {
309     a = new Object();
310     }
311     if (this.mouseover && this.id != a.id) {
312     if (this.mouseover.length > 4) {
313     var ext = this.mouseover.substring(this.mouseover.length-4);
314     if (ext == ".gif" || ext == ".jpg") {
315     this.document.layers[1].document.images[0].src = this.mouseover;
316     } else {
317     eval("" + this.mouseover);
318     }
319     }
320     }
321     if (l.hilite) {
322     l.document.bgColor = l.menuHiliteBgColor;
323     l.zIndex = 1;
324     l.hilite.visibility = "inherit";
325     l.hilite.zIndex = 2;
326     l.document.layers[1].zIndex = 1;
327     l.focusItem.zIndex = this.zIndex +2;
328     }
329     l.focusItem.top = this.top;
330     l.Menu.hideChildMenu(l);
331     } else if (l.style && l.Menu) {
332     document.onmousedown=l.Menu.onMenuItemDown;
333     if (a) {
334     a.style.backgroundColor = a.saveColor;
335     if (a.hilite) a.hilite.style.visibility = "hidden";
336     } else {
337     a = new Object();
338     }
339     if (l.mouseover && l.id != a.id) {
340     if (l.mouseover.length > 4) {
341     var ext = l.mouseover.substring(l.mouseover.length-4);
342     if (ext == ".gif" || ext == ".jpg") {
343     l.document.images[l.id + "Img"].src = l.mouseover;
344     } else {
345     eval("" + l.mouseover);
346     }
347     }
348     }
349     if (l.isSeparator) return;
350     l.style.backgroundColor = l.menuHiliteBgColor;
351     if (l.hilite) {
352     l.style.backgroundColor = l.menuHiliteBgColor;
353     l.hilite.style.visibility = "inherit";
354     }
355     l.focusItem.style.pixelTop = l.style.pixelTop;
356     l.focusItem.style.zIndex = l.zIndex +1;
357     l.zIndex = 1;
358     l.Menu.hideChildMenu(l);
359     }
360     window.ActiveMenuItem = l;
361     }
362    
363     function onMenuItemOut(e, l, a) {
364     l = l || this;
365     a = a || window.ActiveMenuItem;
366     if (l.id.indexOf("focusItem")) {
367     if (a && l.top) {
368     l.top = -30;
369     if (a.mouseout && a.id != l.id) {
370     if (a.mouseout.length > 4) {
371     var ext = a.mouseout.substring(a.mouseout.length-4);
372     if (ext == ".gif" || ext == ".jpg") {
373     a.document.layers[1].document.images[0].src = a.mouseout;
374     } else {
375     eval("" + a.mouseout);
376     }
377     }
378     }
379     } else if (a && l.style) {
380     document.onmousedown=null;
381     window.event.cancelBubble=true;
382     if (l.mouseout) {
383     if (l.mouseout.length > 4) {
384     var ext = l.mouseout.substring(l.mouseout.length-4);
385     if (ext == ".gif" || ext == ".jpg") {
386     l.document.images[l.id + "Img"].src = l.mouseout;
387     } else {
388     eval("" + l.mouseout);
389     }
390     }
391     }
392     }
393     }
394     }
395    
396     function onMenuItemAction(e, l) {
397     l = window.ActiveMenuItem;
398     if (!l) return;
399     if (!ActiveMenu.Menu.disableHide) hideActiveMenus(ActiveMenu.menuLayer);
400     if (l.action) {
401     eval("" + l.action);
402     }
403     }
404    
405     function showMenu(menu, x, y, child) {
406     if (!window.wroteMenu) return;
407     if (document.layers) {
408     if (menu) {
409     var l = menu.menuLayer || menu;
410     if (typeof(menu) == "string") {
411     for (var n=0; n < menuContainers.length; n++) {
412     l = menuContainers[n].menus[menu];
413     for (var i=0; i<menuContainers[n].menus.length; i++) {
414     if (menu == menuContainers[n].menus[i].label) l = menuContainers[n].menus[i].menuLayer;
415     if (l) break;
416     }
417     }
418     if (!l) return;
419     }
420     l.Menu.container.document.bgColor = null;
421     l.left = 1;
422     l.top = 1;
423     hideActiveMenus(l);
424     if (this.visibility) l = this;
425     window.ActiveMenu = l;
426     window.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);
427     setTimeout('if(window.ActiveMenu)window.ActiveMenu.Menu.setMouseTracker();', 300);
428     } else {
429     var l = child;
430     }
431     if (!l) return;
432     for (var i=0; i<l.layers.length; i++) {
433     if (!l.layers[i].isHilite)
434     l.layers[i].visibility = "inherit";
435     if (l.layers[i].document.layers.length > 0)
436     showMenu(null, "relative", "relative", l.layers[i]);
437     }
438     if (l.parentLayer) {
439     if (x != "relative")
440     l.parentLayer.left = x || window.pageX || 0;
441     if (l.parentLayer.left + l.clip.width > window.innerWidth)
442     l.parentLayer.left -= (l.parentLayer.left + l.clip.width - window.innerWidth);
443     if (y != "relative")
444     l.parentLayer.top = y || window.pageY || 0;
445     if (l.parentLayer.isContainer) {
446     l.Menu.xOffset = window.pageXOffset;
447     l.Menu.yOffset = window.pageYOffset;
448     l.parentLayer.clip.width = window.ActiveMenu.clip.width +2;
449     l.parentLayer.clip.height = window.ActiveMenu.clip.height +2;
450     if (l.parentLayer.menuContainerBgColor) l.parentLayer.document.bgColor = l.parentLayer.menuContainerBgColor;
451     }
452     }
453     l.visibility = "inherit";
454     if (l.Menu) l.Menu.container.visibility = "inherit";
455     } else if (document.all) {
456     var l = menu.menuLayer || menu;
457     hideActiveMenus(l);
458     if (typeof(menu) == "string") {
459     l = document.all[menu];
460     for (var n=0; n < menuContainers.length; n++) {
461     l = menuContainers[n].menus[menu];
462     for (var i=0; i<menuContainers[n].menus.length; i++) {
463     if (menu == menuContainers[n].menus[i].label) l = menuContainers[n].menus[i].menuLayer;
464     if (l) break;
465     }
466     }
467     }
468     window.ActiveMenu = l;
469     l.style.visibility = "inherit";
470     if (x != "relative")
471     l.style.pixelLeft = x || (window.pageX + document.body.scrollLeft) || 0;
472     if (y != "relative")
473     l.style.pixelTop = y || (window.pageY + document.body.scrollTop) || 0;
474     l.Menu.xOffset = document.body.scrollLeft;
475     l.Menu.yOffset = document.body.scrollTop;
476     }
477     if (menu) {
478     window.activeMenus[window.activeMenus.length] = l;
479     }
480     }
481    
482     function hideMenu(e) {
483     var l = e || window.ActiveMenu;
484     if (!l) return true;
485     if (l.menuLayer) {
486     l = l.menuLayer;
487     } else if (this.visibility) {
488     l = this;
489     }
490     if (l.menuLayer) {
491     l = l.menuLayer;
492     }
493     var a = window.ActiveMenuItem;
494     document.saveMousemove = document.onmousemove;
495     document.onmousemove = mouseTracker;
496     if (a && document.layers) {
497     a.document.bgColor = a.saveColor;
498     a.focusItem.top = -30;
499     if (a.hilite) a.hilite.visibility = "hidden";
500     if (a.childMenu) a.document.layers[1].document.images[0].src = a.icon;
501     if (mDrag.oldX <= e.pageX+3 && mDrag.oldX >= e.pageX-3 && mDrag.oldY <= e.pageY+3 && mDrag.oldY >= e.pageY-3) {
502     if (a.action && window.ActiveMenu) setTimeout('window.ActiveMenu.Menu.onMenuItemAction();', 2);
503     } else if (document.saveMousemove == mDrag.doMenuDrag) {
504     if (window.ActiveMenu) return true;
505     }
506     } else if (window.ActiveMenu && document.all) {
507     document.onmousedown=null;
508     if (a) {
509     a.style.backgroundColor = a.saveColor;
510     if (a.hilite) a.hilite.style.visibility = "hidden";
511     }
512     if (document.saveMousemove == mDrag.doMenuDrag) {
513     return true;
514     }
515     }
516     if (window.ActiveMenu) {
517     if (window.ActiveMenu.Menu) {
518     if (window.ActiveMenu.Menu.disableHide) return true;
519     e = window.event || e;
520     if (!window.ActiveMenu.Menu.enableHideOnMouseOut && e.type == "mouseout") return true;
521     }
522     }
523     hideActiveMenus(l);
524     return true;
525     }
526    
527     function hideChildMenu(menuLayer) {
528     var l = menuLayer || this;
529     for (var i=0; i < l.Menu.childMenus.length; i++) {
530     if (document.layers) {
531     l.Menu.childMenus[i].visibility = "hidden";
532     } else if (document.all) {
533     l.Menu.childMenus[i].style.visibility = "hidden";
534     }
535     l.Menu.childMenus[i].Menu.hideChildMenu(l.Menu.childMenus[i]);
536     }
537     if (l.childMenu) {
538     if (document.layers) {
539     l.Menu.container.document.bgColor = null;
540     l.Menu.showMenu(null,null,null,l.childMenu.layers[0]);
541     l.childMenu.zIndex = l.parentLayer.zIndex +1;
542     l.childMenu.top = l.top + l.parentLayer.top + l.Menu.menuLayer.top;
543     if (l.childMenu.left + l.childMenu.clip.width > window.innerWidth) {
544     l.childMenu.left = l.parentLayer.left - l.childMenu.clip.width + l.Menu.menuLayer.top + 15;
545     l.Menu.container.clip.left -= l.childMenu.clip.width;
546     } else if (l.Menu.childMenuDirection == "left") {
547     l.childMenu.left = l.parentLayer.left - l.parentLayer.clip.width;
548     l.Menu.container.clip.left -= l.childMenu.clip.width;
549     } else {
550     l.childMenu.left = l.parentLayer.left + l.parentLayer.clip.width + l.Menu.menuLayer.left -5;
551     }
552     l.Menu.container.clip.width += l.childMenu.clip.width +100;
553     l.Menu.container.clip.height += l.childMenu.clip.height;
554     l.document.layers[1].zIndex = 0;
555     l.document.layers[1].document.images[0].src = l.iconHilite;
556     l.childMenu.visibility = "inherit";
557     } else if (document.all) {
558     l.childMenu.style.zIndex = l.Menu.menuLayer.style.zIndex +1;
559     l.childMenu.style.pixelTop = l.style.pixelTop + l.Menu.menuLayer.style.pixelTop;
560     if (l.childMenu.style.pixelLeft + l.childMenu.style.pixelWidth > document.width) {
561     l.childMenu.style.pixelLeft = l.childMenu.style.pixelWidth + l.Menu.menuLayer.style.pixelTop + 15;
562     } else if (l.Menu.childMenuDirection == "left") {
563     //l.childMenu.style.pixelLeft = l.parentLayer.left - l.parentLayer.clip.width;
564     } else {
565     l.childMenu.style.pixelLeft = l.Menu.menuLayer.style.pixelWidth + l.Menu.menuLayer.style.pixelLeft -5;
566     }
567     l.childMenu.style.visibility = "inherit";
568     }
569     if (!l.childMenu.disableHide)
570     window.activeMenus[window.activeMenus.length] = l.childMenu;
571     }
572     }
573    
574     function hideActiveMenus(l) {
575     if (!window.activeMenus) return;
576     for (var i=0; i < window.activeMenus.length; i++) {
577     if (!activeMenus[i]) return;
578     if (activeMenus[i].visibility && activeMenus[i].Menu) {
579     activeMenus[i].visibility = "hidden";
580     activeMenus[i].Menu.container.visibility = "hidden";
581     activeMenus[i].Menu.container.clip.left = 0;
582     } else if (activeMenus[i].style) {
583     activeMenus[i].style.visibility = "hidden";
584     }
585     }
586     document.onmousemove = mouseTracker;
587     window.activeMenus.length = 0;
588     }
589    
590     function mouseTracker(e) {
591     e = e || window.Event || window.event;
592     window.pageX = e.pageX || e.clientX;
593     window.pageY = e.pageY || e.clientY;
594     }
595    
596     function setMouseTracker() {
597     if (document.captureEvents) {
598     document.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
599     }
600     document.onmousemove = this.mouseTracker;
601     document.onmouseup = this.hideMenu;
602     }
603    
604     function setMenuTracker(menu) {
605     if (!window.menuTrackers) window.menuTrackers = new Array();
606     menuTrackers[menuTrackers.length] = menu;
607     window.menuTrackerID = setInterval('menuTracker()',10);
608     }
609    
610     function menuTracker() {
611     for (var i=0; i < menuTrackers.length; i++) {
612     if (!isNaN(menuTrackers[i].xOffset) && document.layers) {
613     var off = parseInt((menuTrackers[i].xOffset - window.pageXOffset) / 10);
614     if (isNaN(off)) off = 0;
615     if (off < 0) {
616     menuTrackers[i].container.left += -off;
617     menuTrackers[i].xOffset += -off;
618     } else if (off > 0) {
619     menuTrackers[i].container.left += -off;
620     menuTrackers[i].xOffset += -off;
621     }
622     }
623     if (!isNaN(menuTrackers[i].yOffset) && document.layers) {
624     var off = parseInt((menuTrackers[i].yOffset - window.pageYOffset) / 10);
625     if (isNaN(off)) off = 0;
626     if (off < 0) {
627     menuTrackers[i].container.top += -off;
628     menuTrackers[i].yOffset += -off;
629     } else if (off > 0) {
630     menuTrackers[i].container.top += -off;
631     menuTrackers[i].yOffset += -off;
632     }
633     }
634     if (!isNaN(menuTrackers[i].xOffset) && document.body) {
635     var off = parseInt((menuTrackers[i].xOffset - document.body.scrollLeft) / 10);
636     if (isNaN(off)) off = 0;
637     if (off < 0) {
638     menuTrackers[i].menuLayer.style.pixelLeft += -off;
639     menuTrackers[i].xOffset += -off;
640     } else if (off > 0) {
641     menuTrackers[i].menuLayer.style.pixelLeft += -off;
642     menuTrackers[i].xOffset += -off;
643     }
644     }
645     if (!isNaN(menuTrackers[i].yOffset) && document.body) {
646     var off = parseInt((menuTrackers[i].yOffset - document.body.scrollTop) / 10);
647     if (isNaN(off)) off = 0;
648     if (off < 0) {
649     menuTrackers[i].menuLayer.style.pixelTop += -off;
650     menuTrackers[i].yOffset += -off;
651     } else if (off > 0) {
652     menuTrackers[i].menuLayer.style.pixelTop += -off;
653     menuTrackers[i].yOffset += -off;
654     }
655     }
656     }
657     }
658    
659     function onMenuItemDown(e, l) {
660     l = l || window.ActiveMenuItem || this;
661     if (!l.Menu) {
662     } else {
663     if (document.layers) {
664     mDrag.dragLayer = l.Menu.container;
665     mDrag.startMenuDrag(e);
666     } else {
667     mDrag.dragLayer = l.Menu.container.style;
668     mDrag.startMenuDrag(e);
669     window.event.cancelBubble=true;
670     }
671     }
672     }
673    
674     function startMenuDrag(e) {
675     if (document.layers) {
676     if (e.which > 1) {
677     if (window.ActiveMenu) ActiveMenu.Menu.container.visibility = "hidden";
678     window.ActiveMenu = null;
679     return true;
680     }
681     document.captureEvents(Event.MOUSEMOVE);
682     var x = e.pageX;
683     var y = e.pageY;
684     } else {
685     var x = window.event.clientX;
686     var y = window.event.clientY;
687     }
688     mDrag.offX = x;
689     mDrag.offY = y;
690     mDrag.oldX = x;
691     mDrag.oldY = y;
692     if (!ActiveMenu.Menu.disableDrag) document.onmousemove = mDrag.doMenuDrag;
693     return false;
694     }
695    
696     function doMenuDrag(e) {
697     if (document.layers) {
698     mDrag.dragLayer.moveBy(e.pageX-mDrag.offX,e.pageY-mDrag.offY);
699     mDrag.offX = e.pageX;
700     mDrag.offY = e.pageY;
701     } else {
702     mDrag.dragLayer.pixelLeft = window.event.offsetX;
703     mDrag.dragLayer.pixelTop = window.event.offsetY;
704     return false; //for IE
705     }
706     }

  ViewVC Help
Powered by ViewVC 1.1.26