2 * by Peter Belesis. v4.1.1 011002
3 * Copyright (c) 2001 Peter Belesis. All Rights Reserved.
4 * Originally published and documented at http://www.dhtmlab.com/
5 * Available solely from INT Media Group. Incorporated under exclusive license.
6 * Contact licensing@internet.com for more information.
10 ["MenuWidth", 150, "number"],
11 ["FontFamily", "Arial,sans-serif"],
12 ["FontSize", 10, "number"],
13 ["FontBold", false, "boolean"],
14 ["FontItalic", false, "boolean"],
15 ["FontColor", "black"],
16 ["FontColorOver", "white"],
18 ["BGColorOver", "black"],
19 ["ItemPadding", 3, "number"],
20 ["BorderWidth", 2, "number"],
21 ["BorderColor", "red"],
22 ["SeparatorSize", 1, "number"],
23 ["ImageSrc", "HM_More_black_right.gif"],
24 ["ImageSrcOver", null],
25 ["ImageSrcLeft", "HM_More_black_left.gif"],
26 ["ImageSrcLeftOver", null],
27 ["ImageSize", 5, "number"],
28 ["ImageHorizSpace", 0, "number"],
29 ["ImageVertSpace", 0, "number"],
30 ["KeepHilite", false, "boolean"],
31 ["ClickStart", false, "boolean"],
32 ["ClickKill", true, "boolean"],
33 ["ChildOverlap", 20, "number"],
34 ["ChildOffset", 10, "number"],
35 ["ChildPerCentOver", null, "number"],
36 ["TopSecondsVisible", .5, "number"],
37 ["ChildSecondsVisible",.3, "number"],
38 ["StatusDisplayBuild", 1, "boolean"],
39 ["StatusDisplayLink", 1, "boolean"],
40 ["UponDisplay", null, "delayed"],
41 ["UponHide", null, "delayed"],
42 ["RightToLeft", false, "boolean"],
43 ["CreateTopOnly", 0, "boolean"],
44 ["ShowLinkCursor", false, "boolean"],
45 ["NSFontOver", true, "boolean"]
48 HM_MenuIDPrefix = "HM_Menu";
49 HM_ItemIDPrefix = "HM_Item";
50 HM_ArrayIDPrefix = "HM_Array";
52 Function.prototype.isFunction = true;
53 Function.prototype.isString = false;
54 String.prototype.isFunction = false;
55 String.prototype.isString = true;
56 String.prototype.isBoolean = false;
57 String.prototype.isNumber = false;
58 Number.prototype.isString = false;
59 Number.prototype.isFunction = false;
60 Number.prototype.isBoolean = false;
61 Number.prototype.isNumber = true;
62 Boolean.prototype.isString = false;
63 Boolean.prototype.isFunction = false;
64 Boolean.prototype.isBoolean = true;
65 Boolean.prototype.isNumber = false;
66 Array.prototype.itemValidation = false;
67 Array.prototype.isArray = true;
70 function HM_f_AssignParameters(paramarray){
71 var ParamName = paramarray[0];
72 var DefaultValue = paramarray[1];
73 var FullParamName = "HM_" + ParamName;
75 if (typeof eval("window.HM_PG_" + ParamName) == "undefined") {
76 if (typeof eval("window.HM_GL_" + ParamName) == "undefined") {
77 eval(FullParamName + "= DefaultValue");
80 eval(FullParamName + "= HM_GL_" + ParamName);
84 eval(FullParamName + "= HM_PG_" + ParamName);
87 paramarray[0] = FullParamName;
88 paramarray[1] = eval(FullParamName);
91 function HM_f_EvalParameters(valuenew,valueold,valuetype){
92 var TestString, ParPosition;
94 if(typeof valuenew == "undefined" || valuenew == null || (valuenew.isString && valuenew.length == 0)){
98 if(valuetype != "delayed"){
99 while(valuenew.isString) {
100 ParPosition = valuenew.indexOf("(");
101 if(ParPosition !=-1) {
102 TestString = "window." + valuenew.substr(0,ParPosition);
103 if (typeof eval(TestString) != "undefined" && eval(TestString).isFunction) {
104 valuenew = eval(valuenew);
111 while(valuenew.isFunction) {valuenew = valuenew()}
115 while (valuenew.isString) {valuenew = eval(valuenew)}
118 while (!valuenew.isBoolean) {
119 valuenew = (valuenew.isNumber) ? valuenew ? true : false : eval(valuenew);
127 for (i=0;i<HM_a_Parameters.length;i++) {
128 HM_f_AssignParameters(HM_a_Parameters[i]);
129 eval(HM_a_Parameters[i][0] + "= HM_f_EvalParameters("+ HM_a_Parameters[i][0] +",null,HM_a_Parameters[i][2])")
132 HM_ChildPerCentOver = (isNaN(parseFloat(HM_ChildPerCentOver))) ? null : parseFloat(HM_ChildPerCentOver)/100;
134 HM_ChildMilliSecondsVisible = HM_ChildSecondsVisible * 1000;
136 function HM_f_ValidateArray(arrayname){
137 var MenuArrayIsValid = false;
138 var MenuArrayIsObject = (typeof eval("window." + arrayname) == "object");
139 if(MenuArrayIsObject) {
140 var TheMenuArray = eval(arrayname);
141 if(TheMenuArray.isArray && TheMenuArray.length > 1) {
142 MenuArrayIsValid = true;
143 if(!TheMenuArray.itemValidation) {
144 while((typeof TheMenuArray[TheMenuArray.length-1] != "object") || (!TheMenuArray[TheMenuArray.length-1].isArray)) {
145 TheMenuArray.length--;
147 TheMenuArray.itemValidation = true;
151 return MenuArrayIsValid;
154 if(!window.HM_a_TreesToBuild) {
155 HM_a_TreesToBuild = [];
156 for(i=1; i<100; i++){
157 if(HM_f_ValidateArray(HM_ArrayIDPrefix + i)) HM_a_TreesToBuild[HM_a_TreesToBuild.length] = i;
161 HM_CurrentArray = null;
162 HM_CurrentTree = null;
163 HM_CurrentMenu = null;
164 HM_CurrentItem = null;
166 HM_AreLoaded = false;
167 HM_AreCreated = false;
168 HM_BeingCreated = false;
169 HM_UserOverMenu = false;
170 HM_HideAllTimer = null;
174 function HM_f_Initialize() {
176 for(var i=0; i<HM_TotalTrees; i++) {
177 var TopMenu = HM_a_TopMenus[i];
178 clearTimeout(TopMenu.hideTimer);
179 TopMenu.hideTimer = null;
181 clearTimeout(HM_HideAllTimer);
183 HM_AreCreated = false;
184 HM_BeingCreated = false;
185 HM_UserOverMenu = false;
186 HM_CurrentMenu = null;
187 HM_HideAllTimer = null;
192 Layer.prototype.showIt = HM_f_ShowIt;
193 Layer.prototype.keepInWindow = HM_f_KeepInWindow;
194 Layer.prototype.hideTree = HM_f_HideTree
195 Layer.prototype.hideParents = HM_f_HideParents;
196 Layer.prototype.hideChildren = HM_f_HideChildren;
197 Layer.prototype.hideTop = HM_f_HideTop;
198 Layer.prototype.hideSelf = HM_f_HideSelf;
199 Layer.prototype.hasChildVisible = false;
200 Layer.prototype.isOn = false;
201 Layer.prototype.hideTimer = null;
202 Layer.prototype.currentItem = null;
203 Layer.prototype.itemSetup = HM_f_ItemSetup;
204 Layer.prototype.itemCount = 0;
205 Layer.prototype.child = null;
206 Layer.prototype.isWritten = false;
208 HM_NS_OrigWidth = window.innerWidth;
209 HM_NS_OrigHeight = window.innerHeight;
211 window.onresize = function (){
212 if (window.innerWidth == HM_NS_OrigWidth && window.innerHeight == HM_NS_OrigHeight) return;
214 window.history.go(0);
217 function HM_f_StartIt() {
218 if(HM_AreCreated) return;
221 HM_f_OtherMouseDown = (document.onmousedown) ? document.onmousedown : new Function;
222 document.captureEvents(Event.MOUSEDOWN);
223 document.onmousedown = function(){HM_f_PageClick();HM_f_OtherMouseDown()}
226 HM_TopMilliSecondsVisible = HM_TopSecondsVisible * 1000;
232 function HM_f_MakeTrees(){
233 HM_BeingCreated = true;
234 var TreeParams = null;
235 var TreeHasChildren = false;
236 var ItemArray = null;
238 for(var t=0; t<HM_a_TreesToBuild.length; t++) {
239 if(!HM_f_ValidateArray(HM_ArrayIDPrefix + HM_a_TreesToBuild[t])) continue;
240 HM_CurrentArray = eval(HM_ArrayIDPrefix + HM_a_TreesToBuild[t]);
242 TreeParams = HM_CurrentArray[0];
243 TreeHasChildren = false;
245 for(var i=1; i<HM_CurrentArray.length; i++) {
246 ItemArray = HM_CurrentArray[i];
247 if(ItemArray[ItemArray.length-1]) {TreeHasChildren = true; break}
251 MenuWidth : MenuWidth = HM_f_EvalParameters(TreeParams[0],HM_MenuWidth,"number"),
252 MenuLeft : MenuLeft = HM_f_EvalParameters(TreeParams[1],null,"delayed"),
253 MenuTop : MenuTop = HM_f_EvalParameters(TreeParams[2],null,"delayed"),
254 ItemWidth : ItemWidth = MenuWidth - (HM_BorderWidth*2),
255 ItemTextWidth : TreeHasChildren ? (ItemWidth - (HM_ImageSize + HM_ImageHorizSpace + HM_ItemPadding)) : ItemWidth,
256 FontColor : FontColor = HM_f_EvalParameters(TreeParams[3],HM_FontColor),
257 FontColorOver : FontColorOver = HM_f_EvalParameters(TreeParams[4],HM_FontColorOver),
258 BGColor : HM_f_EvalParameters(TreeParams[5],HM_BGColor),
259 BGColorOver : HM_f_EvalParameters(TreeParams[6],HM_BGColorOver),
260 BorderColor : HM_f_EvalParameters(TreeParams[7],HM_BorderColor),
261 TopIsPermanent : ((MenuLeft == null) || (MenuTop == null)) ? false : HM_f_EvalParameters(TreeParams[9],false,"boolean"),
262 TopIsHorizontal : TopIsHorizontal = HM_f_EvalParameters(TreeParams[10],false,"boolean"),
263 TreeIsHorizontal : TreeHasChildren ? HM_f_EvalParameters(TreeParams[11],false,"boolean") : false,
264 PositionUnder : (!TopIsHorizontal || !TreeHasChildren) ? false : HM_f_EvalParameters(TreeParams[12],false,"boolean"),
265 TopImageShow : TreeHasChildren ? HM_f_EvalParameters(TreeParams[13],true,"boolean") : false,
266 TreeImageShow : TreeHasChildren ? HM_f_EvalParameters(TreeParams[14],true,"boolean") : false,
267 UponDisplay : HM_f_EvalParameters(TreeParams[15],HM_UponDisplay,"delayed"),
268 UponHide : HM_f_EvalParameters(TreeParams[16],HM_UponHide,"delayed"),
269 RightToLeft : HM_f_EvalParameters(TreeParams[17],HM_RightToLeft,"boolean"),
270 NSFontOver : HM_NSFontOver ? (FontColor != FontColorOver) : false,
271 ClickStart : HM_f_EvalParameters(TreeParams[18],HM_ClickStart,"boolean"),
272 TopIsVariableWidth : HM_f_EvalParameters(TreeParams[19],false,"boolean"),
273 TreeIsVariableWidth : HM_f_EvalParameters(TreeParams[20],false,"boolean")
276 HM_CurrentMenu = null;
277 HM_f_MakeMenu(HM_a_TreesToBuild[t]);
278 HM_a_TopMenus[HM_TotalTrees] = HM_CurrentTree.treeParent;
280 if(HM_CurrentTree.TopIsPermanent){
281 with(HM_CurrentTree.treeParent) {
282 moveTo(eval(HM_CurrentTree.MenuLeft),eval(HM_CurrentTree.MenuTop));
289 if(HM_StatusDisplayBuild) status = HM_TotalTrees + " Hierarchical Menu Trees Created";
290 HM_AreCreated = true;
291 HM_BeingCreated = false;
294 function HM_f_GetItemHtmlStr(arraystring){
295 var TempString = arraystring;
296 if (HM_FontBold) TempString = TempString.bold();
297 if (HM_FontItalic) TempString = TempString.italics();
298 TempString = "<FONT FACE='" + HM_FontFamily + "' POINT-SIZE=" + HM_FontSize + ">" + TempString + "</FONT>";
299 var TempStringOver = TempString.fontcolor(HM_CurrentTree.FontColorOver);
300 TempString = TempString.fontcolor(HM_CurrentTree.FontColor);
301 return [TempString,TempStringOver];
304 function HM_f_MakeMenu(menucount) {
305 if(!HM_f_ValidateArray(HM_ArrayIDPrefix + menucount)) return false;
306 HM_CurrentArray = eval(HM_ArrayIDPrefix + menucount);
308 NewMenu = eval("window." + HM_MenuIDPrefix + menucount);
310 eval(HM_MenuIDPrefix + menucount + " = new Layer(HM_CurrentTree.MenuWidth,window)");
311 NewMenu = eval(HM_MenuIDPrefix + menucount);
314 NewMenu.parentMenu = HM_CurrentMenu;
315 NewMenu.parentItem = HM_CurrentItem;
316 NewMenu.parentItem.child = NewMenu;
317 NewMenu.hasParent = true;
318 NewMenu.isHorizontal = HM_CurrentTree.TreeIsHorizontal;
319 NewMenu.showImage = HM_CurrentTree.TreeImageShow;
322 NewMenu.isHorizontal = HM_CurrentTree.TopIsHorizontal;
323 NewMenu.showImage = HM_CurrentTree.TopImageShow;
326 HM_CurrentMenu = NewMenu;
327 HM_CurrentMenu.count = menucount;
328 HM_CurrentMenu.tree = HM_CurrentTree;
329 HM_CurrentMenu.array = HM_CurrentArray;
330 HM_CurrentMenu.maxItems = HM_CurrentArray.length - 1;
331 HM_CurrentMenu.bgColor = HM_CurrentTree.BorderColor;
332 HM_CurrentMenu.IsVariableWidth = ((HM_CurrentMenu.hasParent && HM_CurrentTree.TreeIsVariableWidth) || (!HM_CurrentMenu.hasParent && HM_CurrentTree.TopIsVariableWidth));
333 HM_CurrentMenu.onmouseover = HM_f_MenuOver;
334 HM_CurrentMenu.onmouseout = HM_f_MenuOut;
335 HM_CurrentMenu.moveTo(0,0);
338 if(!HM_CurrentTree.treeParent) HM_CurrentTree.treeParent = HM_CurrentTree.startChild = HM_CurrentMenu;
340 while (HM_CurrentMenu.itemCount < HM_CurrentMenu.maxItems) {
341 HM_CurrentMenu.itemCount++;
342 HM_CurrentItem = eval("window." + HM_ItemIDPrefix + menucount + "_" + HM_CurrentMenu.itemCount);
343 if(!HM_CurrentItem) {
344 eval(HM_ItemIDPrefix + menucount + "_" + HM_CurrentMenu.itemCount + " = new Layer(HM_CurrentTree.ItemWidth - (HM_ItemPadding*2),HM_CurrentMenu)")
345 if(HM_StatusDisplayBuild) status = "Creating Hierarchical Menus: " + menucount + " / " + HM_CurrentMenu.itemCount;
346 HM_CurrentItem = eval(HM_ItemIDPrefix + menucount + "_" + HM_CurrentMenu.itemCount);
347 HM_CurrentItem.itemSetup(menucount + "_" + HM_CurrentMenu.itemCount);
349 if(HM_CurrentItem.hasMore && (!HM_CreateTopOnly || HM_AreCreated && HM_CreateTopOnly)) {
350 MenuCreated = HM_f_MakeMenu(menucount + "_" + HM_CurrentMenu.itemCount);
352 HM_CurrentMenu = HM_CurrentMenu.parentMenu;
353 HM_CurrentArray = HM_CurrentMenu.array;
357 HM_CurrentMenu.itemCount = 0;
358 if (HM_CurrentMenu.isHorizontal) {
359 HM_CurrentMenu.clip.right = HM_CurrentMenu.lastItem.left + HM_CurrentMenu.lastItem.clip.right + HM_BorderWidth;
362 HM_CurrentMenu.clip.right = HM_CurrentMenu.lastItem.clip.width + (HM_BorderWidth*2);
364 HM_CurrentMenu.clip.bottom = HM_CurrentMenu.lastItem.top + HM_CurrentMenu.lastItem.clip.bottom + HM_BorderWidth;
365 return HM_CurrentMenu;
368 function HM_f_ItemSetup(itemidsuffix) {
369 this.menu = HM_CurrentMenu;
370 this.tree = HM_CurrentTree;
371 this.index = HM_CurrentMenu.itemCount - 1;
372 this.array = HM_CurrentArray[HM_CurrentMenu.itemCount];
373 this.dispText = this.array[0];
374 this.linkText = this.array[1];
375 this.permHilite = HM_f_EvalParameters(this.array[3],false,"boolean");
376 this.hasRollover = (!this.permHilite && HM_f_EvalParameters(this.array[2],true,"boolean"));
377 this.hasMore = HM_f_EvalParameters(this.array[4],false,"boolean") && HM_f_ValidateArray(HM_ArrayIDPrefix + itemidsuffix);
378 var HtmlStrings = HM_f_GetItemHtmlStr(this.dispText);
379 this.htmStr = HtmlStrings[0];
380 this.htmStrOver = HtmlStrings[1];
381 this.visibility = "inherit";
382 this.onmouseover = HM_f_ItemOver;
383 this.onmouseout = HM_f_ItemOut;
384 this.menu.lastItem = this;
385 this.showChild = HM_f_ShowChild;
387 this.ClickStart = this.hasMore && this.tree.ClickStart && (this.tree.TopIsPermanent && (this.tree.treeParent==this.menu));
388 if(this.ClickStart) {
389 this.captureEvents(Event.MOUSEUP);
390 this.onmouseup = this.showChild;
395 this.captureEvents(Event.MOUSEUP);
396 this.onmouseup = HM_f_LinkIt;
400 this.txtLyrOff = new Layer(HM_CurrentTree.ItemTextWidth - (HM_ItemPadding*2),this);
401 with(this.txtLyrOff) {
402 document.write(this.permHilite ? this.htmStrOver : this.htmStr);
404 if (HM_CurrentTree.RightToLeft && this.menu.showImage && (!this.menu.isHorizontal || (this.menu.isHorizontal && (!this.menu.IsVariableWidth || (this.menu.IsVariableWidth && this.hasMore))) )) left = HM_ItemPadding + HM_ImageSize + HM_ImageHorizSpace;
405 visibility = "inherit";
408 if(this.menu.IsVariableWidth){
409 this.ItemTextWidth = this.txtLyrOff.document.width;
410 this.ItemWidth = this.ItemTextWidth + (HM_ItemPadding*2);
411 if(HM_CurrentMenu.showImage) {
412 if(!this.menu.isHorizontal || this.hasMore) {
413 this.ItemWidth += (HM_ItemPadding + HM_ImageSize + HM_ImageHorizSpace);
418 this.ItemWidth = this.tree.ItemWidth;
419 this.ItemTextWidth = this.tree.ItemTextWidth;
421 if (this.menu.isHorizontal) {
422 if (this.index) this.left = this.siblingBelow.left + this.siblingBelow.clip.width + HM_SeparatorSize;
423 else this.left = (HM_BorderWidth + HM_ItemPadding);
424 this.top = (HM_BorderWidth + HM_ItemPadding);
427 this.left = (HM_BorderWidth + HM_ItemPadding);
428 if (this.index) this.top = this.siblingBelow.top + this.siblingBelow.clip.height + HM_SeparatorSize;
429 else this.top = (HM_BorderWidth + HM_ItemPadding)
431 this.clip.top = this.clip.left = -HM_ItemPadding;
432 this.clip.right = this.ItemWidth - HM_ItemPadding;
433 this.bgColor = this.permHilite ? this.tree.BGColorOver : this.tree.BGColor;
435 if(this.tree.NSFontOver) {
436 if(!this.permHilite){
437 this.txtLyrOn = new Layer(this.ItemTextWidth,this);
438 with(this.txtLyrOn) {
439 if (HM_CurrentTree.RightToLeft && this.menu.showImage && (!this.menu.isHorizontal || (this.menu.isHorizontal && (!this.menu.IsVariableWidth || (this.menu.IsVariableWidth && this.hasMore))) )) left = HM_ItemPadding + HM_ImageSize + HM_ImageHorizSpace;
445 this.fullClip = this.txtLyrOff.document.height + (HM_ItemPadding * 2);
446 if(this.menu.isHorizontal) {
448 var SiblingHeight = this.siblingBelow.clip.height;
449 this.fullClip = Math.max(SiblingHeight,this.fullClip);
450 if(this.fullClip > SiblingHeight) {
451 var SiblingPrevious = this.siblingBelow;
452 while(SiblingPrevious != null) {
453 SiblingPrevious.clip.height = this.fullClip;
454 SiblingPrevious = SiblingPrevious.siblingBelow;
459 this.clip.height = this.fullClip;
461 if(!this.menu.isHorizontal && this.menu.IsVariableWidth) {
462 this.fullWidth = this.clip.width;
464 var SiblingWidth = this.siblingBelow.clip.width;
465 this.fullWidth = Math.max(SiblingWidth,this.fullWidth);
466 SiblingPrevious = this.siblingBelow;
467 while(SiblingPrevious != null) {
468 SiblingPrevious.clip.width = this.fullWidth;
469 SiblingPrevious.dummyLyr.clip.width = this.fullWidth;
470 if(SiblingPrevious.hasMore) {
471 SiblingPrevious.DistanceToRightEdge = SiblingPrevious.clip.right + SiblingPrevious.WhatsOnRight;
472 SiblingPrevious.DistanceToLeftEdge = HM_ItemPadding + SiblingPrevious.WhatsOnLeft;
473 SiblingPrevious.CompleteWidth = SiblingPrevious.ItemWidth + SiblingPrevious.WhatsOnLeft + SiblingPrevious.WhatsOnRight;
474 SiblingPrevious.ChildOverlap = (parseInt((HM_ChildPerCentOver != null) ? (HM_ChildPerCentOver * SiblingPrevious.CompleteWidth) : HM_ChildOverlap));
476 if(SiblingPrevious.imgLyr && !HM_CurrentTree.RightToLeft) {
477 SiblingPrevious.imgLyr.left = this.fullWidth - (HM_ItemPadding * 2) - HM_ImageSize - HM_ImageHorizSpace;
479 SiblingPrevious = SiblingPrevious.siblingBelow;
482 this.clip.width = this.fullWidth;
485 this.dummyLyr = new Layer(100,this);
486 with(this.dummyLyr) {
487 left = top = -HM_ItemPadding;
488 clip.width = this.clip.width;
489 clip.height = this.clip.height;
490 visibility = "inherit";
493 if(this.hasMore && HM_CurrentMenu.showImage) {
494 this.imageSrc = this.tree.RightToLeft ? HM_ImageSrcLeft : HM_ImageSrc;
495 this.hasImageRollover = ((!this.tree.RightToLeft && HM_ImageSrcOver) || (this.tree.RightToLeft && HM_ImageSrcLeftOver));
496 if(this.hasImageRollover) {
497 this.imageSrcOver = this.tree.RightToLeft ? HM_ImageSrcLeftOver : HM_ImageSrcOver;
498 if(this.permHilite) this.imageSrc = this.imageSrcOver;
500 this.imgLyr = new Layer(HM_ImageSize,this);
503 document.write("<IMG SRC='" + this.imageSrc + "' WIDTH=" + HM_ImageSize + " VSPACE=0 HSPACE=0 BORDER=0>");
505 moveBelow(this.txtLyrOff);
506 left = (HM_CurrentTree.RightToLeft) ? HM_ImageHorizSpace : this.ItemWidth - (HM_ItemPadding * 2) - HM_ImageSize - HM_ImageHorizSpace;
507 top = HM_ImageVertSpace;
508 visibility = "inherit";
510 this.imageElement = this.imgLyr.document.images[0];
514 this.WhatsOnRight = (!this.menu.isHorizontal || (this.menu.isHorizontal && this.isLastItem)) ? HM_BorderWidth : HM_SeparatorSize;
515 this.DistanceToRightEdge = this.clip.right + this.WhatsOnRight;
516 this.WhatsOnLeft = (!this.menu.isHorizontal || (this.menu.isHorizontal && this.index==0)) ? HM_BorderWidth : HM_SeparatorSize;
517 this.DistanceToLeftEdge = HM_ItemPadding + this.WhatsOnLeft;
518 this.CompleteWidth = this.ItemWidth + this.WhatsOnLeft + this.WhatsOnRight;
519 this.ChildOverlap = (parseInt((HM_ChildPerCentOver != null) ? (HM_ChildPerCentOver * this.CompleteWidth) : HM_ChildOverlap));
523 function HM_f_PopUp(menuname,e){
524 if (!HM_AreLoaded) return;
525 menuname = menuname.replace("elMenu",HM_MenuIDPrefix);
526 var TempMenu = eval("window."+menuname);
528 HM_CurrentMenu = TempMenu;
529 if (HM_CurrentMenu.tree.ClickStart) {
530 var ClickElement = e.target;
531 ClickElement.onclick = HM_f_PopMenu;
533 else HM_f_PopMenu(e);
536 function HM_f_PopMenu(e){
537 if (!HM_AreLoaded || !HM_AreCreated) return true;
538 if (HM_CurrentMenu.tree.ClickStart && e.type != "click") return true;
540 HM_CurrentMenu.hasParent = false;
541 HM_CurrentMenu.tree.startChild = HM_CurrentMenu;
542 var mouse_x_position = e.pageX;
543 var mouse_y_position = e.pageY;
544 HM_CurrentMenu.xPos = (HM_CurrentMenu.tree.MenuLeft!=null) ? eval(HM_CurrentMenu.tree.MenuLeft) : mouse_x_position;
545 HM_CurrentMenu.yPos = (HM_CurrentMenu.tree.MenuTop!=null) ? eval(HM_CurrentMenu.tree.MenuTop) : mouse_y_position;
547 HM_CurrentMenu.keepInWindow();
548 HM_CurrentMenu.moveTo(HM_CurrentMenu.xPos,HM_CurrentMenu.yPos);
549 HM_CurrentMenu.isOn = true;
550 HM_CurrentMenu.showIt(true);
554 function HM_f_MenuOver() {
555 if(!this.tree.startChild){this.tree.startChild = this}
556 if(this.tree.startChild == this) HM_f_HideAll(this)
558 HM_UserOverMenu = true;
559 HM_CurrentMenu = this;
560 if (this.hideTimer) clearTimeout(this.hideTimer);
563 function HM_f_MenuOut() {
565 HM_UserOverMenu = false;
566 if(HM_StatusDisplayLink) status = "";
568 clearTimeout(HM_HideAllTimer);
569 HM_HideAllTimer = null;
570 HM_HideAllTimer = setTimeout("HM_CurrentMenu.hideTree()",HM_ChildMilliSecondsVisible);
574 function HM_f_ShowChild(){
576 HM_CurrentTree = this.tree;
577 HM_CurrentMenu = this.menu;
578 HM_CurrentItem = this;
579 this.child = HM_f_MakeMenu(this.menu.count + "_"+(this.index+1));
580 this.tree.treeParent = this.menu;
581 this.tree.startChild = this.menu;
583 if (this.tree.PositionUnder && (this.menu == this.tree.treeParent)) {
584 this.child.xPos = this.pageX + this.clip.left - HM_BorderWidth;
585 this.child.yPos = this.menu.top + this.menu.clip.height - HM_BorderWidth;
588 this.oL = this.pageX;
589 this.child.offsetWidth = this.child.clip.width;
590 this.oT = this.pageY + this.clip.top - HM_BorderWidth;
591 if(this.tree.RightToLeft) {
592 this.child.xPos = ((this.oL - this.DistanceToLeftEdge) + this.ChildOverlap) - this.child.offsetWidth;
595 this.child.xPos = (this.oL + this.DistanceToRightEdge) - this.ChildOverlap;
597 this.child.yPos = this.oT + HM_ChildOffset + HM_BorderWidth;
599 if(!this.tree.PositionUnder || this.menu!=this.tree.treeParent) this.child.keepInWindow();
600 this.child.moveTo(this.child.xPos,this.child.yPos);
601 this.menu.hasChildVisible = true;
602 this.menu.visibleChild = this.child;
603 this.child.showIt(true);
606 function HM_f_ItemOver(){
608 if (this.menu.currentItem && this.menu.currentItem != this && this.menu.currentItem.hasRollover) {
609 with(this.menu.currentItem){
610 bgColor = this.tree.BGColor;
611 if(this.tree.NSFontOver) {
612 txtLyrOff.visibility = "inherit";
613 txtLyrOn.visibility = "hide";
616 if(this.menu.currentItem.hasImageRollover)this.menu.currentItem.imageElement.src = this.menu.currentItem.imageSrc;
619 if(this.hasRollover) {
620 this.bgColor = this.tree.BGColorOver;
621 if(this.tree.NSFontOver) {
622 if(!this.txtLyrOn.isWritten){
623 this.txtLyrOn.document.write(this.htmStrOver);
624 this.txtLyrOn.document.close();
625 this.txtLyrOn.isWritten = true;
627 this.txtLyrOff.visibility = "hide";
628 this.txtLyrOn.visibility = "inherit";
630 if(this.hasImageRollover)this.imageElement.src = this.imageSrcOver;
633 if(HM_StatusDisplayLink) status = this.linkText;
634 this.menu.currentItem = this;
635 if (this.menu.hasChildVisible) {
636 if(this.menu.visibleChild == this.child && this.menu.visibleChild.hasChildVisible) this.menu.visibleChild.hideChildren(this);
637 else this.menu.hideChildren(this);
640 if (this.hasMore && !this.ClickStart) this.showChild();
643 function HM_f_ItemOut() {
644 if ( (!HM_KeepHilite || ((this.tree.TopIsPermanent && (this.tree.treeParent==this)) && !this.menu.hasChildVisible)) && this.hasRollover) {
646 bgColor = this.tree.BGColor;
647 if(this.tree.NSFontOver) {
648 txtLyrOff.visibility = "inherit";
649 txtLyrOn.visibility = "hide";
651 if(this.hasImageRollover)this.imageElement.src = this.imageSrc;
654 if(!HM_ClickKill && !HM_UserOverMenu) {
655 clearTimeout(HM_HideAllTimer);
656 HM_HideAllTimer = null;
657 HM_HideAllTimer = setTimeout("HM_CurrentMenu.hideTree()",HM_ChildMilliSecondsVisible);
661 function HM_f_ShowIt(on) {
662 if (!(this.tree.TopIsPermanent && (this.tree.treeParent==this))) {
663 if(!this.hasParent || (this.hasParent && this.tree.TopIsPermanent && (this.tree.treeParent==this.parentMenu) )) {
664 if (on == this.hidden)
665 eval(on ? this.tree.UponDisplay : this.tree.UponHide)
667 if (on) this.zIndex = ++HM_ZIndex;
668 this.visibility = on ? "show" : "hide";
670 if (HM_KeepHilite && this.currentItem && this.currentItem.hasRollover) {
671 with(this.currentItem){
672 bgColor = this.tree.BGColor;
673 if(this.tree.NSFontOver) {
674 txtLyrOff.visibility = "inherit";
675 txtLyrOn.visibility = "hide";
678 if(this.currentItem.hasImageRollover)this.currentItem.imageElement.src = this.currentItem.imageSrc;
680 this.currentItem = null;
683 function HM_f_KeepInWindow() {
685 var WindowLeftEdge = window.pageXOffset;
686 var WindowTopEdge = window.pageYOffset;
687 var WindowWidth = window.innerWidth;
688 var WindowHeight = window.innerHeight;
689 var WindowRightEdge = (WindowLeftEdge + WindowWidth) - ExtraSpace;
690 var WindowBottomEdge = (WindowTopEdge + WindowHeight) - ExtraSpace;
692 var MenuLeftEdge = this.xPos;
693 var MenuRightEdge = MenuLeftEdge + this.clip.width;
694 var MenuBottomEdge = this.yPos + this.clip.height;
696 if (this.hasParent) {
697 var ParentLeftEdge = this.parentItem.pageX;
698 this.offsetWidth = this.clip.width;
700 if (MenuRightEdge > WindowRightEdge) {
701 if (this.hasParent) {
702 this.xPos = ((ParentLeftEdge - this.parentItem.DistanceToLeftEdge) + this.parentItem.ChildOverlap) - this.offsetWidth;
705 dif = MenuRightEdge - WindowRightEdge;
708 this.xPos = Math.max(5,this.xPos);
711 if (MenuBottomEdge > WindowBottomEdge) {
712 dif = MenuBottomEdge - WindowBottomEdge;
716 if (MenuLeftEdge < WindowLeftEdge) {
717 if (this.hasParent) {
718 this.xPos = (ParentLeftEdge + this.parentItem.DistanceToRightEdge) - this.parentItem.ChildOverlap;
719 MenuRightEdge = this.xPos + this.offsetWidth;
720 if(MenuRightEdge > WindowRightEdge) this.xPos -= (MenuRightEdge - WindowRightEdge);
726 function HM_f_LinkIt() {
727 if (this.linkText.indexOf("javascript:")!=-1) eval(this.linkText)
730 location.href = this.linkText;
734 function HM_f_PopDown(menuname){
735 if (!HM_AreLoaded || !HM_AreCreated) return;
736 menuname = menuname.replace("elMenu",HM_MenuIDPrefix);
737 var MenuToHide = eval("window."+menuname);
738 if(!MenuToHide)return;
739 MenuToHide.isOn = false;
740 if (!HM_ClickKill) MenuToHide.hideTop();
743 function HM_f_HideAll(callingmenu) {
744 for(var i=0; i<HM_TotalTrees; i++) {
745 var TopMenu = HM_a_TopMenus[i].tree.startChild;
746 if(TopMenu == callingmenu)continue
747 TopMenu.isOn = false;
748 if (TopMenu.hasChildVisible) TopMenu.hideChildren();
749 TopMenu.showIt(false);
753 function HM_f_HideTree() {
754 HM_HideAllTimer = null;
755 if (HM_UserOverMenu) return;
756 if (this.hasChildVisible) this.hideChildren();
760 function HM_f_HideTop() {
761 TopMenuToHide = this;
762 (HM_ClickKill) ? TopMenuToHide.hideSelf() : (this.hideTimer = setTimeout("TopMenuToHide.hideSelf()",HM_TopMilliSecondsVisible));
765 function HM_f_HideSelf() {
766 this.hideTimer = null;
767 if (!this.isOn && !HM_UserOverMenu) this.showIt(false);
770 function HM_f_HideParents() {
772 while(TempMenu.hasParent) {
773 TempMenu.showIt(false);
774 TempMenu.parentMenu.isOn = false;
775 TempMenu = TempMenu.parentMenu;
780 function HM_f_HideChildren(callingitem) {
781 var TempMenu = this.visibleChild;
782 while(TempMenu.hasChildVisible) {
783 TempMenu.visibleChild.showIt(false);
784 TempMenu.hasChildVisible = false;
785 TempMenu = TempMenu.visibleChild;
788 if (!this.isOn || !callingitem.hasMore || this.visibleChild != callingitem.child) {
789 this.visibleChild.showIt(false);
790 this.hasChildVisible = false;
794 function HM_f_PageClick() {
795 if (!HM_UserOverMenu && HM_CurrentMenu!=null && !HM_CurrentMenu.isOn) HM_f_HideAll();
799 popDown = HM_f_PopDown;
801 HM_f_OtherOnLoad = (window.onload) ? window.onload : new Function;
802 window.onload = HM_f_StartIt;