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.
9 HM_IE5M = HM_IE && HM_Mac;
10 HM_IE5W = HM_IE && !HM_Mac;
11 HM_NS6 = (navigator.vendor == ("Netscape6") || navigator.product == ("Gecko"));
12 HM_IEpos = HM_IE || (HM_NS6 && parseInt(navigator.productSub)>=20010710);
13 HM_IEDTD = (HM_IE && document.doctype) ? document.doctype.name.indexOf(".dtd")!=-1 : false;
14 HM_IEnoDTD = HM_IE && !HM_IEDTD;
17 ["MenuWidth", 150, "number"],
18 ["FontFamily", "Arial,sans-serif"],
19 ["FontSize", 10, "number"],
20 ["FontBold", false, "boolean"],
21 ["FontItalic", false, "boolean"],
22 ["FontColor", "black"],
23 ["FontColorOver", "white"],
25 ["BGColorOver", "black"],
26 ["ItemPadding", 3, "number"],
27 ["BorderWidth", 2, "number"],
28 ["BorderColor", "red"],
29 ["BorderStyle", "solid"],
30 ["SeparatorSize", 1, "number"],
31 ["SeparatorColor", "yellow"],
32 ["ImageSrc", "HM_More_black_right.gif"],
33 ["ImageSrcOver", null],
34 ["ImageSrcLeft", "HM_More_black_left.gif"],
35 ["ImageSrcLeftOver", null],
36 ["ImageSize", 5, "number"],
37 ["ImageHorizSpace", 0, "number"],
38 ["ImageVertSpace", 0, "number"],
39 ["KeepHilite", false, "boolean"],
40 ["ClickStart", false, "boolean"],
41 ["ClickKill", true, "boolean"],
42 ["ChildOverlap", 20, "number"],
43 ["ChildOffset", 10, "number"],
44 ["ChildPerCentOver", null, "number"],
45 ["TopSecondsVisible", .5, "number"],
46 ["ChildSecondsVisible",.3, "number"],
47 ["StatusDisplayBuild", 1, "boolean"],
48 ["StatusDisplayLink", 1, "boolean"],
49 ["UponDisplay", null, "delayed"],
50 ["UponHide", null, "delayed"],
51 ["RightToLeft", false, "boolean"],
52 ["CreateTopOnly", 0, "boolean"],
53 ["ShowLinkCursor", false, "boolean"]
56 HM_MenuIDPrefix = "HM_Menu";
57 HM_ItemIDPrefix = "HM_Item";
58 HM_ArrayIDPrefix = "HM_Array";
60 Function.prototype.isFunction = true;
61 Function.prototype.isString = false;
62 String.prototype.isFunction = false;
63 String.prototype.isString = true;
64 String.prototype.isBoolean = false;
65 String.prototype.isNumber = false;
66 Number.prototype.isString = false;
67 Number.prototype.isFunction = false;
68 Number.prototype.isBoolean = false;
69 Number.prototype.isNumber = true;
70 Boolean.prototype.isString = false;
71 Boolean.prototype.isFunction = false;
72 Boolean.prototype.isBoolean = true;
73 Boolean.prototype.isNumber = false;
74 Array.prototype.itemValidation = false;
75 Array.prototype.isArray = true;
78 HM_a_ElementsCreated = [];
80 function HM_f_StoreElement(el){
81 HM_a_ElementsCreated[HM_a_ElementsCreated.length] = el;
85 function HM_f_AssignParameters(paramarray){
86 var ParamName = paramarray[0];
87 var DefaultValue = paramarray[1];
88 var FullParamName = "HM_" + ParamName;
90 if (typeof eval("window.HM_PG_" + ParamName) == "undefined") {
91 if (typeof eval("window.HM_GL_" + ParamName) == "undefined") {
92 eval(FullParamName + "= DefaultValue");
95 eval(FullParamName + "= HM_GL_" + ParamName);
99 eval(FullParamName + "= HM_PG_" + ParamName);
102 paramarray[0] = FullParamName;
103 paramarray[1] = eval(FullParamName);
106 function HM_f_EvalParameters(valuenew,valueold,valuetype){
107 var TestString, ParPosition;
109 if(typeof valuenew == "undefined" || valuenew == null || (valuenew.isString && valuenew.length == 0)){
113 if(valuetype != "delayed"){
114 while(valuenew.isString) {
115 ParPosition = valuenew.indexOf("(");
116 if(ParPosition !=-1) {
117 TestString = "window." + valuenew.substr(0,ParPosition);
118 if (typeof eval(TestString) != "undefined" && eval(TestString).isFunction) {
119 valuenew = eval(valuenew);
126 while(valuenew.isFunction) {valuenew = valuenew()}
130 while (valuenew.isString) {valuenew = eval(valuenew)}
133 while (!valuenew.isBoolean) {
134 valuenew = (valuenew.isNumber) ? valuenew ? true : false : eval(valuenew);
142 for (i=0;i<HM_a_Parameters.length;i++) {
143 HM_f_AssignParameters(HM_a_Parameters[i]);
144 eval(HM_a_Parameters[i][0] + "= HM_f_EvalParameters("+ HM_a_Parameters[i][0] +",null,HM_a_Parameters[i][2])")
147 HM_ChildPerCentOver = (isNaN(parseFloat(HM_ChildPerCentOver))) ? null : parseFloat(HM_ChildPerCentOver)/100;
149 HM_ChildMilliSecondsVisible = HM_ChildSecondsVisible * 1000;
151 function HM_f_ValidateArray(arrayname){
152 var MenuArrayIsValid = false;
153 var MenuArrayIsObject = (typeof eval("window." + arrayname) == "object");
154 if(MenuArrayIsObject) {
155 var TheMenuArray = eval(arrayname);
156 if(TheMenuArray.isArray && TheMenuArray.length > 1) {
157 MenuArrayIsValid = true;
158 if(!TheMenuArray.itemValidation) {
159 while((typeof TheMenuArray[TheMenuArray.length-1] != "object") || (!TheMenuArray[TheMenuArray.length-1].isArray)) {
160 TheMenuArray.length--;
162 TheMenuArray.itemValidation = true;
166 return MenuArrayIsValid;
169 if(!window.HM_a_TreesToBuild) {
170 HM_a_TreesToBuild = [];
171 for(i=1; i<100; i++){
172 if(HM_f_ValidateArray(HM_ArrayIDPrefix + i)) HM_a_TreesToBuild[HM_a_TreesToBuild.length] = i;
176 HM_CurrentArray = null;
177 HM_CurrentTree = null;
178 HM_CurrentMenu = null;
179 HM_CurrentItem = null;
181 HM_AreLoaded = false;
182 HM_AreCreated = false;
183 HM_BeingCreated = false;
184 HM_UserOverMenu = false;
185 HM_HideAllTimer = null;
189 function HM_f_StartIt() {
190 if(HM_AreCreated) return;
191 if((typeof(document.body) == "undefined") || (document.body == null)) return;
194 HM_f_OtherMouseDown = (document.onmousedown) ? document.onmousedown : new Function;
195 document.onmousedown = function(){HM_f_PageClick();HM_f_OtherMouseDown()}
198 HM_TopMilliSecondsVisible = HM_TopSecondsVisible * 1000;
204 function HM_f_MakeTrees(){
205 HM_BeingCreated = true;
206 var TreeParams = null;
207 var TreeHasChildren = false;
208 var ItemArray = null;
210 for(var t=0; t<HM_a_TreesToBuild.length; t++) {
211 if(!HM_f_ValidateArray(HM_ArrayIDPrefix + HM_a_TreesToBuild[t])) continue;
212 HM_CurrentArray = eval(HM_ArrayIDPrefix + HM_a_TreesToBuild[t]);
214 TreeParams = HM_CurrentArray[0];
215 TreeHasChildren = false;
217 for(var i=1; i<HM_CurrentArray.length; i++) {
218 ItemArray = HM_CurrentArray[i];
219 if(ItemArray[ItemArray.length-1]) {TreeHasChildren = true; break}
222 MenuWidth : MenuWidth = HM_f_EvalParameters(TreeParams[0],HM_MenuWidth,"number"),
223 MenuLeft : MenuLeft = HM_f_EvalParameters(TreeParams[1],null,"delayed"),
224 MenuTop : MenuTop = HM_f_EvalParameters(TreeParams[2],null,"delayed"),
225 ItemWidth : MenuWidth - (HM_BorderWidth*2),
226 FontColor : HM_f_EvalParameters(TreeParams[3],HM_FontColor),
227 FontColorOver : HM_f_EvalParameters(TreeParams[4],HM_FontColorOver),
228 BGColor : HM_f_EvalParameters(TreeParams[5],HM_BGColor),
229 BGColorOver : HM_f_EvalParameters(TreeParams[6],HM_BGColorOver),
230 BorderColor : HM_f_EvalParameters(TreeParams[7],HM_BorderColor),
231 SeparatorColor : HM_f_EvalParameters(TreeParams[8],HM_SeparatorColor),
232 TopIsPermanent : ((MenuLeft == null) || (MenuTop == null)) ? false : HM_f_EvalParameters(TreeParams[9],false,"boolean"),
233 TopIsHorizontal : TopIsHorizontal = HM_f_EvalParameters(TreeParams[10],false,"boolean"),
234 TreeIsHorizontal : TreeHasChildren ? HM_f_EvalParameters(TreeParams[11],false,"boolean") : false,
235 PositionUnder : (!TopIsHorizontal || !TreeHasChildren) ? false : HM_f_EvalParameters(TreeParams[12],false,"boolean"),
236 TopImageShow : TreeHasChildren ? HM_f_EvalParameters(TreeParams[13],true,"boolean") : false,
237 TreeImageShow : TreeHasChildren ? HM_f_EvalParameters(TreeParams[14],true,"boolean") : false,
238 UponDisplay : HM_f_EvalParameters(TreeParams[15],HM_UponDisplay,"delayed"),
239 UponHide : HM_f_EvalParameters(TreeParams[16],HM_UponHide,"delayed"),
240 RightToLeft : HM_f_EvalParameters(TreeParams[17],HM_RightToLeft,"boolean"),
241 ClickStart : HM_f_EvalParameters(TreeParams[18],HM_ClickStart,"boolean"),
242 TopIsVariableWidth : HM_f_EvalParameters(TreeParams[19],false,"boolean"),
243 TreeIsVariableWidth : HM_f_EvalParameters(TreeParams[20],false,"boolean")
246 HM_CurrentMenu = null;
247 HM_f_MakeMenu(HM_a_TreesToBuild[t]);
248 HM_a_TopMenus[HM_TotalTrees] = HM_CurrentTree.treeParent;
250 if(HM_CurrentTree.TopIsPermanent){
251 with(HM_CurrentTree.treeParent) {
252 HM_CurrentTree.treeParent.xPos = eval(HM_CurrentTree.MenuLeft);
253 HM_CurrentTree.treeParent.yPos = eval(HM_CurrentTree.MenuTop);
254 moveTo(HM_CurrentTree.treeParent.xPos,HM_CurrentTree.treeParent.yPos);
255 style.zIndex = HM_ZIndex;
257 if(HM_IE5M) setTimeout(HM_CurrentTree.treeParent.id + ".fixSize(true)",10);
258 else HM_CurrentTree.treeParent.style.visibility = "visible";
262 if(HM_StatusDisplayBuild) status = HM_TotalTrees + " Hierarchical Menu Trees Created";
263 HM_AreCreated = true;
264 HM_BeingCreated = false;
267 function HM_f_SetItemProperties(itemidsuffix) {
268 this.tree = HM_CurrentTree;
269 this.index = HM_CurrentMenu.itemCount - 1;
270 this.isLastItem = (HM_CurrentMenu.itemCount == HM_CurrentMenu.maxItems);
271 this.array = HM_CurrentMenu.array[HM_CurrentMenu.itemCount];
272 this.dispText = this.array[0];
273 this.linkText = this.array[1];
274 this.permHilite = HM_f_EvalParameters(this.array[3],false,"boolean");
275 this.hasRollover = (!this.permHilite && HM_f_EvalParameters(this.array[2],true,"boolean"));
276 this.hasMore = HM_f_EvalParameters(this.array[4],false,"boolean") && HM_f_ValidateArray(HM_ArrayIDPrefix + itemidsuffix);
277 this.childID = this.hasMore ? (HM_MenuIDPrefix + itemidsuffix) : null;
279 this.onmouseover = HM_f_ItemOver;
280 this.onmouseout = HM_f_ItemOut;
281 this.setItemStyle = HM_f_SetItemStyle;
282 this.showChild = HM_f_ShowChild;
283 this.ClickStart = this.hasMore && this.tree.ClickStart && (this.tree.TopIsPermanent && (this.tree.treeParent==this.menu));
284 if(this.ClickStart) {
286 this.onclick = this.showChild;
288 this.ChildOverlap = null;
291 function HM_f_MakeElement(menuid) {
293 MenuObject = document.createElement("DIV");
295 if(HM_IE)HM_f_StoreElement(MenuObject);
300 position = "absolute";
301 visibility = "hidden";
304 width = (HM_IEnoDTD ? HM_CurrentTree.MenuWidth : HM_CurrentTree.ItemWidth) + "px";
307 document.body.appendChild(MenuObject);
311 function HM_f_MakeMenu(menucount) {
312 if(!HM_f_ValidateArray(HM_ArrayIDPrefix + menucount)) return false;
313 HM_CurrentArray = eval(HM_ArrayIDPrefix + menucount);
315 NewMenu = document.getElementById(HM_MenuIDPrefix + menucount);
317 NewMenu = HM_f_MakeElement(HM_MenuIDPrefix + menucount);
319 NewMenu.parentMenu = HM_CurrentMenu;
320 NewMenu.parentItem = HM_CurrentMenu.itemElement;
321 NewMenu.parentItem.child = NewMenu;
322 NewMenu.hasParent = true;
323 NewMenu.isHorizontal = HM_CurrentTree.TreeIsHorizontal;
324 NewMenu.showImage = HM_CurrentTree.TreeImageShow;
327 NewMenu.isHorizontal = HM_CurrentTree.TopIsHorizontal;
328 NewMenu.showImage = HM_CurrentTree.TopImageShow;
329 HM_CurrentTree.treeParent = HM_CurrentTree.startChild = NewMenu;
332 HM_CurrentMenu = NewMenu;
333 HM_CurrentMenu.array = HM_CurrentArray;
334 HM_CurrentMenu.tree = HM_CurrentTree;
335 HM_CurrentMenu.itemCount = 0;
336 HM_CurrentMenu.maxItems = HM_CurrentMenu.array.length - 1;
337 HM_CurrentMenu.IsVariableWidth = ((HM_CurrentMenu.hasParent && HM_CurrentTree.TreeIsVariableWidth) || (!HM_CurrentMenu.hasParent && HM_CurrentTree.TopIsVariableWidth));
338 HM_CurrentMenu.showIt = HM_f_ShowIt;
339 HM_CurrentMenu.count = menucount;
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.hasChildVisible = false;
349 HM_CurrentMenu.isOn = false;
350 HM_CurrentMenu.hideTimer = null;
351 HM_CurrentMenu.currentItem = null;
352 HM_CurrentMenu.setMenuStyle = HM_f_SetMenuStyle;
353 HM_CurrentMenu.sizeFixed = false;
354 HM_CurrentMenu.fixSize = HM_f_FixSize;
356 if(HM_IE) HM_CurrentMenu.onselectstart = HM_f_CancelSelect;
357 HM_CurrentMenu.moveTo = HM_f_MoveTo;
358 HM_CurrentMenu.setMenuStyle();
361 while (HM_CurrentMenu.itemCount < HM_CurrentMenu.maxItems) {
362 HM_CurrentMenu.itemCount++;
363 HM_CurrentMenu.itemElement = document.getElementById(HM_ItemIDPrefix + menucount + "_" + HM_CurrentMenu.itemCount);
364 if(!HM_CurrentMenu.itemElement){
365 if(HM_StatusDisplayBuild) status = "Creating Hierarchical Menus: " + menucount + " / " + HM_CurrentMenu.itemCount;
366 HM_CurrentMenu.itemElement = HM_f_MakeItemElement(menucount);
368 if(HM_CurrentMenu.itemElement.hasMore && (!HM_CreateTopOnly || HM_AreCreated && HM_CreateTopOnly)) {
369 MenuCreated = HM_f_MakeMenu(menucount + "_" + HM_CurrentMenu.itemCount);
371 HM_CurrentMenu = HM_CurrentMenu.parentMenu;
375 if(!HM_IE5M)HM_CurrentMenu.fixSize();
376 return HM_CurrentMenu;
379 function HM_f_SetMenuStyle(){
381 borderWidth = HM_BorderWidth + "px";
382 borderColor = HM_CurrentTree.BorderColor;
383 borderStyle = HM_BorderStyle;
389 function HM_f_MakeItemElement(menucount) {
390 var ItemElement = document.createElement("DIV");
392 if(HM_IE)HM_f_StoreElement(ItemElement);
394 ItemElement.id = HM_ItemIDPrefix + menucount + "_" + HM_CurrentMenu.itemCount;
395 ItemElement.style.position = "absolute";
396 ItemElement.style.visibility = "inherit";
397 HM_CurrentMenu.appendChild(ItemElement);
398 ItemElement.menu = HM_CurrentMenu;
399 ItemElement.setItemProperties = HM_f_SetItemProperties;
400 ItemElement.setItemProperties(menucount + "_" + HM_CurrentMenu.itemCount);
401 ItemElement.siblingBelow = ItemElement.previousSibling;
402 if(ItemElement.linkText && !ItemElement.ClickStart) {
403 ItemElement.onclick = HM_f_LinkIt;
404 if(HM_ShowLinkCursor)ItemElement.style.cursor = HM_NS6 ? "pointer" : "hand";
406 var FullPadding = (HM_ItemPadding*2) + HM_ImageSize + HM_ImageHorizSpace;
408 ItemElement.hasImage = (ItemElement.hasMore && HM_CurrentMenu.showImage);
409 if(ItemElement.hasImage) {
410 var ImageElement = document.createElement("IMG");
412 if(HM_IE)HM_f_StoreElement(ImageElement);
414 ItemElement.imageSrc = HM_CurrentTree.RightToLeft ? HM_ImageSrcLeft : HM_ImageSrc;
415 ItemElement.hasImageRollover = ((!HM_CurrentTree.RightToLeft && HM_ImageSrcOver) || (HM_CurrentTree.RightToLeft && HM_ImageSrcLeftOver));
416 if(ItemElement.hasImageRollover) {
417 ItemElement.imageSrcOver = HM_CurrentTree.RightToLeft ? HM_ImageSrcLeftOver : HM_ImageSrcOver;
418 if(ItemElement.permHilite) ItemElement.imageSrc = ItemElement.imageSrcOver;
422 src = ItemElement.imageSrc;
423 removeAttribute("height");
424 hspace = (!HM_CurrentTree.RightToLeft && HM_IE5W) ? HM_ItemPadding : 0;
426 width = HM_ImageSize;
428 position = "absolute";
429 top = (HM_ItemPadding + HM_ImageVertSpace) + "px";
431 if(HM_CurrentTree.RightToLeft) {
432 left = (HM_ItemPadding + HM_ImageHorizSpace) + "px";
436 ItemElement.imgLyr = ImageElement;
438 ItemElement.innerHTML = ItemElement.dispText;
439 if(ImageElement) ItemElement.insertBefore(ImageElement,ItemElement.firstChild);
440 ItemElement.setItemStyle();
444 function HM_f_SetItemStyle() {
446 backgroundColor = (this.permHilite) ? HM_CurrentTree.BGColorOver : HM_CurrentTree.BGColor;
447 color = (this.permHilite) ? HM_CurrentTree.FontColorOver : HM_CurrentTree.FontColor;
448 padding = HM_ItemPadding +"px";
449 font = ((HM_FontBold) ? "bold " : "normal ") + HM_FontSize + "pt " + HM_FontFamily;
450 fontStyle = (HM_FontItalic) ? "italic" : "normal";
451 if(HM_IE) overflow = "hidden";
453 if((this.menu.showImage && (!this.menu.IsVariableWidth || (this.menu.IsVariableWidth && this.tree.RightToLeft && !this.menu.isHorizontal))) || (this.menu.IsVariableWidth && this.imgLyr)) {
455 var FullPadding = (HM_ItemPadding*2) + HM_ImageSize + HM_ImageHorizSpace;
456 if (HM_CurrentTree.RightToLeft) paddingLeft = FullPadding + "px";
457 else paddingRight = FullPadding + "px";
459 if(!this.isLastItem) {
460 var SeparatorString = HM_SeparatorSize + "px solid " + this.tree.SeparatorColor;
461 if (this.menu.isHorizontal) borderRight = SeparatorString;
462 else borderBottom = SeparatorString;
465 if(this.menu.isHorizontal){
467 if(!this.menu.IsVariableWidth) {
469 if(this.isLastItem) width = (HM_CurrentTree.MenuWidth - HM_BorderWidth - HM_SeparatorSize) + "px";
470 else width = (HM_CurrentTree.MenuWidth - HM_BorderWidth) + "px";
471 left = (this.index * (HM_CurrentTree.MenuWidth - HM_BorderWidth)) + "px";
474 width = (HM_CurrentTree.MenuWidth - HM_BorderWidth - parseInt(paddingLeft) - parseInt(paddingRight) - HM_SeparatorSize) + "px";
475 left = ((this.index * parseInt(width)) + ((HM_SeparatorSize * this.index))) + ((parseInt(paddingLeft) + parseInt(paddingRight)) * this.index) + "px";
477 var LeftAndWidth = parseInt(left) + parseInt(width);
478 this.menu.style.width = LeftAndWidth + (HM_IEnoDTD ? (HM_BorderWidth * 2) : (parseInt(paddingLeft) + parseInt(paddingRight))) + "px"
483 if(!this.menu.IsVariableWidth) {
484 if(HM_IEnoDTD) width = HM_CurrentTree.ItemWidth + "px";
485 else width = (HM_CurrentTree.ItemWidth - (parseInt(paddingLeft) + parseInt(paddingRight))) + "px";
492 function HM_f_FixSize(makevis){
493 if(this.isHorizontal) {
494 if(this.IsVariableWidth) {
495 for(i=0; i<this.childNodes.length; i++) {
496 var TempItem = this.childNodes[i];
497 TempItem.realWidth = HM_IE ? TempItem.scrollWidth : TempItem.offsetWidth;
498 if(HM_IE5M) TempItem.realWidth += (parseInt(TempItem.style.paddingLeft) + parseInt(TempItem.style.paddingRight))
500 if(TempItem.isLastItem) TempItem.style.width = (TempItem.realWidth) + "px";
501 else TempItem.style.width = (TempItem.realWidth + HM_SeparatorSize) + "px";
502 TempItem.style.left = (TempItem.index ? parseInt(TempItem.siblingBelow.style.left) + parseInt(TempItem.siblingBelow.style.width) : 0) + "px";
505 if(TempItem.hasImage && !HM_CurrentTree.RightToLeft) {
506 TempItem.realWidth += HM_ItemPadding;
508 TempItem.realWidth -= (parseInt(TempItem.style.paddingLeft) + parseInt(TempItem.style.paddingRight))
509 if(!HM_IE5M && !TempItem.isLastItem) TempItem.realWidth -= HM_SeparatorSize;
510 TempItem.allowableWidth = TempItem.tree.ItemWidth - (parseInt(TempItem.style.paddingLeft) + parseInt(TempItem.style.paddingRight));
511 TempItem.style.width = Math.min(TempItem.allowableWidth,TempItem.realWidth) + "px";
512 TempItem.style.left = (TempItem.index ? (parseInt(TempItem.siblingBelow.style.left) + TempItem.siblingBelow.offsetWidth) : 0) + "px";
514 if(TempItem.isLastItem) {
515 LeftAndWidth = parseInt(TempItem.style.left) + parseInt(TempItem.style.width);
516 this.style.width = LeftAndWidth + (HM_IEnoDTD ? (HM_BorderWidth * 2) : (parseInt(TempItem.style.paddingLeft) + parseInt(TempItem.style.paddingRight))) + "px";
521 var MaxItemHeight = 0;
522 for(i=0; i<this.childNodes.length; i++) {
523 var TempItem = this.childNodes[i];
525 var SiblingHeight = TempItem.siblingBelow.offsetHeight - (HM_IEnoDTD ? 0 : (HM_ItemPadding * 2));
526 MaxItemHeight = Math.max(MaxItemHeight,SiblingHeight);
529 MaxItemHeight = TempItem.offsetHeight - (HM_IEnoDTD ? 0 : (HM_ItemPadding * 2));
532 for(i=0; i<this.childNodes.length; i++) {
533 var TempItem = this.childNodes[i];
534 TempItem.style.height = MaxItemHeight +"px";
535 if(TempItem.imgLyr) {
536 if(this.tree.RightToLeft){
537 TempItem.imgLyr.style.left = (HM_ItemPadding + HM_ImageHorizSpace) + "px";
540 TempItem.imgLyr.style.left = (TempItem.offsetWidth - ((TempItem.isLastItem ? 0 : HM_SeparatorSize) + (HM_IEnoDTD ? HM_IE5M ? HM_ItemPadding : HM_ItemPadding * 2 : HM_ItemPadding) + HM_ImageHorizSpace + HM_ImageSize)) + "px";
545 this.style.height = MaxItemHeight + (HM_IEnoDTD ? HM_BorderWidth * 2 : (HM_ItemPadding * 2)) + "px";
548 if(this.IsVariableWidth) {
549 var MaxItemWidth = 0;
550 for(i=0; i<this.childNodes.length; i++) {
551 var TempItem = this.childNodes[i];
552 TempItem.realWidth = HM_IE ? TempItem.scrollWidth : TempItem.offsetWidth;
553 if(HM_IE5M) TempItem.realWidth += (parseInt(TempItem.style.paddingLeft) + parseInt(TempItem.style.paddingRight))
555 TempItem.realWidth -= ((parseInt(TempItem.style.paddingRight) + parseInt(TempItem.style.paddingLeft)))
557 MaxItemWidth = i ? Math.max(MaxItemWidth,TempItem.realWidth) : TempItem.realWidth;
558 if(MaxItemWidth==TempItem.realWidth) TempWidest = TempItem;
561 for(i=0; i<this.childNodes.length; i++) {
562 this.childNodes[i].style.width = (TempWidest.realWidth + (HM_IEnoDTD ? 0 : (0))) + "px";
564 this.childNodes[i].style.paddingLeft = TempWidest.style.paddingLeft;
565 this.childNodes[i].style.paddingRight = TempWidest.style.paddingRight;
568 this.style.width = (this.childNodes[0].offsetWidth + (HM_IEnoDTD ? HM_BorderWidth * 2 : 0)) + "px";
571 for(i=0; i<this.childNodes.length; i++) {
572 var TempItem = this.childNodes[i];
573 if (TempItem.index) {
574 var SiblingHeight =(TempItem.siblingBelow.offsetHeight);
575 TempItem.style.top = parseInt(TempItem.siblingBelow.style.top) + SiblingHeight + "px";
577 else TempItem.style.top = "0px";
579 if(TempItem.imgLyr) {
580 if(this.tree.RightToLeft){
581 TempItem.imgLyr.style.left = (HM_ItemPadding + HM_ImageHorizSpace) + "px";
584 TempItem.imgLyr.style.left = (TempItem.offsetWidth - ((HM_IEnoDTD ? HM_IE5M ? HM_ItemPadding : HM_ItemPadding*2 : HM_ItemPadding) + HM_ImageHorizSpace + HM_ImageSize)) + "px";
588 this.style.height = parseInt(TempItem.style.top) + (HM_IE5W ? TempItem.scrollHeight : TempItem.offsetHeight) + (HM_IEnoDTD ? (HM_BorderWidth * 2) : 0) + "px";
591 this.sizeFixed = true;
592 if(makevis)this.style.visibility = "visible";
595 function HM_f_PopUp(menuname,e){
597 if (!HM_AreLoaded) return;
598 menuname = menuname.replace("elMenu",HM_MenuIDPrefix);
599 var TempMenu = document.getElementById(menuname);
601 HM_CurrentMenu = TempMenu;
602 if (HM_CurrentMenu.tree.ClickStart) {
603 var ClickElement = (HM_IE) ? e.srcElement : e.target;
605 while(ClickElement.tagName==null){
606 ClickElement = ClickElement.parentNode;
609 ClickElement.onclick = HM_f_PopMenu;
611 else HM_f_PopMenu(e);
614 function HM_f_PopMenu(e){
616 if (!HM_AreLoaded || !HM_AreCreated) return true;
617 if (HM_CurrentMenu.tree.ClickStart && e.type != "click") return true;
618 var mouse_x_position, mouse_y_position;
620 HM_CurrentMenu.hasParent = false;
621 HM_CurrentMenu.tree.startChild = HM_CurrentMenu;
622 HM_CurrentMenu.mouseX = mouse_x_position = (HM_IE) ? (e.clientX + document.body.scrollLeft) : e.pageX;
623 HM_CurrentMenu.mouseY = mouse_y_position = (HM_IE) ? (e.clientY + document.body.scrollTop) : e.pageY;
624 HM_CurrentMenu.xIntended = HM_CurrentMenu.xPos = (HM_CurrentMenu.tree.MenuLeft!=null) ? eval(HM_CurrentMenu.tree.MenuLeft) : mouse_x_position;
625 HM_CurrentMenu.yIntended = HM_CurrentMenu.yPos = (HM_CurrentMenu.tree.MenuTop!=null) ? eval(HM_CurrentMenu.tree.MenuTop) : mouse_y_position;
626 if(HM_IE5M && !HM_CurrentMenu.sizeFixed) HM_CurrentMenu.fixSize(false);
627 HM_CurrentMenu.keepInWindow();
628 HM_CurrentMenu.moveTo(HM_CurrentMenu.xPos,HM_CurrentMenu.yPos);
629 HM_CurrentMenu.isOn = true;
630 HM_CurrentMenu.showIt(true);
634 function HM_f_MenuOver() {
635 if(!this.tree.startChild){this.tree.startChild = this}
636 if(this.tree.startChild == this) HM_f_HideAll(this)
638 HM_UserOverMenu = true;
639 HM_CurrentMenu = this;
640 if (this.hideTimer) clearTimeout(this.hideTimer);
643 function HM_f_MenuOut() {
644 if(HM_IE && event.srcElement.contains(event.toElement)) return;
646 HM_UserOverMenu = false;
647 if(HM_StatusDisplayLink) status = "";
649 clearTimeout(HM_HideAllTimer);
650 HM_HideAllTimer = null;
651 HM_HideAllTimer = setTimeout("HM_CurrentMenu.hideTree()",HM_ChildMilliSecondsVisible);
655 function HM_f_ShowChild(){
657 HM_CurrentTree = this.tree;
658 HM_CurrentMenu = this.menu;
659 HM_CurrentItem = this;
660 HM_CurrentMenu.itemElement = this;
661 this.child = HM_f_MakeMenu(this.menu.count + "_"+(this.index+1));
662 this.tree.treeParent = this.menu;
663 this.tree.startChild = this.menu;
665 if(HM_IE5M && !this.child.sizeFixed) this.child.fixSize(false);
667 if (this.tree.PositionUnder && (this.menu == this.tree.treeParent)) {
668 this.child.xPos = parseInt(this.menu.style.left) + parseInt(this.style.left);
669 this.child.yPos = parseInt(this.menu.style.top) + this.menu.offsetHeight - (HM_BorderWidth);
672 if(this.ChildOverlap==null) {
673 this.DistanceToRightEdge = parseInt(this.style.width);
674 if(!HM_IEnoDTD) this.DistanceToRightEdge += (parseInt(this.style.paddingLeft)+parseInt(this.style.paddingRight)) + ((this.menu.isHorizontal && !this.isLastItem) ? HM_SeparatorSize : 0);
675 if (!this.menu.isHorizontal || (this.menu.isHorizontal && this.isLastItem)) this.DistanceToRightEdge += HM_BorderWidth;
676 this.DistanceToLeftEdge = (!this.menu.isHorizontal || (this.menu.isHorizontal && this.index==0)) ? HM_BorderWidth : HM_SeparatorSize;
677 this.ChildOverlap = (parseInt((HM_ChildPerCentOver != null) ? (HM_ChildPerCentOver * this.DistanceToRightEdge) : HM_ChildOverlap));
681 this.oL = parseInt(this.menu.style.left) - HM_ItemPadding;
682 this.oL += this.offsetLeft;
683 this.oT = parseInt(this.menu.style.top) - HM_ItemPadding;
684 this.oT += this.offsetTop;
687 this.oL = (HM_IEpos) ? parseInt(this.menu.style.left) + HM_BorderWidth : 0;
688 this.oL += this.offsetLeft;
689 this.oT = (HM_IEpos) ? parseInt(this.menu.style.top) : -HM_BorderWidth;
690 this.oT += this.offsetTop;
693 if(this.tree.RightToLeft) {
694 this.child.xPos = ((this.oL - this.DistanceToLeftEdge) + this.ChildOverlap) - this.child.offsetWidth;
697 this.child.xPos = (this.oL + this.DistanceToRightEdge) - this.ChildOverlap;
699 this.child.yPos = this.oT + HM_ChildOffset + HM_BorderWidth;
702 this.child.xDiff = this.child.xPos - parseInt(this.menu.style.left);
703 this.child.yDiff = this.child.yPos - parseInt(this.menu.style.top);
705 if(!this.tree.PositionUnder || this.menu!=this.tree.treeParent) this.child.keepInWindow();
706 this.child.moveTo(this.child.xPos,this.child.yPos);
707 this.menu.hasChildVisible = true;
708 this.menu.visibleChild = this.child;
709 this.child.showIt(true);
712 function HM_f_ItemOver(){
714 if (this.menu.currentItem && this.menu.currentItem != this && this.menu.currentItem.hasRollover) {
715 with(this.menu.currentItem.style){
716 backgroundColor = this.tree.BGColor;
717 color = this.tree.FontColor
719 if(this.menu.currentItem.hasImageRollover)this.menu.currentItem.imgLyr.src = this.menu.currentItem.imageSrc;
722 if(HM_IE && event.srcElement.id == "HM_ImMore") return;
723 if(this.hasRollover) {
724 this.style.backgroundColor = this.tree.BGColorOver;
725 this.style.color = this.tree.FontColorOver;
726 if(this.hasImageRollover)this.imgLyr.src = this.imageSrcOver;
729 if(HM_StatusDisplayLink) status = this.linkText;
730 this.menu.currentItem = this;
732 if (this.menu.hasChildVisible) {
733 if(this.menu.visibleChild == this.child && this.menu.visibleChild.hasChildVisible) this.menu.visibleChild.hideChildren(this);
734 else this.menu.hideChildren(this);
737 if (this.hasMore && !this.ClickStart) this.showChild();
740 function HM_f_ItemOut() {
741 if (HM_IE && (event.srcElement.contains(event.toElement)
742 || (event.fromElement.tagName=="IMG" && (event.toElement && event.toElement.contains(event.fromElement)))))
744 if ( (!HM_KeepHilite || ((this.tree.TopIsPermanent && (this.tree.treeParent==this)) && !this.menu.hasChildVisible)) && this.hasRollover) {
746 backgroundColor = this.tree.BGColor;
747 color = this.tree.FontColor
749 if(this.hasImageRollover)this.imgLyr.src = this.imageSrc;
753 function HM_f_MoveTo(xPos,yPos) {
754 this.style.left = xPos + "px";
755 this.style.top = yPos + "px";
758 function HM_f_ShowIt(on) {
759 if (!(this.tree.TopIsPermanent && (this.tree.treeParent==this))) {
760 if(!this.hasParent || (this.hasParent && this.tree.TopIsPermanent && (this.tree.treeParent==this.parentMenu))) {
761 var IsVisible = (this.style.visibility == "visible");
762 if ((on && !IsVisible) || (!on && IsVisible))
763 eval(on ? this.tree.UponDisplay : this.tree.UponHide)
765 if (on) this.style.zIndex = ++HM_ZIndex;
766 this.style.visibility = (on) ? "visible" : "hidden";
768 if (HM_KeepHilite && this.currentItem && this.currentItem.hasRollover) {
769 with(this.currentItem.style){
770 backgroundColor = this.tree.BGColor;
771 color = this.tree.FontColor;
773 if(this.currentItem.hasImageRollover)this.currentItem.imgLyr.src = this.currentItem.imageSrc;
775 this.currentItem = null;
778 function HM_f_KeepInWindow() {
780 var WindowLeftEdge = (HM_IE) ? document.body.scrollLeft : window.pageXOffset;
781 var WindowTopEdge = (HM_IE) ? document.body.scrollTop : window.pageYOffset;
782 var WindowWidth = (HM_IE) ? document.body.clientWidth : window.innerWidth;
783 var WindowHeight = (HM_IE) ? document.body.clientHeight : window.innerHeight;
784 var WindowRightEdge = (WindowLeftEdge + WindowWidth) - ExtraSpace;
785 var WindowBottomEdge = (WindowTopEdge + WindowHeight) - ExtraSpace;
787 var MenuLeftEdge = this.xPos;
788 var MenuRightEdge = MenuLeftEdge + this.offsetWidth;
789 var MenuBottomEdge = this.yPos + this.offsetHeight;
791 if (this.hasParent) {
792 var ParentLeftEdge = this.parentItem.oL;
794 if (MenuRightEdge > WindowRightEdge) {
795 if (this.hasParent) {
796 this.xPos = ((ParentLeftEdge - this.parentItem.DistanceToLeftEdge) + this.parentItem.ChildOverlap) - this.offsetWidth;
799 dif = MenuRightEdge - WindowRightEdge;
802 this.xPos = Math.max(5,this.xPos);
805 if (MenuBottomEdge > WindowBottomEdge) {
806 dif = MenuBottomEdge - WindowBottomEdge;
810 if (MenuLeftEdge < WindowLeftEdge) {
811 if (this.hasParent) {
812 this.xPos = (ParentLeftEdge + this.parentItem.DistanceToRightEdge) - this.parentItem.ChildOverlap;
813 MenuRightEdge = this.xPos + this.offsetWidth;
814 if(MenuRightEdge > WindowRightEdge) this.xPos -= (MenuRightEdge - WindowRightEdge);
820 function HM_f_LinkIt() {
821 if (this.linkText.indexOf("javascript:")!=-1) eval(this.linkText)
824 location.href = this.linkText;
828 function HM_f_PopDown(menuname){
829 if (!HM_AreLoaded || !HM_AreCreated) return;
830 menuname = menuname.replace("elMenu",HM_MenuIDPrefix);
831 var MenuToHide = document.getElementById(menuname);
832 if(!MenuToHide)return;
833 MenuToHide.isOn = false;
834 if (!HM_ClickKill) MenuToHide.hideTop();
837 function HM_f_HideAll(callingmenu) {
838 for(var i=0; i<HM_TotalTrees; i++) {
839 var TopMenu = HM_a_TopMenus[i].tree.startChild;
840 if(TopMenu == callingmenu)continue
841 TopMenu.isOn = false;
842 if (TopMenu.hasChildVisible) TopMenu.hideChildren();
843 TopMenu.showIt(false);
847 function HM_f_HideTree() {
848 HM_HideAllTimer = null;
849 if (HM_UserOverMenu) return;
850 if (this.hasChildVisible) this.hideChildren();
854 function HM_f_HideTop() {
855 TopMenuToHide = this;
856 (HM_ClickKill) ? TopMenuToHide.hideSelf() : (this.hideTimer = setTimeout("TopMenuToHide.hideSelf()",HM_TopMilliSecondsVisible));
859 function HM_f_HideSelf() {
860 this.hideTimer = null;
861 if (!this.isOn && !HM_UserOverMenu) this.showIt(false);
864 function HM_f_HideParents() {
866 while(TempMenu.hasParent) {
867 TempMenu.showIt(false);
868 TempMenu.parentMenu.isOn = false;
869 TempMenu = TempMenu.parentMenu;
874 function HM_f_HideChildren(callingitem) {
875 var TempMenu = this.visibleChild;
876 while(TempMenu.hasChildVisible) {
877 TempMenu.visibleChild.showIt(false);
878 TempMenu.hasChildVisible = false;
879 TempMenu = TempMenu.visibleChild;
881 if((callingitem && (!callingitem.hasMore || this.visibleChild != callingitem.child)) || (!callingitem && !this.isOn)) {
882 this.visibleChild.showIt(false);
883 this.hasChildVisible = false;
887 function HM_f_CancelSelect(){return false}
889 function HM_f_PageClick() {
890 if (!HM_UserOverMenu && HM_CurrentMenu!=null && !HM_CurrentMenu.isOn) HM_f_HideAll();
894 popDown = HM_f_PopDown;
896 function HM_f_ResizeHandler(){
897 var mouse_x_position, mouse_y_position;
898 for(var i=0; i<HM_TotalTrees; i++) {
899 var TopMenu = HM_a_TopMenus[i].tree.startChild;
900 if(TopMenu.style.visibility == "visible") {
901 TopMenu.oldLeft = TopMenu.xPos;
902 TopMenu.oldTop = TopMenu.yPos;
903 mouse_x_position = TopMenu.mouseX;
904 mouse_y_position = TopMenu.mouseY;
905 TopMenu.xPos = eval(TopMenu.tree.MenuLeft);
906 TopMenu.yPos = eval(TopMenu.tree.MenuTop);
907 if(TopMenu.xPos == null) TopMenu.xPos = TopMenu.xIntended;
908 if(TopMenu.yPos == null) TopMenu.yPos = TopMenu.yIntended;
909 if(!TopMenu.tree.TopIsPermanent) TopMenu.keepInWindow();
910 TopMenu.moveTo(TopMenu.xPos,TopMenu.yPos);
911 var TempMenu = TopMenu;
912 while(TempMenu.hasChildVisible) {
913 TempParent = TempMenu;
914 TempMenu = TempMenu.visibleChild;
915 TempMenu.xPos = TempParent.xPos + TempMenu.xDiff;
916 TempMenu.yPos = TempParent.yPos + TempMenu.yDiff;
917 if(!TopMenu.tree.TopIsPermanent || (TopMenu.tree.TopIsPermanent && !TopMenu.tree.PositionUnder)) TempMenu.keepInWindow();
918 TempMenu.moveTo(TempMenu.xPos,TempMenu.yPos);
925 HM_f_OtherResize = (window.onresize) ? window.onresize : new Function;
926 window.onresize = HM_f_ResizeHandler;
928 HM_f_OtherOnLoad = (window.onload) ? window.onload : new Function;
929 window.onload = function(){setTimeout("HM_f_StartIt()",10)};
932 HM_f_OtherOnUnload = (window.onunload) ? window.onunload : new Function;
933 window.onunload = function(){
934 HM_CurrentMenu = null;
935 HM_CurrentItem = null;
936 HM_CurrentTree.treeParent = null;
937 HM_CurrentTree.startChild = null;
939 var Eclength = HM_a_ElementsCreated.length;
940 for(var i=Eclength-1; i>=0; i--){
941 TempElement = HM_a_ElementsCreated[i];
942 TempElement.parentMenu = null;
943 TempElement.parentItem = null;
944 TempElement.itemElement = null;
945 TempElement.currentItem = null;
946 TempElement.child = null;
947 TempElement.siblingBelow = null;
948 TempElement.imgLyr = null;
952 for(var i=0; i<HM_TotalTrees; i++) {
953 HM_a_TopMenus[i].tree.startChild = null;
954 HM_a_TopMenus[i].tree.treeParent = null;
957 HM_f_OtherOnUnload();