home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 July / Chip_2001-07_cd1.bin / firmy / Comin / dmenu / HM_ScriptIE4.js < prev    next >
Text File  |  2001-03-29  |  26KB  |  730 lines

  1. /*HM_ScriptIE4.js
  2. * by Peter Belesis. v4.0.5 010312
  3. * Copyright (c) 2001 Peter Belesis. All Rights Reserved.
  4. * Originally published and documented at http://www.dhtmlab.com/
  5. * You may use this code on a public Web site only if this entire
  6. * copyright notice appears unchanged and you publicly display
  7. * a link to http://www.dhtmlab.com/.
  8. *
  9. * Contact peter.belesis@btclick.com for all other uses.
  10. */
  11.  
  12. HM_a_Parameters = [
  13.     ["MenuWidth",          150],
  14.     ["FontFamily",         "Arial,sans-serif"],
  15.     ["FontSize",           10],
  16.     ["FontBold",           false],
  17.     ["FontItalic",         false],
  18.     ["FontColor",          "black"],
  19.     ["FontColorOver",      "white"],
  20.     ["BGColor",            "white"],
  21.     ["BGColorOver",        "black"],
  22.     ["ItemPadding",        3],
  23.     ["BorderWidth",        2],
  24.     ["BorderColor",        "red"],
  25.     ["BorderStyle",        "solid"],
  26.     ["SeparatorSize",      1],
  27.     ["SeparatorColor",     "yellow"],
  28.     ["ImageSrc",           "tri.gif"],
  29.     ["ImageSrcLeft",       "triL.gif"],
  30.     ["ImageSize",          5],
  31.     ["ImageHorizSpace",    0],
  32.     ["ImageVertSpace",     0],
  33.     ["KeepHilite",         false],
  34.     ["ClickStart",         false],
  35.     ["ClickKill",          true],
  36.     ["ChildOverlap",       20],
  37.     ["ChildOffset",        10],
  38.     ["ChildPerCentOver",   null],
  39.     ["TopSecondsVisible",  .5],
  40.     ["StatusDisplayBuild", 1],
  41.     ["StatusDisplayLink",  1],
  42.     ["UponDisplay",        null],
  43.     ["UponHide",           null],
  44.     ["RightToLeft",        false],
  45.     ["CreateTopOnly",      0],
  46.     ["ShowLinkCursor",     false]
  47. ]
  48.  
  49. HM_MenuIDPrefix = "HM_Menu";
  50. HM_ItemIDPrefix = "HM_Item";
  51. HM_ArrayIDPrefix = "HM_Array";
  52.  
  53. function HM_f_StringTrim(){
  54.     var TestString = this;
  55.     var SpaceChar  = " ";
  56.     while (TestString.charAt(0) == SpaceChar) {TestString = TestString.substr(1)};
  57.     while (TestString.charAt(TestString.length-1) == SpaceChar) {TestString = TestString.substr(0,TestString.length-1)};
  58.     return TestString.toString();
  59. }
  60.  
  61. HM_a_BadChars = [".","/"," ",",","-"];
  62.  
  63. function HM_f_StringStrip(){
  64.     var TestString = this;
  65.     var BadChar;
  66.     for(var i=0;i<HM_a_BadChars.length;i++) {
  67.         BadChar = HM_a_BadChars[i];
  68.         BadCharIndex = TestString.lastIndexOf(BadChar);
  69.         if(BadCharIndex!=-1) TestString = TestString.substr(BadCharIndex + 1);
  70.     }
  71.     return TestString.toString();
  72. }
  73.  
  74. String.prototype.trim = HM_f_StringTrim;
  75. String.prototype.strip = HM_f_StringStrip;
  76.  
  77. function HM_f_AssignParameters(paramname,defaultvalue){
  78.     var FullParamName = "HM_" + paramname;
  79.     if (typeof eval("window.HM_PG_" + paramname) == "undefined") {
  80.         if (typeof eval("window.HM_GL_" + paramname) == "undefined") {
  81.             eval(FullParamName + "= defaultvalue");
  82.         }
  83.         else {
  84.             eval(FullParamName + "= HM_GL_" + paramname);
  85.         }
  86.     }
  87.     else {
  88.         eval(FullParamName + "= HM_PG_" + paramname);
  89.     }
  90.  
  91.     var TestString = eval(FullParamName);
  92.     if(eval("typeof(TestString)") == "string") {
  93.         TestString = TestString.trim();
  94.         if(TestString.length == 0) {
  95.             eval(FullParamName + "= null");
  96.             return;
  97.         }
  98.         if(TestString.charAt(0)=="#")return;
  99.         TestString = TestString.strip();
  100.     }
  101.  
  102.     if (eval("typeof(" + TestString +")") != 'undefined') {
  103.         eval(FullParamName + "= eval("+ FullParamName +")");
  104.     }
  105. }
  106.  
  107. for (i=0;i<HM_a_Parameters.length;i++) {
  108.     HM_f_AssignParameters(HM_a_Parameters[i][0],HM_a_Parameters[i][1]);
  109. }
  110.  
  111. HM_ChildPerCentOver = (isNaN(parseFloat(HM_ChildPerCentOver))) ? null : parseFloat(HM_ChildPerCentOver)/100;
  112.  
  113. function HM_f_ValidateArray(arrayname){
  114.     return ((typeof eval("window." + arrayname) == "object") && (eval(arrayname).length > 1))
  115. }
  116.  
  117. if(!window.HM_a_TreesToBuild) {
  118.     HM_a_TreesToBuild = [];
  119.     for(i=1; i<100; i++){
  120.         if(HM_f_ValidateArray(HM_ArrayIDPrefix + i)) HM_a_TreesToBuild[HM_a_TreesToBuild.length] = i;
  121.     }
  122. }
  123.  
  124. HM_CurrentArray = null;
  125. HM_CurrentTree  = null;
  126. HM_CurrentMenu  = null;
  127. HM_CurrentItem  = null;
  128. HM_a_TopMenus = [];
  129. HM_AreLoaded = false;
  130. HM_AreCreated = false;
  131. HM_BeingCreated = false;
  132. HM_UserOverMenu = false;
  133. HM_HideAllTimer = null;
  134. HM_TotalTrees = 0; 
  135. HM_ZIndex = 5000;
  136.  
  137. function propertyTransfer(){
  138.     this.obj = eval(this.id + "Obj");
  139.     for (temp in this.obj) {this[temp] = this.obj[temp]}
  140. }
  141.  
  142. function HM_f_StartIt() {
  143.     if((typeof(document.body) == "undefined") || (document.body == null)) return;
  144.     HM_AreLoaded = true;
  145.     if (HM_ClickKill) {
  146.         HM_f_OtherMouseDown = (document.onmousedown) ? document.onmousedown : new Function;
  147.         document.onmousedown = function(){HM_f_PageClick();HM_f_OtherMouseDown()}
  148.     }
  149.     else {
  150.         HM_TopMilliSecondsVisible = HM_TopSecondsVisible * 1000;
  151.     }
  152.     HM_f_MakeTrees();
  153. }
  154.  
  155. function HM_f_AssignTreeParameters(arrayvalue,defaultvalue){
  156.     var ValueIsString = (typeof arrayvalue == "string");
  157.     if (ValueIsString) arrayvalue = arrayvalue.trim();
  158.     var ValueIsNull = ((arrayvalue == null) || (typeof arrayvalue == "undefined") || (ValueIsString && arrayvalue.length == 0));
  159.     if(ValueIsNull) return defaultvalue;
  160.     var TestString = arrayvalue;
  161.     if(eval("typeof(TestString)") == "string") {
  162.         if(TestString.charAt(0)=="#")return arrayvalue;
  163.         TestString = TestString.strip()
  164.     }
  165.     if (eval("typeof("+ TestString+" )") != 'undefined') {
  166.         eval("arrayvalue = eval(arrayvalue)");
  167.     }
  168.     return arrayvalue;
  169. }
  170.  
  171. function HM_f_MakeTrees(){
  172.     HM_BeingCreated = true;
  173.     var TreeParams = null;
  174.     var TreeHasChildren = false;
  175.     var ItemArray = null;
  176.  
  177.     for(var t=0; t<HM_a_TreesToBuild.length; t++) {
  178.         if(!HM_f_ValidateArray(HM_ArrayIDPrefix + HM_a_TreesToBuild[t])) continue;
  179.         HM_CurrentArray = eval(HM_ArrayIDPrefix + HM_a_TreesToBuild[t]);
  180.  
  181.         TreeParams = HM_CurrentArray[0];
  182.         TreeHasChildren = false;
  183.  
  184.         for(var i=1; i<HM_CurrentArray.length; i++) {
  185.             ItemArray = HM_CurrentArray[i];
  186.             if(ItemArray[ItemArray.length-1]) {TreeHasChildren = true; break}
  187.         }
  188.  
  189.         HM_CurrentTree = {
  190.             MenuWidth        : MenuWidth = HM_f_AssignTreeParameters(TreeParams[0],HM_MenuWidth),
  191.             MenuLeft         : MenuLeft = HM_f_AssignTreeParameters(TreeParams[1],null),
  192.             MenuTop          : MenuTop = HM_f_AssignTreeParameters(TreeParams[2],null),
  193.             ItemWidth        : ItemWidth = MenuWidth - (HM_BorderWidth*2),
  194.             ItemTextWidth    : TreeHasChildren ? (ItemWidth - (HM_ImageSize + HM_ImageHorizSpace + HM_ItemPadding)) : ItemWidth,
  195.             HorizOffsetRight : HorizOffsetRight = (parseInt((HM_ChildPerCentOver != null) ? (HM_ChildPerCentOver  * ItemWidth) : HM_ChildOverlap)),
  196.             HorizOffsetLeft  : (MenuWidth - HorizOffsetRight),
  197.             FontColor        : HM_f_AssignTreeParameters(TreeParams[3],HM_FontColor),
  198.             FontColorOver    : HM_f_AssignTreeParameters(TreeParams[4],HM_FontColorOver),
  199.             BGColor          : HM_f_AssignTreeParameters(TreeParams[5],HM_BGColor),
  200.             BGColorOver      : HM_f_AssignTreeParameters(TreeParams[6],HM_BGColorOver),
  201.             BorderColor      : HM_f_AssignTreeParameters(TreeParams[7],HM_BorderColor),
  202.             SeparatorColor   : HM_f_AssignTreeParameters(TreeParams[8],HM_SeparatorColor),
  203.             TopIsPermanent   : ((MenuLeft == null) || (MenuTop == null)) ? false : HM_f_AssignTreeParameters(TreeParams[9],false),
  204.             TopIsHorizontal  : TopIsHorizontal = HM_f_AssignTreeParameters(TreeParams[10],false),
  205.             TreeIsHorizontal : TreeHasChildren ? HM_f_AssignTreeParameters(TreeParams[11],false) : false,
  206.             PositionUnder    : (!TopIsHorizontal || !TreeHasChildren) ? false : HM_f_AssignTreeParameters(TreeParams[12],false),
  207.             TopImageShow     : TreeHasChildren ? HM_f_AssignTreeParameters(TreeParams[13],true)  : false,
  208.             TreeImageShow    : TreeHasChildren ? HM_f_AssignTreeParameters(TreeParams[14],true)  : false,
  209.             UponDisplay      : HM_f_AssignTreeParameters(TreeParams[15],HM_UponDisplay),
  210.             UponHide         : HM_f_AssignTreeParameters(TreeParams[16],HM_UponHide),
  211.             RightToLeft      : HM_f_AssignTreeParameters(TreeParams[17],HM_RightToLeft)
  212.         }
  213.  
  214.         HM_CurrentMenu = null;
  215.         HM_f_MakeMenu(HM_a_TreesToBuild[t]);
  216.         HM_a_TopMenus[HM_TotalTrees] = HM_CurrentTree.treeParent;
  217.         HM_TotalTrees++;
  218.         if(HM_CurrentTree.TopIsPermanent){
  219.             with(HM_CurrentTree.treeParent) {
  220.                 moveTo(HM_CurrentTree.MenuLeft,HM_CurrentTree.MenuTop);
  221.                 style.zIndex = 5000;
  222.                 setTimeout(HM_CurrentTree.treeParent.id + ".fixSize(true)",10);
  223.             }
  224.         }
  225.     }
  226.  
  227.     if(HM_StatusDisplayBuild) status = HM_TotalTrees + " Hierarchical Menu Trees Created";
  228.     HM_AreCreated = true;
  229.     HM_BeingCreated = false;
  230. }
  231.  
  232. function HM_f_GetItemDivStr(itemid,disptext,hasmore){
  233.     var WidthValue = HM_CurrentMenu.isHorizontal ? (ItemElement.isLastItem) ? (HM_CurrentTree.MenuWidth - HM_BorderWidth - HM_SeparatorSize) : (HM_CurrentTree.MenuWidth - HM_BorderWidth) : HM_CurrentTree.ItemWidth;
  234.     var TempString = "<DIV ID=" + itemid + " STYLE='position:absolute;width:" + WidthValue + "px'>";
  235.     if(HM_CurrentMenu.showImage) {
  236.         var FullPadding  = (HM_ItemPadding*2) + HM_ImageSize + HM_ImageHorizSpace;
  237.     }
  238.     if(hasmore && HM_CurrentMenu.showImage) {
  239.         var ImgPosition = HM_CurrentTree.RightToLeft ? "absolute;" : "relative;";
  240.         var ImgSrc      = HM_CurrentTree.RightToLeft ? HM_ImageSrcLeft : HM_ImageSrc;
  241.         var ImgHSpace   = (HM_CurrentTree.RightToLeft) ? 0 : HM_ItemPadding;
  242.         var ImgStyle    = HM_CurrentTree.RightToLeft ? ("left:"+ (HM_ItemPadding + HM_ImageHorizSpace) + "px;top:"+ (HM_ItemPadding + HM_ImageVertSpace) + "px;") : ("float:right;margin-right:"+ (-FullPadding) +"px;margin-top:"+ HM_ImageVertSpace + "px;width:"+ HM_ImageSize + "px;");
  243.         var ImgString   = "<IMG ID='HM_ImMore' STYLE='position:"+ ImgPosition + ImgStyle +"' SRC='" + ImgSrc + "' HSPACE="+ ImgHSpace +" VSPACE=0 BORDER=0>";
  244.         TempString += ImgString;
  245.     }
  246.      TempString += disptext + "</DIV>";
  247.     return TempString;
  248. }
  249.  
  250. function HM_f_SetItemProperties(itemid,itemidsuffix) {
  251.     this.tree        = HM_CurrentTree;
  252.     this.itemsetup   = HM_f_ItemSetup;
  253.     this.index       = HM_CurrentMenu.itemCount - 1;
  254.     this.tree        = HM_CurrentTree;
  255.     this.isLastItem  = (HM_CurrentMenu.itemCount == HM_CurrentMenu.maxItems);
  256.     this.array         = HM_CurrentMenu.array[HM_CurrentMenu.itemCount];
  257.     this.dispText    = this.array[0];
  258.     this.linkText    = this.array[1];
  259.     this.permHilite  = eval(this.array[3]);
  260.     this.hasRollover = (!this.permHilite && eval(this.array[2]));
  261.     this.hasMore     = eval(this.array[4]) && HM_f_ValidateArray(HM_ArrayIDPrefix + itemidsuffix);
  262.  
  263.     this.childID     = this.hasMore ? (HM_MenuIDPrefix + itemidsuffix) : null;
  264.     this.child         = null;
  265.     this.onmouseover = HM_f_ItemOver;
  266.     this.onmouseout  = HM_f_ItemOut;
  267.     this.setItemStyle = HM_f_SetItemStyle;
  268.     this.itemStr     = HM_f_GetItemDivStr(itemid,this.dispText,this.hasMore);
  269. }
  270.  
  271. function HM_f_Make4ItemElement(menucount) {
  272.     var ItemIDSuffix = menucount + "_" + HM_CurrentMenu.itemCount;
  273.     var LayerID  = HM_ItemIDPrefix + ItemIDSuffix;
  274.     var ObjectID = LayerID + "Obj";
  275.      eval(ObjectID + " = new Object()");
  276.     ItemElement = eval(ObjectID);
  277.     ItemElement.setItemProperties = HM_f_SetItemProperties;
  278.     ItemElement.setItemProperties(LayerID,ItemIDSuffix);
  279.     return ItemElement;
  280. }
  281.  
  282. function HM_f_MakeElement(menuid) {
  283.     var MenuObject;
  284.     var LayerID  = menuid;
  285.     var ObjectID = LayerID + "Obj";
  286.     eval(ObjectID + " = new Object()"); 
  287.     MenuObject = eval(ObjectID);
  288.     return MenuObject;
  289. }
  290.  
  291. function HM_f_MakeMenu(menucount) {
  292.     if(!HM_f_ValidateArray(HM_ArrayIDPrefix + menucount)) return false;
  293.     HM_CurrentArray = eval(HM_ArrayIDPrefix + menucount);
  294.     NewMenu = document.all(HM_MenuIDPrefix + menucount);
  295.     if(!NewMenu) {
  296.         NewMenu = HM_f_MakeElement(HM_MenuIDPrefix + menucount);
  297.         NewMenu.array = HM_CurrentArray;
  298.         NewMenu.tree  = HM_CurrentTree;
  299.  
  300.         if(HM_CurrentMenu) {
  301.             NewMenu.parentMenu = HM_CurrentMenu;
  302.             NewMenu.parentItem = HM_CurrentMenu.itemElement;
  303.             NewMenu.parentItem.child = NewMenu;
  304.             NewMenu.hasParent = true;
  305.             NewMenu.isHorizontal = HM_CurrentTree.TreeIsHorizontal;
  306.             NewMenu.showImage = HM_CurrentTree.TreeImageShow;
  307.         }
  308.         else {
  309.             NewMenu.isHorizontal = HM_CurrentTree.TopIsHorizontal;
  310.             NewMenu.showImage = HM_CurrentTree.TopImageShow;
  311.         }
  312.     
  313.         HM_CurrentMenu = NewMenu;
  314.         HM_CurrentMenu.itemCount = 0;
  315.         HM_CurrentMenu.maxItems = HM_CurrentMenu.array.length - 1;
  316.         HM_CurrentMenu.zIndex = ++HM_ZIndex;
  317.         HM_CurrentMenu.showIt = HM_f_ShowIt;
  318.         HM_CurrentMenu.keepInWindow = HM_f_KeepInWindow;
  319.         HM_CurrentMenu.onmouseover = HM_f_MenuOver;
  320.         HM_CurrentMenu.onmouseout = HM_f_MenuOut;
  321.         HM_CurrentMenu.hideTree = HM_f_HideTree
  322.         HM_CurrentMenu.hideParents = HM_f_HideParents;
  323.         HM_CurrentMenu.hideChildren = HM_f_HideChildren;
  324.         HM_CurrentMenu.hideTop = HM_f_HideTop;
  325.         HM_CurrentMenu.hideSelf = HM_f_HideSelf;
  326.         HM_CurrentMenu.count = menucount;
  327.         HM_CurrentMenu.hasChildVisible = false;
  328.         HM_CurrentMenu.isOn = false;
  329.         HM_CurrentMenu.hideTimer = null;
  330.         HM_CurrentMenu.currentItem = null;
  331.         HM_CurrentMenu.setMenuStyle = HM_f_SetMenuStyle;
  332.         HM_CurrentMenu.sizeFixed = false;
  333.         HM_CurrentMenu.fixSize = HM_f_FixSize;
  334.         HM_CurrentMenu.onselectstart = HM_f_CancelSelect;
  335.         HM_CurrentMenu.moveTo = HM_f_MoveTo;
  336.     
  337.         HM_CurrentMenu.htmlString = "<DIV ID='" + HM_MenuIDPrefix + menucount +"' STYLE='position:absolute;visibility:hidden;width:"+ HM_CurrentTree.MenuWidth +"'>";
  338.     }
  339.  
  340.     while (HM_CurrentMenu.itemCount < HM_CurrentMenu.maxItems) {
  341.         HM_CurrentMenu.itemCount++;
  342.  
  343.         HM_CurrentItem = document.all(HM_ItemIDPrefix + menucount + "_" + HM_CurrentMenu.itemCount);
  344.         if(!HM_CurrentItem) {
  345.             if(HM_StatusDisplayBuild) status = "Creating Hierarchical Menus: " + menucount + " / " + HM_CurrentMenu.itemCount;
  346.             HM_CurrentMenu.itemElement = HM_f_Make4ItemElement(menucount);
  347.             HM_CurrentMenu.htmlString += HM_CurrentMenu.itemElement.itemStr;
  348.         }
  349.         if(HM_CurrentMenu.itemElement.hasMore && (!HM_CreateTopOnly || HM_AreCreated && HM_CreateTopOnly)) {
  350.             MenuCreated = HM_f_MakeMenu(menucount + "_" + HM_CurrentMenu.itemCount);
  351.             if(MenuCreated) {
  352.                 HM_CurrentMenu = HM_CurrentMenu.parentMenu;
  353.             }
  354.         }
  355.     }
  356.  
  357.     document.body.insertAdjacentHTML("BeforeEnd",HM_CurrentMenu.htmlString + "</DIV>");
  358.     menuLyr = document.all(HM_MenuIDPrefix + menucount);
  359.     menuLyr.propertyTransfer = propertyTransfer;
  360.     menuLyr.propertyTransfer();
  361.     HM_CurrentMenu = menuLyr;
  362.     HM_CurrentMenu.setMenuStyle();
  363.     HM_CurrentMenu.childNodes = HM_CurrentMenu.children;
  364.     HM_CurrentMenu.lastItem = HM_CurrentMenu.childNodes[HM_CurrentMenu.childNodes.length-1];
  365.     for(var i=0; i<HM_CurrentMenu.childNodes.length; i++) {
  366.         it = HM_CurrentMenu.childNodes[i];
  367.         it.siblingBelow = i>0 ? HM_CurrentMenu.childNodes[i-1] : null;
  368.         it.propertyTransfer = propertyTransfer;
  369.         it.propertyTransfer();
  370.         it.itemsetup(i+1);
  371.     }
  372.     HM_CurrentMenu.moveTo(0,0);
  373.     HM_CurrentTree.treeParent = HM_CurrentTree.startChild = HM_CurrentMenu;
  374.     return HM_CurrentMenu;
  375. }
  376.  
  377. function HM_f_SetMenuStyle(){
  378.     with(this.style) {
  379.         borderWidth = HM_BorderWidth + "px";
  380.         borderColor = HM_CurrentTree.BorderColor;
  381.         borderStyle = HM_BorderStyle;
  382.         zIndex      = --HM_ZIndex;
  383.         overflow    = "hidden";
  384.         cursor      = "default";
  385.     }
  386. }
  387.  
  388. function HM_f_SetItemStyle() {
  389.     with(this.style){
  390.         backgroundColor   = (this.permHilite) ? HM_CurrentTree.BGColorOver : HM_CurrentTree.BGColor;
  391.         color             = (this.permHilite) ? HM_CurrentTree.FontColorOver : HM_CurrentTree.FontColor;
  392.         font        = ((HM_FontBold) ? "bold " : "normal ") + HM_FontSize + "pt " + HM_FontFamily;
  393.         padding     = HM_ItemPadding +"px";
  394.         fontStyle   = (HM_FontItalic) ? "italic" : "normal";
  395.         overflow    = "hidden";
  396.         pixelWidth = HM_CurrentTree.ItemWidth;
  397.  
  398.         if(HM_CurrentMenu.showImage)    {
  399.             var FullPadding  = (HM_ItemPadding*2) + HM_ImageSize + HM_ImageHorizSpace;
  400.             if (this.tree.RightToLeft) paddingLeft = FullPadding + "px";
  401.             else paddingRight = FullPadding + "px";
  402.         }
  403.         if(!this.isLastItem) {
  404.             var SeparatorString = HM_SeparatorSize + "px solid " + this.tree.SeparatorColor;
  405.             if (this.menu.isHorizontal) borderRight = SeparatorString;
  406.             else borderBottom = SeparatorString;
  407.         }
  408.  
  409.         if(this.menu.isHorizontal){
  410.             if(this.isLastItem) pixelWidth = (HM_CurrentTree.MenuWidth - HM_BorderWidth - HM_SeparatorSize);
  411.             else pixelWidth = (HM_CurrentTree.MenuWidth - HM_BorderWidth);
  412.             pixelTop = 0;
  413.             pixelLeft = (this.index * (HM_CurrentTree.MenuWidth - HM_BorderWidth));
  414.             var LeftAndWidth = pixelLeft + pixelWidth;
  415.             this.menu.style.pixelWidth = LeftAndWidth + (HM_BorderWidth * 2);
  416.         }
  417.         else {
  418.             pixelLeft = 0;
  419.         }
  420.     }
  421. }
  422.  
  423. function HM_f_FixSize(makevis){
  424.     if(this.isHorizontal) {
  425.         var MaxItemHeight = 0;
  426.         for(i=0; i<this.childNodes.length; i++) {
  427.             var TempItem = this.childNodes[i];
  428.             if (TempItem.index) {
  429.                 var SiblingHeight = TempItem.siblingBelow.scrollHeight;
  430.                 MaxItemHeight = Math.max(MaxItemHeight,SiblingHeight);
  431.             }
  432.                else{
  433.                 MaxItemHeight = TempItem.scrollHeight;
  434.             }
  435.         }
  436.         for(i=0; i<this.childNodes.length; i++) {
  437.             this.childNodes[i].style.pixelHeight = MaxItemHeight;
  438.         }
  439.         this.style.pixelHeight = MaxItemHeight+(HM_BorderWidth * 2);
  440.     }
  441.     else {
  442.         for(i=0; i<this.childNodes.length; i++) {
  443.             var TempItem = this.childNodes[i];
  444.             if (TempItem.index) {
  445.                 var SiblingHeight =(TempItem.siblingBelow.scrollHeight + HM_SeparatorSize);
  446.                 TempItem.style.pixelTop = TempItem.siblingBelow.style.pixelTop + SiblingHeight;
  447.             }
  448.             else TempItem.style.pixelTop = 0;
  449.         }
  450.     
  451.         this.style.pixelHeight = TempItem.style.pixelTop + TempItem.scrollHeight + (HM_BorderWidth * 2);
  452.     }
  453.  
  454.     this.sizeFixed = true;
  455.     if(makevis)this.style.visibility = "visible";
  456. }
  457.  
  458. function HM_f_ItemSetup(whichItem) {
  459.     this.menu = this.parentElement;
  460.     if (this.hasMore) {
  461.         this.child = document.all(this.childID);
  462.         if(this.child) {
  463.             this.child.parentMenu = this.menu;
  464.             this.child.parentItem = this;
  465.         }
  466.     }
  467.     if (this.linkText) {
  468.         this.onclick = HM_f_LinkIt;
  469.         if(HM_ShowLinkCursor)this.style.cursor = "hand";
  470.     }
  471.     this.setItemStyle();
  472. }
  473.  
  474. function HM_f_PopUp(menuname){
  475.     if (!HM_AreLoaded) return;
  476.     menuname = menuname.replace("elMenu",HM_MenuIDPrefix);
  477.     var TempMenu = document.all(menuname);
  478.     if(!TempMenu) return;
  479.     HM_CurrentMenu = TempMenu;
  480.     if (HM_ClickStart) {
  481.         var ClickElement = event.srcElement;
  482.         ClickElement.onclick = HM_f_PopMenu;
  483.     }
  484.     else HM_f_PopMenu();
  485. }
  486.  
  487. function HM_f_PopMenu(){
  488.     if (!HM_AreLoaded || !HM_AreCreated) return true;
  489.     if (HM_ClickStart && event.type != "click") return true;
  490.     HM_f_HideAll();
  491.     HM_CurrentMenu.hasParent = false;
  492.     HM_CurrentMenu.tree.startChild = HM_CurrentMenu;
  493.     var EventX = (event.clientX + document.body.scrollLeft);
  494.     var EventY = (event.clientY + document.body.scrollTop);
  495.     HM_CurrentMenu.xPos = (HM_CurrentMenu.tree.MenuLeft != null) ? HM_CurrentMenu.tree.MenuLeft : EventX;
  496.        HM_CurrentMenu.yPos = (HM_CurrentMenu.tree.MenuTop != null)  ? HM_CurrentMenu.tree.MenuTop  : EventY;
  497.     HM_CurrentMenu.keepInWindow();
  498.     HM_CurrentMenu.moveTo(HM_CurrentMenu.xPos,HM_CurrentMenu.yPos);
  499.     HM_CurrentMenu.isOn = true;
  500.     HM_CurrentMenu.showIt(true);
  501.     return false;
  502. }
  503.  
  504. function HM_f_MenuOver() {
  505.     if(!this.tree.startChild){this.tree.startChild = this}
  506.     if(this.tree.startChild == this) HM_f_HideAll(this)
  507.     this.isOn = true;
  508.     HM_UserOverMenu = true;
  509.     HM_CurrentMenu = this;
  510.     if (this.hideTimer) clearTimeout(this.hideTimer);
  511. }
  512.  
  513. function HM_f_MenuOut() {
  514.     if(event.srcElement.contains(event.toElement)) return;
  515.     this.isOn = false;
  516.     HM_UserOverMenu = false;
  517.     if(HM_StatusDisplayLink) status = "";
  518.     if(!HM_ClickKill) HM_HideAllTimer = setTimeout("HM_CurrentMenu.hideTree()",10);  
  519. }
  520.  
  521. function HM_f_ItemOver(){
  522.     if (HM_KeepHilite) {
  523.         if (this.menu.currentItem && this.menu.currentItem != this && this.menu.currentItem.hasRollover) {
  524.             with(this.menu.currentItem.style){
  525.                 backgroundColor = this.tree.BGColor;
  526.                 color = this.tree.FontColor
  527.             }
  528.         }
  529.     }
  530.  
  531.     if(event.srcElement.id == "HM_ImMore") return;
  532.  
  533.     if(this.hasRollover) {
  534.         this.style.backgroundColor = this.tree.BGColorOver;
  535.         this.style.color = this.tree.FontColorOver;
  536.     }
  537.  
  538.     if(HM_StatusDisplayLink) status = this.linkText;
  539.     this.menu.currentItem = this;
  540.  
  541.     if (this.menu.hasChildVisible) {
  542.         if(this.menu.visibleChild == this.child && this.menu.visibleChild.hasChildVisible) this.menu.visibleChild.hideChildren(this);
  543.         else this.menu.hideChildren(this);
  544.     }
  545.  
  546.     if (this.hasMore) {
  547.         if(!this.child) {
  548.             HM_CurrentTree = this.tree;
  549.             HM_CurrentMenu = this.menu;
  550.             HM_CurrentItem = this;
  551.             this.child = HM_f_MakeMenu(this.menu.count + "_"+(this.index+1));
  552.             this.tree.treeParent = this.menu;
  553.             this.tree.startChild = this.menu;
  554.         }
  555.         if (this.tree.PositionUnder && (this.menu == this.tree.treeParent)) {
  556.                 this.child.xPos = this.menu.style.pixelLeft + this.style.pixelLeft;
  557.                 this.child.yPos = this.menu.style.pixelTop + this.menu.offsetHeight - (HM_BorderWidth);
  558.         }
  559.         else {
  560.             this.oL = this.menu.style.pixelLeft + this.offsetLeft;
  561.             this.oT = this.menu.style.pixelTop  + this.offsetTop;
  562.             if(this.tree.RightToLeft) {
  563.                 this.child.xPos = this.oL + (this.tree.HorizOffsetRight - this.child.offsetWidth);
  564.             }
  565.             else {        
  566.                 this.child.xPos = this.oL + this.tree.HorizOffsetLeft;
  567.             }
  568.             this.child.yPos = this.oT + HM_ChildOffset + HM_BorderWidth;
  569.         }
  570.         if(!this.tree.PositionUnder) this.child.keepInWindow();
  571.         this.child.moveTo(this.child.xPos,this.child.yPos);
  572.         this.menu.hasChildVisible = true;
  573.         this.menu.visibleChild = this.child;
  574.         this.child.showIt(true);
  575.     }
  576. }
  577.  
  578. function HM_f_ItemOut() {
  579.     if (event.srcElement.contains(event.toElement)
  580.       || (event.fromElement.tagName=="IMG" && event.toElement.contains(event.fromElement)))
  581.           return;
  582.     if ( (!HM_KeepHilite || ((this.tree.TopIsPermanent && (this.tree.treeParent==this)) && !this.menu.hasChildVisible)) && this.hasRollover) {
  583.         with(this.style) {
  584.             backgroundColor = this.tree.BGColor;
  585.                    color = this.tree.FontColor
  586.         }
  587.     }
  588. }
  589.  
  590. function HM_f_MoveTo(xPos,yPos) {
  591.     this.style.pixelLeft = xPos;
  592.     this.style.pixelTop = yPos;
  593. }
  594.  
  595. function HM_f_ShowIt(on) {
  596.     if (!(this.tree.TopIsPermanent && (this.tree.treeParent==this))) {
  597.         if(!this.hasParent || (this.hasParent && this.tree.TopIsPermanent)) {
  598.             var IsVisible = (this.style.visibility == "visible");
  599.             if ((on && !IsVisible) || (!on && IsVisible))
  600.                 eval(on ? this.tree.UponDisplay : this.tree.UponHide)
  601.         }
  602.         if(on && !this.sizeFixed) this.fixSize(false);
  603.         this.style.visibility = (on) ? "visible" : "hidden";
  604.     }
  605.     if (HM_KeepHilite && this.currentItem && this.currentItem.hasRollover) {
  606.         with(this.currentItem.style){
  607.             backgroundColor = this.tree.BGColor;
  608.             color = this.tree.FontColor;
  609.         }
  610.     }
  611.     this.currentItem = null;
  612. }
  613.  
  614. function HM_f_KeepInWindow() {
  615.     var ExtraSpace     = 10;
  616.     var WindowLeftEdge = document.body.scrollLeft;
  617.     var WindowTopEdge  = document.body.scrollTop;
  618.     var WindowWidth    = document.body.clientWidth;
  619.     var WindowHeight   = document.body.clientHeight;
  620.     var WindowRightEdge  = (WindowLeftEdge + WindowWidth) - ExtraSpace;
  621.     var WindowBottomEdge = (WindowTopEdge + WindowHeight) - ExtraSpace;
  622.  
  623.     var MenuLeftEdge = this.xPos;
  624.     var MenuRightEdge = MenuLeftEdge + this.offsetWidth;
  625.     var MenuBottomEdge = this.yPos + this.offsetHeight;
  626.  
  627.     if (this.hasParent) {
  628.         var ParentLeftEdge = this.parentMenu.style.pixelLeft;
  629.     }
  630.     if (MenuRightEdge > WindowRightEdge) {
  631.         if (this.hasParent) {
  632.             this.xPos = ParentLeftEdge + this.tree.HorizOffsetRight - this.offsetWidth;    
  633.         }
  634.         else {
  635.             dif = MenuRightEdge - WindowRightEdge;
  636.             this.xPos -= dif;
  637.         }
  638.     }
  639.  
  640.     if (MenuBottomEdge > WindowBottomEdge) {
  641.         dif = MenuBottomEdge - WindowBottomEdge;
  642.         this.yPos -= dif;
  643.     }
  644.  
  645.     if (MenuLeftEdge < WindowLeftEdge) {
  646.         if (this.hasParent) {
  647.             this.xPos = ParentLeftEdge + this.tree.HorizOffsetLeft;
  648.         }
  649.         else {this.xPos = 5}
  650.     }
  651. }
  652.  
  653. function HM_f_LinkIt() {
  654.     HM_f_HideAll();
  655.     if (this.linkText.indexOf("javascript")!=-1) eval(this.linkText)
  656.     else location.href = this.linkText;
  657. }
  658.  
  659. function HM_f_PopDown(menuname){
  660.     if (!HM_AreLoaded || !HM_AreCreated) return;
  661.     menuname = menuname.replace("elMenu",HM_MenuIDPrefix);
  662.     var MenuToHide = document.all(menuname);
  663.     if(!MenuToHide)return;
  664.     MenuToHide.isOn = false;
  665.     if (!HM_ClickKill) MenuToHide.hideTop();
  666. }
  667.  
  668. function HM_f_HideAll(callingmenu) {
  669.     for(var i=0; i<HM_TotalTrees; i++) {
  670.         var TopMenu = HM_a_TopMenus[i].tree.startChild;
  671.         if(TopMenu == callingmenu)continue
  672.         TopMenu.isOn = false;
  673.         if (TopMenu.hasChildVisible) TopMenu.hideChildren();
  674.         TopMenu.showIt(false);
  675.     }    
  676. }
  677.  
  678. function HM_f_HideTree() { 
  679.     HM_HideAllTimer = null;
  680.     if (HM_UserOverMenu) return;
  681.     if (this.hasChildVisible) this.hideChildren();
  682.     this.hideParents();
  683. }
  684.  
  685. function HM_f_HideTop() {
  686.     TopMenuToHide = this;
  687.     (HM_ClickKill) ? TopMenuToHide.hideSelf() : (this.hideTimer = setTimeout("TopMenuToHide.hideSelf()",HM_TopMilliSecondsVisible));
  688. }
  689.  
  690. function HM_f_HideSelf() {
  691.     this.hideTimer = null;
  692.     if (!this.isOn && !HM_UserOverMenu) this.showIt(false);
  693. }
  694.  
  695. function HM_f_HideParents() {
  696.     var TempMenu = this;
  697.     while(TempMenu.hasParent) {
  698.         TempMenu.showIt(false);
  699.         TempMenu.parentMenu.isOn = false;        
  700.         TempMenu = TempMenu.parentMenu;
  701.     }
  702.     TempMenu.hideTop();
  703. }
  704.  
  705. function HM_f_HideChildren(callingitem) {
  706.     var TempMenu = this.visibleChild;
  707.     while(TempMenu.hasChildVisible) {
  708.         TempMenu.visibleChild.showIt(false);
  709.         TempMenu.hasChildVisible = false;
  710.         TempMenu = TempMenu.visibleChild;
  711.     }
  712.  
  713.     if (!this.isOn || !callingitem.hasMore || this.visibleChild != this.child) {
  714.         this.visibleChild.showIt(false);
  715.         this.hasChildVisible = false;
  716.     }
  717. }
  718.  
  719. function HM_f_CancelSelect(){return false}
  720.  
  721. function HM_f_PageClick() {
  722.     if (!HM_UserOverMenu && HM_CurrentMenu!=null && !HM_CurrentMenu.isOn) HM_f_HideAll();
  723. }
  724.  
  725. popUp = HM_f_PopUp;
  726. popDown = HM_f_PopDown;
  727.  
  728. window.onload = function(){setTimeout("HM_f_StartIt()",10)};
  729.  
  730. //end