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 ["BorderStyle", "solid"],
23 ["SeparatorSize", 1, "number"],
24 ["SeparatorColor", "yellow"],
25 ["ImageSrc", "HM_More_black_right.gif"],
26 ["ImageSrcOver", null],
27 ["ImageSrcLeft", "HM_More_black_left.gif"],
28 ["ImageSrcLeftOver", null],
29 ["ImageSize", 5, "number"],
30 ["ImageHorizSpace", 0, "number"],
31 ["ImageVertSpace", 0, "number"],
32 ["KeepHilite", false, "boolean"],
33 ["ClickStart", false, "boolean"],
34 ["ClickKill", true, "boolean"],
35 ["ChildOverlap", 20, "number"],
36 ["ChildOffset", 10, "number"],
37 ["ChildPerCentOver", null, "number"],
38 ["TopSecondsVisible", .5, "number"],
39 ["ChildSecondsVisible",.3, "number"],
40 ["StatusDisplayBuild", 1, "boolean"],
41 ["StatusDisplayLink", 1, "boolean"],
42 ["UponDisplay", null, "delayed"],
43 ["UponHide", null, "delayed"],
44 ["RightToLeft", false, "boolean"],
45 ["CreateTopOnly", 0, "boolean"],
46 ["ShowLinkCursor", false, "boolean"]
49 HM_MenuIDPrefix = "HM_Menu";
50 HM_ItemIDPrefix = "HM_Item";
51 HM_ArrayIDPrefix = "HM_Array";
53 Function.prototype.isFunction = true;
54 Function.prototype.isString = false;
55 String.prototype.isFunction = false;
56 String.prototype.isString = true;
57 String.prototype.isBoolean = false;
58 String.prototype.isNumber = false;
59 Number.prototype.isString = false;
60 Number.prototype.isFunction = false;
61 Number.prototype.isBoolean = false;
62 Number.prototype.isNumber = true;
63 Boolean.prototype.isString = false;
64 Boolean.prototype.isFunction = false;
65 Boolean.prototype.isBoolean = true;
66 Boolean.prototype.isNumber = false;
67 Array.prototype.itemValidation = false;
68 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 propertyTransfer(){
175 this.obj = eval(this.id + "Obj");
176 for (temp in this.obj) {this[temp] = this.obj[temp]}
179 function HM_f_StartIt() {
180 if((typeof(document.body) == "undefined") || (document.body == null)) return;
181 if(HM_AreCreated) return;
184 HM_f_OtherMouseDown = (document.onmousedown) ? document.onmousedown : new Function;
185 document.onmousedown = function(){HM_f_PageClick();HM_f_OtherMouseDown()}
188 HM_TopMilliSecondsVisible = HM_TopSecondsVisible * 1000;
194 function HM_f_MakeTrees(){
195 HM_BeingCreated = true;
196 var TreeParams = null;
197 var TreeHasChildren = false;
198 var ItemArray = null;
200 for(var t=0; t<HM_a_TreesToBuild.length; t++) {
201 if(!HM_f_ValidateArray(HM_ArrayIDPrefix + HM_a_TreesToBuild[t])) continue;
202 HM_CurrentArray = eval(HM_ArrayIDPrefix + HM_a_TreesToBuild[t]);
204 TreeParams = HM_CurrentArray[0];
205 TreeHasChildren = false;
207 for(var i=1; i<HM_CurrentArray.length; i++) {
208 ItemArray = HM_CurrentArray[i];
209 if(ItemArray[ItemArray.length-1]) {TreeHasChildren = true; break}
213 MenuWidth : MenuWidth = HM_f_EvalParameters(TreeParams[0],HM_MenuWidth,"number"),
214 MenuLeft : MenuLeft = HM_f_EvalParameters(TreeParams[1],null,"delayed"),
215 MenuTop : MenuTop = HM_f_EvalParameters(TreeParams[2],null,"delayed"),
216 ItemWidth : MenuWidth - (HM_BorderWidth*2),
217 FontColor : HM_f_EvalParameters(TreeParams[3],HM_FontColor),
218 FontColorOver : HM_f_EvalParameters(TreeParams[4],HM_FontColorOver),
219 BGColor : HM_f_EvalParameters(TreeParams[5],HM_BGColor),
220 BGColorOver : HM_f_EvalParameters(TreeParams[6],HM_BGColorOver),
221 BorderColor : HM_f_EvalParameters(TreeParams[7],HM_BorderColor),
222 SeparatorColor : HM_f_EvalParameters(TreeParams[8],HM_SeparatorColor),
223 TopIsPermanent : ((MenuLeft == null) || (MenuTop == null)) ? false : HM_f_EvalParameters(TreeParams[9],false,"boolean"),
224 TopIsHorizontal : TopIsHorizontal = HM_f_EvalParameters(TreeParams[10],false,"boolean"),
225 TreeIsHorizontal : TreeHasChildren ? HM_f_EvalParameters(TreeParams[11],false,"boolean") : false,
226 PositionUnder : (!TopIsHorizontal || !TreeHasChildren) ? false : HM_f_EvalParameters(TreeParams[12],false,"boolean"),
227 TopImageShow : TreeHasChildren ? HM_f_EvalParameters(TreeParams[13],true,"boolean") : false,
228 TreeImageShow : TreeHasChildren ? HM_f_EvalParameters(TreeParams[14],true,"boolean") : false,
229 UponDisplay : HM_f_EvalParameters(TreeParams[15],HM_UponDisplay,"delayed"),
230 UponHide : HM_f_EvalParameters(TreeParams[16],HM_UponHide,"delayed"),
231 RightToLeft : HM_f_EvalParameters(TreeParams[17],HM_RightToLeft,"boolean"),
232 ClickStart : HM_f_EvalParameters(TreeParams[18],HM_ClickStart,"boolean"),
233 TopIsVariableWidth : HM_f_EvalParameters(TreeParams[19],false,"boolean"),
234 TreeIsVariableWidth : HM_f_EvalParameters(TreeParams[20],false,"boolean")
237 HM_CurrentMenu = null;
238 HM_f_MakeMenu(HM_a_TreesToBuild[t]);
239 HM_a_TopMenus[HM_TotalTrees] = HM_CurrentTree.treeParent;
241 if(HM_CurrentTree.TopIsPermanent){
242 with(HM_CurrentTree.treeParent) {
243 HM_CurrentTree.treeParent.xPos = eval(HM_CurrentTree.MenuLeft);
244 HM_CurrentTree.treeParent.yPos = eval(HM_CurrentTree.MenuTop);
245 moveTo(HM_CurrentTree.treeParent.xPos,HM_CurrentTree.treeParent.yPos);
246 style.zIndex = HM_ZIndex;
247 setTimeout(HM_CurrentTree.treeParent.id + ".fixSize(true)",10);
252 if(HM_StatusDisplayBuild) status = HM_TotalTrees + " Hierarchical Menu Trees Created";
253 HM_AreCreated = true;
254 HM_BeingCreated = false;
257 function HM_f_GetItemDivStr(itemid,disptext,hasmore){
258 var WidthValue = HM_CurrentMenu.isHorizontal ? (ItemElement.isLastItem) ? (HM_CurrentTree.MenuWidth - HM_BorderWidth - HM_SeparatorSize) : (HM_CurrentTree.MenuWidth - HM_BorderWidth) : HM_CurrentTree.ItemWidth;
259 var TempString = "<DIV ID=" + itemid + " STYLE='position:absolute;width:" + WidthValue + "px'>";
260 if(HM_CurrentMenu.showImage) {
261 var FullPadding = (HM_ItemPadding*2) + HM_ImageSize + HM_ImageHorizSpace;
263 if(hasmore && HM_CurrentMenu.showImage) {
264 var ImgSrc = HM_CurrentTree.RightToLeft ? HM_ImageSrcLeft : HM_ImageSrc;
265 var ImgStyle = "top:"+ (HM_ItemPadding + HM_ImageVertSpace) + "px;width:"+ HM_ImageSize + "px;";
266 var ImgString = "<IMG ID='HM_ImMore' STYLE='position:absolute;"+ ImgStyle +"' SRC='" + ImgSrc + "' HSPACE=0 VSPACE=0 BORDER=0>";
267 TempString += ImgString;
269 TempString += disptext + "</DIV>";
273 function HM_f_SetItemProperties(itemid,itemidsuffix) {
274 this.tree = HM_CurrentTree;
275 this.itemsetup = HM_f_ItemSetup;
276 this.index = HM_CurrentMenu.itemCount - 1;
277 this.isLastItem = (HM_CurrentMenu.itemCount == HM_CurrentMenu.maxItems);
278 this.array = HM_CurrentMenu.array[HM_CurrentMenu.itemCount];
279 this.dispText = this.array[0];
280 this.linkText = this.array[1];
281 this.permHilite = HM_f_EvalParameters(this.array[3],false,"boolean");
282 this.hasRollover = (!this.permHilite && HM_f_EvalParameters(this.array[2],true,"boolean"));
283 this.hasMore = HM_f_EvalParameters(this.array[4],false,"boolean") && HM_f_ValidateArray(HM_ArrayIDPrefix + itemidsuffix);
284 this.childID = this.hasMore ? (HM_MenuIDPrefix + itemidsuffix) : null;
286 this.onmouseover = HM_f_ItemOver;
287 this.onmouseout = HM_f_ItemOut;
288 this.setItemStyle = HM_f_SetItemStyle;
289 this.itemStr = HM_f_GetItemDivStr(itemid,this.dispText,this.hasMore);
290 this.showChild = HM_f_ShowChild;
291 this.ChildOverlap = null;
294 function HM_f_Make4ItemElement(menucount) {
295 var ItemIDSuffix = menucount + "_" + HM_CurrentMenu.itemCount;
296 var LayerID = HM_ItemIDPrefix + ItemIDSuffix;
297 var ObjectID = LayerID + "Obj";
298 eval(ObjectID + " = new Object()");
299 ItemElement = eval(ObjectID);
300 ItemElement.setItemProperties = HM_f_SetItemProperties;
301 ItemElement.setItemProperties(LayerID,ItemIDSuffix);
305 function HM_f_MakeElement(menuid) {
307 var LayerID = menuid;
308 var ObjectID = LayerID + "Obj";
309 eval(ObjectID + " = new Object()");
310 MenuObject = eval(ObjectID);
314 function HM_f_MakeMenu(menucount) {
315 if(!HM_f_ValidateArray(HM_ArrayIDPrefix + menucount)) return false;
316 HM_CurrentArray = eval(HM_ArrayIDPrefix + menucount);
317 NewMenu = document.all(HM_MenuIDPrefix + menucount);
319 NewMenu = HM_f_MakeElement(HM_MenuIDPrefix + menucount);
320 NewMenu.array = HM_CurrentArray;
321 NewMenu.tree = HM_CurrentTree;
324 NewMenu.parentMenu = HM_CurrentMenu;
325 NewMenu.parentItem = HM_CurrentMenu.itemElement;
326 NewMenu.parentItem.child = NewMenu;
327 NewMenu.hasParent = true;
328 NewMenu.isHorizontal = HM_CurrentTree.TreeIsHorizontal;
329 NewMenu.showImage = HM_CurrentTree.TreeImageShow;
332 NewMenu.isHorizontal = HM_CurrentTree.TopIsHorizontal;
333 NewMenu.showImage = HM_CurrentTree.TopImageShow;
336 HM_CurrentMenu = NewMenu;
337 HM_CurrentMenu.itemCount = 0;
338 HM_CurrentMenu.maxItems = HM_CurrentMenu.array.length - 1;
339 HM_CurrentMenu.showIt = HM_f_ShowIt;
340 HM_CurrentMenu.keepInWindow = HM_f_KeepInWindow;
341 HM_CurrentMenu.onmouseover = HM_f_MenuOver;
342 HM_CurrentMenu.onmouseout = HM_f_MenuOut;
343 HM_CurrentMenu.hideTree = HM_f_HideTree
344 HM_CurrentMenu.hideParents = HM_f_HideParents;
345 HM_CurrentMenu.hideChildren = HM_f_HideChildren;
346 HM_CurrentMenu.hideTop = HM_f_HideTop;
347 HM_CurrentMenu.hideSelf = HM_f_HideSelf;
348 HM_CurrentMenu.count = menucount;
349 HM_CurrentMenu.hasChildVisible = false;
350 HM_CurrentMenu.isOn = false;
351 HM_CurrentMenu.hideTimer = null;
352 HM_CurrentMenu.currentItem = null;
353 HM_CurrentMenu.setMenuStyle = HM_f_SetMenuStyle;
354 HM_CurrentMenu.sizeFixed = false;
355 HM_CurrentMenu.fixSize = HM_f_FixSize;
356 HM_CurrentMenu.onselectstart = HM_f_CancelSelect;
357 HM_CurrentMenu.moveTo = HM_f_MoveTo;
358 HM_CurrentMenu.IsVariableWidth = ((HM_CurrentMenu.hasParent && HM_CurrentTree.TreeIsVariableWidth) || (!HM_CurrentMenu.hasParent && HM_CurrentTree.TopIsVariableWidth));
359 HM_CurrentMenu.htmlString = "<DIV ID='" + HM_MenuIDPrefix + menucount +"' STYLE='position:absolute;visibility:hidden;width:"+ HM_CurrentTree.MenuWidth +"'>";
362 while (HM_CurrentMenu.itemCount < HM_CurrentMenu.maxItems) {
363 HM_CurrentMenu.itemCount++;
365 HM_CurrentItem = document.all(HM_ItemIDPrefix + menucount + "_" + HM_CurrentMenu.itemCount);
366 if(!HM_CurrentItem) {
367 if(HM_StatusDisplayBuild) status = "Creating Hierarchical Menus: " + menucount + " / " + HM_CurrentMenu.itemCount;
368 HM_CurrentMenu.itemElement = HM_f_Make4ItemElement(menucount);
369 HM_CurrentMenu.htmlString += HM_CurrentMenu.itemElement.itemStr;
371 if(HM_CurrentMenu.itemElement.hasMore && (!HM_CreateTopOnly || HM_AreCreated && HM_CreateTopOnly)) {
372 MenuCreated = HM_f_MakeMenu(menucount + "_" + HM_CurrentMenu.itemCount);
374 HM_CurrentMenu = HM_CurrentMenu.parentMenu;
379 document.body.insertAdjacentHTML("BeforeEnd",HM_CurrentMenu.htmlString + "</DIV>");
380 menuLyr = document.all(HM_MenuIDPrefix + menucount);
381 menuLyr.propertyTransfer = propertyTransfer;
382 menuLyr.propertyTransfer();
383 HM_CurrentMenu = menuLyr;
384 if(!HM_CurrentMenu.hasParent)HM_CurrentTree.treeParent = HM_CurrentTree.startChild = HM_CurrentMenu;
385 HM_CurrentMenu.setMenuStyle();
386 HM_CurrentMenu.items = HM_CurrentMenu.children;
387 HM_CurrentMenu.lastItem = HM_CurrentMenu.items[HM_CurrentMenu.items.length-1];
388 for(var i=0; i<HM_CurrentMenu.items.length; i++) {
389 it = HM_CurrentMenu.items[i];
390 it.siblingBelow = i>0 ? HM_CurrentMenu.items[i-1] : null;
391 it.propertyTransfer = propertyTransfer;
392 it.propertyTransfer();
395 HM_CurrentMenu.moveTo(0,0);
396 return HM_CurrentMenu;
399 function HM_f_SetMenuStyle(){
401 borderWidth = HM_BorderWidth + "px";
402 borderColor = HM_CurrentTree.BorderColor;
403 borderStyle = HM_BorderStyle;
409 function HM_f_SetItemStyle() {
411 backgroundColor = (this.permHilite) ? HM_CurrentTree.BGColorOver : HM_CurrentTree.BGColor;
412 color = (this.permHilite) ? HM_CurrentTree.FontColorOver : HM_CurrentTree.FontColor;
413 font = ((HM_FontBold) ? "bold " : "normal ") + HM_FontSize + "pt " + HM_FontFamily;
414 padding = HM_ItemPadding + "px";
415 fontStyle = (HM_FontItalic) ? "italic" : "normal";
417 pixelWidth = HM_CurrentTree.ItemWidth;
419 if((this.menu.showImage && (!this.menu.IsVariableWidth || (this.menu.IsVariableWidth && this.tree.RightToLeft && !this.menu.isHorizontal))) || (this.menu.IsVariableWidth && this.imgLyr)) {
421 var FullPadding = (HM_ItemPadding*2) + HM_ImageSize + HM_ImageHorizSpace;
422 if (this.tree.RightToLeft) paddingLeft = FullPadding + "px";
423 else paddingRight = FullPadding + "px";
425 if(!this.isLastItem) {
426 var SeparatorString = HM_SeparatorSize + "px solid " + this.tree.SeparatorColor;
427 if (this.menu.isHorizontal) borderRight = SeparatorString;
428 else borderBottom = SeparatorString;
431 if(this.menu.isHorizontal){
433 if(this.menu.IsVariableWidth) {
434 this.realWidth = this.scrollWidth;
435 if(this.isLastItem) pixelWidth = this.realWidth;
436 else pixelWidth = (this.realWidth + HM_SeparatorSize);
437 pixelLeft = this.index ? (this.siblingBelow.style.pixelLeft + this.siblingBelow.style.pixelWidth) : 0;
438 if(this.isLastItem) {
439 LeftAndWidth = pixelLeft + pixelWidth;
440 this.menu.style.pixelWidth = LeftAndWidth + (HM_BorderWidth * 2);
445 if(this.isLastItem) pixelWidth = (HM_CurrentTree.MenuWidth - HM_BorderWidth - HM_SeparatorSize);
446 else pixelWidth = (HM_CurrentTree.MenuWidth - HM_BorderWidth);
447 pixelLeft = (this.index * (HM_CurrentTree.MenuWidth - HM_BorderWidth));
448 var LeftAndWidth = pixelLeft + pixelWidth;
449 this.menu.style.pixelWidth = LeftAndWidth + (HM_BorderWidth * 2);
458 function HM_f_FixSize(makevis){
459 if(this.isHorizontal) {
460 var MaxItemHeight = 0;
461 for(i=0; i<this.items.length; i++) {
462 var TempItem = this.items[i];
463 if (TempItem.index) {
464 var SiblingHeight = TempItem.siblingBelow.scrollHeight;
465 MaxItemHeight = Math.max(MaxItemHeight,SiblingHeight);
468 MaxItemHeight = TempItem.scrollHeight;
471 for(i=0; i<this.items.length; i++) {
472 var TempItem = this.items[i];
473 TempItem.style.pixelHeight = MaxItemHeight;
474 if(TempItem.imgLyr) {
475 if(this.tree.RightToLeft){
476 TempItem.imgLyr.style.pixelLeft = (HM_ItemPadding + HM_ImageHorizSpace);
479 TempItem.imgLyr.style.pixelLeft = TempItem.style.pixelWidth - ((TempItem.isLastItem ? 0 : HM_SeparatorSize) + HM_ItemPadding + HM_ImageHorizSpace + HM_ImageSize);
483 this.style.pixelHeight = MaxItemHeight + (HM_BorderWidth * 2);
486 if(this.IsVariableWidth) {
487 var MaxItemWidth = 0;
488 for(i=0; i<this.items.length; i++) {
489 var TempItem = this.items[i];
490 TempItem.style.pixelWidth = TempItem.scrollWidth;
491 MaxItemWidth = i ? Math.max(MaxItemWidth,TempItem.style.pixelWidth) : TempItem.style.pixelWidth;
493 for(i=0; i<this.items.length; i++) {
494 this.items[i].style.pixelWidth = MaxItemWidth;
496 this.style.pixelWidth = MaxItemWidth + (HM_BorderWidth * 2);
498 for(i=0; i<this.items.length; i++) {
499 var TempItem = this.items[i];
500 if (TempItem.index) {
501 var SiblingHeight =(TempItem.siblingBelow.scrollHeight + HM_SeparatorSize);
502 TempItem.style.pixelTop = TempItem.siblingBelow.style.pixelTop + SiblingHeight;
504 else TempItem.style.pixelTop = 0;
505 if(TempItem.imgLyr) {
506 if(HM_CurrentTree.RightToLeft){
507 TempItem.imgLyr.style.pixelLeft = (HM_ItemPadding + HM_ImageHorizSpace);
510 TempItem.imgLyr.style.pixelLeft = TempItem.style.pixelWidth - (HM_ItemPadding + HM_ImageHorizSpace + HM_ImageSize);
514 this.style.pixelHeight = TempItem.style.pixelTop + TempItem.scrollHeight + (HM_BorderWidth * 2);
516 this.sizeFixed = true;
517 if(makevis)this.style.visibility = "visible";
520 function HM_f_ItemSetup(whichItem) {
521 this.menu = this.parentElement;
522 this.ClickStart = this.hasMore && this.tree.ClickStart && (this.tree.TopIsPermanent && (this.tree.treeParent==this.menu));
523 if(this.ClickStart) {
525 this.onclick = this.showChild;
529 if(this.menu.showImage){
530 this.imgLyr = this.children("HM_ImMore");
531 this.hasImageRollover = ((!this.tree.RightToLeft && HM_ImageSrcOver) || (this.tree.RightToLeft && HM_ImageSrcLeftOver));
532 if(this.hasImageRollover) {
533 this.imageSrc = this.tree.RightToLeft ? HM_ImageSrcLeft : HM_ImageSrc;
534 this.imageSrcOver = this.tree.RightToLeft ? HM_ImageSrcLeftOver : HM_ImageSrcOver;
535 if(this.permHilite) this.imgLyr.src = this.imageSrcOver;
539 this.child = document.all(this.childID);
541 this.child.parentMenu = this.menu;
542 this.child.parentItem = this;
545 if(this.linkText && !this.ClickStart) {
546 this.onclick = HM_f_LinkIt;
547 if(HM_ShowLinkCursor)this.style.cursor = "hand";
553 function HM_f_PopUp(menuname){
554 if (!HM_AreLoaded) return;
555 menuname = menuname.replace("elMenu",HM_MenuIDPrefix);
556 var TempMenu = document.all(menuname);
557 if(!TempMenu) return;
558 HM_CurrentMenu = TempMenu;
559 if (HM_CurrentMenu.tree.ClickStart) {
560 var ClickElement = event.srcElement;
561 ClickElement.onclick = HM_f_PopMenu;
566 function HM_f_PopMenu(){
567 if (!HM_AreLoaded || !HM_AreCreated) return true;
568 if (HM_CurrentMenu.tree.ClickStart && event.type != "click") return true;
569 var mouse_x_position, mouse_y_position;
571 HM_CurrentMenu.hasParent = false;
572 HM_CurrentMenu.tree.startChild = HM_CurrentMenu;
573 HM_CurrentMenu.mouseX = mouse_x_position = (event.clientX + document.body.scrollLeft);
574 HM_CurrentMenu.mouseY = mouse_y_position = (event.clientY + document.body.scrollTop);
575 HM_CurrentMenu.xIntended = HM_CurrentMenu.xPos = (HM_CurrentMenu.tree.MenuLeft!=null) ? eval(HM_CurrentMenu.tree.MenuLeft) : mouse_x_position;
576 HM_CurrentMenu.yIntended = HM_CurrentMenu.yPos = (HM_CurrentMenu.tree.MenuTop!=null) ? eval(HM_CurrentMenu.tree.MenuTop) : mouse_y_position;
577 if(!HM_CurrentMenu.sizeFixed) HM_CurrentMenu.fixSize(false);
578 HM_CurrentMenu.keepInWindow();
579 HM_CurrentMenu.moveTo(HM_CurrentMenu.xPos,HM_CurrentMenu.yPos);
580 HM_CurrentMenu.isOn = true;
581 HM_CurrentMenu.showIt(true);
585 function HM_f_MenuOver() {
586 if(!this.tree.startChild){this.tree.startChild = this}
587 if(this.tree.startChild == this) HM_f_HideAll(this)
589 HM_UserOverMenu = true;
590 HM_CurrentMenu = this;
591 if (this.hideTimer) clearTimeout(this.hideTimer);
594 function HM_f_MenuOut() {
595 if(event.srcElement.contains(event.toElement)) return;
597 HM_UserOverMenu = false;
598 if(HM_StatusDisplayLink) status = "";
600 clearTimeout(HM_HideAllTimer);
601 HM_HideAllTimer = null;
602 HM_HideAllTimer = setTimeout("HM_CurrentMenu.hideTree()",HM_ChildMilliSecondsVisible);
606 function HM_f_ShowChild(){
608 HM_CurrentTree = this.tree;
609 HM_CurrentMenu = this.menu;
610 HM_CurrentItem = this;
611 this.child = HM_f_MakeMenu(this.menu.count + "_"+(this.index+1));
612 this.tree.treeParent = this.menu;
613 this.tree.startChild = this.menu;
614 this.child.parentItem = this;
617 if(!this.child.sizeFixed) this.child.fixSize(false);
619 if (this.tree.PositionUnder && (this.menu == this.tree.treeParent)) {
620 this.child.xPos = this.menu.style.pixelLeft + this.style.pixelLeft;
621 this.child.yPos = this.menu.style.pixelTop + this.menu.offsetHeight - (HM_BorderWidth);
624 if(this.ChildOverlap==null) {
625 this.DistanceToRightEdge = this.style.pixelWidth;
626 if (!this.menu.isHorizontal || (this.menu.isHorizontal && this.isLastItem)) this.DistanceToRightEdge += HM_BorderWidth;
627 this.DistanceToLeftEdge = (!this.menu.isHorizontal || (this.menu.isHorizontal && this.index==0)) ? HM_BorderWidth : HM_SeparatorSize;
628 this.ChildOverlap = (parseInt((HM_ChildPerCentOver != null) ? (HM_ChildPerCentOver * this.DistanceToRightEdge) : HM_ChildOverlap));
631 this.oL = this.menu.style.pixelLeft + this.offsetLeft + HM_BorderWidth;
632 this.oT = this.menu.style.pixelTop + this.offsetTop;
633 if(this.tree.RightToLeft) {
634 this.child.xPos = ((this.oL - this.DistanceToLeftEdge) + this.ChildOverlap) - this.child.style.pixelWidth;
637 this.child.xPos = (this.oL + this.DistanceToRightEdge) - this.ChildOverlap;
639 this.child.yPos = this.oT + HM_ChildOffset + HM_BorderWidth;
641 this.child.xDiff = this.child.xPos - this.menu.style.pixelLeft;
642 this.child.yDiff = this.child.yPos - this.menu.style.pixelTop;
643 if(!this.tree.PositionUnder || this.menu!=this.tree.treeParent) this.child.keepInWindow();
644 this.child.moveTo(this.child.xPos,this.child.yPos);
645 this.menu.hasChildVisible = true;
646 this.menu.visibleChild = this.child;
647 this.child.showIt(true);
650 function HM_f_ItemOver(){
652 if (this.menu.currentItem && this.menu.currentItem != this && this.menu.currentItem.hasRollover) {
653 with(this.menu.currentItem.style){
654 backgroundColor = this.tree.BGColor;
655 color = this.tree.FontColor
657 if(this.menu.currentItem.hasImageRollover)this.menu.currentItem.imgLyr.src = this.menu.currentItem.imageSrc;
660 if(event.srcElement.id == "HM_ImMore") return;
661 if(this.hasRollover) {
662 this.style.backgroundColor = this.tree.BGColorOver;
663 this.style.color = this.tree.FontColorOver;
664 if(this.hasImageRollover)this.imgLyr.src = this.imageSrcOver;
666 if(HM_StatusDisplayLink) status = this.linkText;
667 this.menu.currentItem = this;
668 if (this.menu.hasChildVisible) {
669 if(this.menu.visibleChild == this.child && this.menu.visibleChild.hasChildVisible) this.menu.visibleChild.hideChildren(this);
670 else this.menu.hideChildren(this);
672 if (this.hasMore && !this.ClickStart) this.showChild();
675 function HM_f_ItemOut() {
676 if (event.srcElement.contains(event.toElement)
677 || (event.fromElement.tagName=="IMG" && (event.toElement && event.toElement.contains(event.fromElement))))
679 if ( (!HM_KeepHilite || ((this.tree.TopIsPermanent && (this.tree.treeParent==this)) && !this.menu.hasChildVisible)) && this.hasRollover) {
681 backgroundColor = this.tree.BGColor;
682 color = this.tree.FontColor
684 if(this.hasImageRollover)this.imgLyr.src = this.imageSrc;
689 function HM_f_MoveTo(xPos,yPos) {
690 this.style.pixelLeft = xPos;
691 this.style.pixelTop = yPos;
694 function HM_f_ShowIt(on) {
695 if (!(this.tree.TopIsPermanent && (this.tree.treeParent==this))) {
696 if(!this.hasParent || (this.hasParent && this.tree.TopIsPermanent && (this.tree.treeParent==this.parentMenu))) {
697 var IsVisible = (this.style.visibility == "visible");
698 if ((on && !IsVisible) || (!on && IsVisible))
699 eval(on ? this.tree.UponDisplay : this.tree.UponHide)
701 if (on) this.style.zIndex = ++HM_ZIndex;
702 this.style.visibility = (on) ? "visible" : "hidden";
704 if (HM_KeepHilite && this.currentItem && this.currentItem.hasRollover) {
705 with(this.currentItem.style){
706 backgroundColor = this.tree.BGColor;
707 color = this.tree.FontColor;
709 if(this.currentItem.hasImageRollover)this.currentItem.imgLyr.src = this.currentItem.imageSrc;
711 this.currentItem = null;
714 function HM_f_KeepInWindow() {
716 var WindowLeftEdge = document.body.scrollLeft;
717 var WindowTopEdge = document.body.scrollTop;
718 var WindowWidth = document.body.clientWidth;
719 var WindowHeight = document.body.clientHeight;
720 var WindowRightEdge = (WindowLeftEdge + WindowWidth) - ExtraSpace;
721 var WindowBottomEdge = (WindowTopEdge + WindowHeight) - ExtraSpace;
723 var MenuLeftEdge = this.xPos;
724 var MenuRightEdge = MenuLeftEdge + this.style.pixelWidth;
725 var MenuBottomEdge = this.yPos + this.style.pixelHeight;
727 if (this.hasParent) {
728 var ParentLeftEdge = this.parentItem.oL;
730 if (MenuRightEdge > WindowRightEdge) {
731 if (this.hasParent) {
732 this.xPos = ((ParentLeftEdge - this.parentItem.DistanceToLeftEdge) + this.parentItem.ChildOverlap) - this.offsetWidth;
735 dif = MenuRightEdge - WindowRightEdge;
738 this.xPos = Math.max(5,this.xPos);
741 if (MenuBottomEdge > WindowBottomEdge) {
742 dif = MenuBottomEdge - WindowBottomEdge;
746 if (MenuLeftEdge < WindowLeftEdge) {
747 if (this.hasParent) {
748 this.xPos = (ParentLeftEdge + this.parentItem.DistanceToRightEdge) - this.parentItem.ChildOverlap;
749 MenuRightEdge = this.xPos + this.style.pixelWidth;
750 if(MenuRightEdge > WindowRightEdge) this.xPos -= (MenuRightEdge - WindowRightEdge);
756 function HM_f_LinkIt() {
757 if (this.linkText.indexOf("javascript:")!=-1) eval(this.linkText)
760 location.href = this.linkText;
764 function HM_f_PopDown(menuname){
765 if (!HM_AreLoaded || !HM_AreCreated) return;
766 menuname = menuname.replace("elMenu",HM_MenuIDPrefix);
767 var MenuToHide = document.all(menuname);
768 if(!MenuToHide)return;
769 MenuToHide.isOn = false;
770 if (!HM_ClickKill) MenuToHide.hideTop();
773 function HM_f_HideAll(callingmenu) {
774 for(var i=0; i<HM_TotalTrees; i++) {
775 var TopMenu = HM_a_TopMenus[i].tree.startChild;
776 if(TopMenu == callingmenu)continue
777 TopMenu.isOn = false;
778 if (TopMenu.hasChildVisible) TopMenu.hideChildren();
779 TopMenu.showIt(false);
783 function HM_f_HideTree() {
784 HM_HideAllTimer = null;
785 if (HM_UserOverMenu) return;
786 if (this.hasChildVisible) this.hideChildren();
790 function HM_f_HideTop() {
791 TopMenuToHide = this;
792 (HM_ClickKill) ? TopMenuToHide.hideSelf() : (this.hideTimer = setTimeout("TopMenuToHide.hideSelf()",HM_TopMilliSecondsVisible));
795 function HM_f_HideSelf() {
796 this.hideTimer = null;
797 if (!this.isOn && !HM_UserOverMenu) this.showIt(false);
800 function HM_f_HideParents() {
802 while(TempMenu.hasParent) {
803 TempMenu.showIt(false);
804 TempMenu.parentMenu.isOn = false;
805 TempMenu = TempMenu.parentMenu;
810 function HM_f_HideChildren(callingitem) {
811 var TempMenu = this.visibleChild;
812 while(TempMenu.hasChildVisible) {
813 TempMenu.visibleChild.showIt(false);
814 TempMenu.hasChildVisible = false;
815 TempMenu = TempMenu.visibleChild;
817 if((callingitem && (!callingitem.hasMore || this.visibleChild != callingitem.child)) || (!callingitem && !this.isOn)) {
818 this.visibleChild.showIt(false);
819 this.hasChildVisible = false;
823 function HM_f_CancelSelect(){return false}
825 function HM_f_PageClick() {
826 if (!HM_UserOverMenu && HM_CurrentMenu!=null && !HM_CurrentMenu.isOn) HM_f_HideAll();
830 popDown = HM_f_PopDown;
832 function HM_f_ResizeHandler(){
833 var mouse_x_position, mouse_y_position;
834 for(var i=0; i<HM_TotalTrees; i++) {
835 var TopMenu = HM_a_TopMenus[i].tree.startChild;
836 if(TopMenu.style.visibility == "visible") {
837 TopMenu.oldLeft = TopMenu.xPos;
838 TopMenu.oldTop = TopMenu.yPos;
839 mouse_x_position = TopMenu.mouseX;
840 mouse_y_position = TopMenu.mouseY;
841 TopMenu.xPos = eval(TopMenu.tree.MenuLeft);
842 TopMenu.yPos = eval(TopMenu.tree.MenuTop);
843 if(TopMenu.xPos == null) TopMenu.xPos = TopMenu.xIntended;
844 if(TopMenu.yPos == null) TopMenu.yPos = TopMenu.yIntended;
845 if(!TopMenu.tree.TopIsPermanent) TopMenu.keepInWindow();
846 TopMenu.moveTo(TopMenu.xPos,TopMenu.yPos);
847 var TempMenu = TopMenu;
848 while(TempMenu.hasChildVisible) {
849 TempParent = TempMenu;
850 TempMenu = TempMenu.visibleChild;
851 TempMenu.xPos = TempParent.xPos + TempMenu.xDiff;
852 TempMenu.yPos = TempParent.yPos + TempMenu.yDiff;
853 if(!TopMenu.tree.TopIsPermanent || (TopMenu.tree.TopIsPermanent && !TopMenu.tree.PositionUnder)) TempMenu.keepInWindow();
854 TempMenu.moveTo(TempMenu.xPos,TempMenu.yPos);
861 HM_f_OtherResize = (window.onresize) ? window.onresize : new Function;
862 window.onresize = HM_f_ResizeHandler;
864 HM_f_OtherOnLoad = (window.onload) ? window.onload : new Function;
865 window.onload = function(){setTimeout("HM_f_StartIt()",10)};