home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 February / Chip_2003-02_cd1.bin / tema / cadstudio / HM_ScriptNS4.js < prev    next >
Text File  |  2001-11-15  |  30KB  |  805 lines

  1. /*HM_ScriptNS4.js
  2. * by Peter Belesis. v4.1.3 011108
  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.
  7. */
  8.  
  9. HM_a_Parameters = [
  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"],
  17.     ["BGColor",            "white"],
  18.     ["BGColorOver",        "black"],
  19.     ["ItemPadding",        3,        "number"],
  20.     ["BorderWidth",        2,        "number"],
  21.     ["BorderColor",        "red"],
  22.     ["SeparatorSize",      1,        "number"],
  23.     ["ImageSrc",           "HM_More_black_right.gif"],
  24.     ["ImageSrcOver",       null],
  25.     ["ImageSrcLeft",       "HM_More_black_left.gif"],
  26.     ["ImageSrcLeftOver",   null],
  27.     ["ImageSize",          5,        "number"],
  28.     ["ImageHorizSpace",    0,        "number"],
  29.     ["ImageVertSpace",     0,        "number"],
  30.     ["KeepHilite",         false,    "boolean"],
  31.     ["ClickStart",         false,    "boolean"],
  32.     ["ClickKill",          true,    "boolean"],
  33.     ["ChildOverlap",       20,        "number"],
  34.     ["ChildOffset",        10,        "number"],
  35.     ["ChildPerCentOver",   null,    "number"],
  36.     ["TopSecondsVisible",  .5,        "number"],
  37.     ["ChildSecondsVisible",.3,        "number"],
  38.     ["StatusDisplayBuild", 1,        "boolean"],
  39.     ["StatusDisplayLink",  1,        "boolean"],
  40.     ["UponDisplay",        null,    "delayed"],
  41.     ["UponHide",           null,    "delayed"],
  42.     ["RightToLeft",        false,    "boolean"],
  43.     ["CreateTopOnly",      0,        "boolean"],
  44.     ["ShowLinkCursor",     false,    "boolean"],
  45.     ["NSFontOver",           true,    "boolean"]
  46. ]
  47.  
  48. HM_MenuIDPrefix = "HM_Menu";
  49. HM_ItemIDPrefix = "HM_Item";
  50. HM_ArrayIDPrefix = "HM_Array";
  51.  
  52. Function.prototype.isFunction = true;
  53. Function.prototype.isString = false;
  54. String.prototype.isFunction = false;
  55. String.prototype.isString = true;
  56. String.prototype.isBoolean = false;
  57. String.prototype.isNumber = false;
  58. Number.prototype.isString = false;
  59. Number.prototype.isFunction = false;
  60. Number.prototype.isBoolean = false;
  61. Number.prototype.isNumber = true;
  62. Boolean.prototype.isString = false;
  63. Boolean.prototype.isFunction = false;
  64. Boolean.prototype.isBoolean = true;
  65. Boolean.prototype.isNumber = false;
  66. Array.prototype.itemValidation = false;
  67. Array.prototype.isArray = true;
  68.  
  69.  
  70. function HM_f_AssignParameters(paramarray){
  71.     var ParamName = paramarray[0];
  72.     var DefaultValue = paramarray[1];
  73.     var FullParamName = "HM_" + ParamName;
  74.  
  75.     if (typeof eval("window.HM_PG_" + ParamName) == "undefined") {
  76.         if (typeof eval("window.HM_GL_" + ParamName) == "undefined") {
  77.             eval(FullParamName + "= DefaultValue");
  78.         }
  79.         else {
  80.             eval(FullParamName + "= HM_GL_" + ParamName);
  81.         }
  82.     }
  83.     else {
  84.         eval(FullParamName + "= HM_PG_" + ParamName);
  85.     }
  86.  
  87.     paramarray[0] = FullParamName;
  88.     paramarray[1] = eval(FullParamName);
  89. }
  90.  
  91. function HM_f_EvalParameters(valuenew,valueold,valuetype){
  92.     var TestString, ParPosition;
  93.  
  94.     if(typeof valuenew == "undefined" || valuenew == null || (valuenew.isString && valuenew.length == 0)){
  95.         return valueold;
  96.     }
  97.  
  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);
  105.                 }
  106.             }
  107.             else break
  108.         }
  109.     }
  110.  
  111.     while(valuenew.isFunction) {valuenew = valuenew()}
  112.  
  113.     switch(valuetype){    
  114.         case "number":
  115.             while (valuenew.isString) {valuenew = eval(valuenew)}
  116.             break;
  117.         case "boolean":
  118.             while (!valuenew.isBoolean) {
  119.                 valuenew = (valuenew.isNumber) ? valuenew ? true : false : eval(valuenew);
  120.             }
  121.             break;
  122.     }
  123.  
  124.     return valuenew;
  125. }
  126.  
  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])")
  130. }
  131.  
  132. HM_ChildPerCentOver = (isNaN(parseFloat(HM_ChildPerCentOver))) ? null : parseFloat(HM_ChildPerCentOver)/100;
  133.  
  134. HM_ChildMilliSecondsVisible = HM_ChildSecondsVisible * 1000;
  135.  
  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--;
  146.                 }
  147.                 TheMenuArray.itemValidation = true;
  148.             }
  149.         }
  150.     }
  151.     return MenuArrayIsValid;
  152. }
  153.  
  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;
  158.     }
  159. }
  160.  
  161. HM_CurrentArray = null;
  162. HM_CurrentTree  = null;
  163. HM_CurrentMenu  = null;
  164. HM_CurrentItem  = null;
  165. HM_a_TopMenus = [];
  166. HM_AreLoaded = false;
  167. HM_AreCreated = false;
  168. HM_BeingCreated = false;
  169. HM_UserOverMenu = false;
  170. HM_HideAllTimer = null;
  171. HM_TotalTrees = 0;
  172. HM_ZIndex = 5000;
  173.  
  174. function HM_f_Initialize() {
  175.     if(HM_AreCreated) {
  176.         for(var i=0; i<HM_TotalTrees; i++) {
  177.             var TopMenu = HM_a_TopMenus[i];
  178.             clearTimeout(TopMenu.hideTimer);
  179.             TopMenu.hideTimer = null;
  180.         }
  181.         clearTimeout(HM_HideAllTimer);
  182.     }
  183.     HM_AreCreated = false;
  184.     HM_BeingCreated = false;
  185.     HM_UserOverMenu = false;
  186.     HM_CurrentMenu = null;
  187.     HM_HideAllTimer = null;
  188.     HM_TotalTrees = 0;
  189.     HM_a_TopMenus = [];
  190. }
  191.  
  192. Layer.prototype.showIt = HM_f_ShowIt;
  193. Layer.prototype.keepInWindow = HM_f_KeepInWindow;
  194. Layer.prototype.hideTree = HM_f_HideTree
  195. Layer.prototype.hideParents = HM_f_HideParents;
  196. Layer.prototype.hideChildren = HM_f_HideChildren;
  197. Layer.prototype.hideTop = HM_f_HideTop;
  198. Layer.prototype.hideSelf = HM_f_HideSelf;
  199. Layer.prototype.hasChildVisible = false;
  200. Layer.prototype.isOn = false;
  201. Layer.prototype.hideTimer = null;
  202. Layer.prototype.currentItem = null;
  203. Layer.prototype.itemSetup = HM_f_ItemSetup;
  204. Layer.prototype.itemCount = 0;
  205. Layer.prototype.child = null;
  206. Layer.prototype.isWritten = false;
  207.  
  208. HM_NS_OrigWidth  = window.innerWidth;
  209. HM_NS_OrigHeight = window.innerHeight;
  210.  
  211. window.onresize = function (){
  212.     if (window.innerWidth == HM_NS_OrigWidth && window.innerHeight == HM_NS_OrigHeight) return;
  213.     HM_f_Initialize();
  214.     window.history.go(0);
  215. }
  216.  
  217. function HM_f_StartIt() {
  218.     if(HM_AreCreated) return;
  219.     HM_AreLoaded = true;
  220.     if (HM_ClickKill) {
  221.         HM_f_OtherMouseDown = (document.onmousedown) ? document.onmousedown :  new Function;
  222.         document.captureEvents(Event.MOUSEDOWN);
  223.         document.onmousedown = function(){HM_f_PageClick();HM_f_OtherMouseDown()}
  224.     }
  225.     else {
  226.         HM_TopMilliSecondsVisible = HM_TopSecondsVisible * 1000;
  227.     }
  228.     HM_f_MakeTrees();
  229.     HM_f_OtherOnLoad();
  230. }
  231.  
  232. function HM_f_MakeTrees(){
  233.     HM_BeingCreated = true;
  234.     var TreeParams = null;
  235.     var TreeHasChildren = false;
  236.     var ItemArray = null;
  237.  
  238.     for(var t=0; t<HM_a_TreesToBuild.length; t++) {
  239.         if(!HM_f_ValidateArray(HM_ArrayIDPrefix + HM_a_TreesToBuild[t])) continue;
  240.         HM_CurrentArray = eval(HM_ArrayIDPrefix + HM_a_TreesToBuild[t]);
  241.  
  242.         TreeParams = HM_CurrentArray[0];
  243.         TreeHasChildren = false;
  244.  
  245.         for(var i=1; i<HM_CurrentArray.length; i++) {
  246.             ItemArray = HM_CurrentArray[i];
  247.             if(ItemArray[ItemArray.length-1]) {TreeHasChildren = true; break}
  248.         }
  249.  
  250.         HM_CurrentTree = {
  251.             MenuWidth        : MenuWidth = HM_f_EvalParameters(TreeParams[0],HM_MenuWidth,"number"),
  252.             MenuLeft         : MenuLeft = HM_f_EvalParameters(TreeParams[1],null,"delayed"),
  253.             MenuTop          : MenuTop = HM_f_EvalParameters(TreeParams[2],null,"delayed"),
  254.             ItemWidth        : ItemWidth = MenuWidth - (HM_BorderWidth*2),
  255.             ItemTextWidth    : TreeHasChildren ? (ItemWidth - (HM_ImageSize + HM_ImageHorizSpace + HM_ItemPadding)) : ItemWidth,
  256.             FontColor        : FontColor = HM_f_EvalParameters(TreeParams[3],HM_FontColor),
  257.             FontColorOver    : FontColorOver = HM_f_EvalParameters(TreeParams[4],HM_FontColorOver),
  258.             BGColor          : HM_f_EvalParameters(TreeParams[5],HM_BGColor),
  259.             BGColorOver      : HM_f_EvalParameters(TreeParams[6],HM_BGColorOver),
  260.             BorderColor      : HM_f_EvalParameters(TreeParams[7],HM_BorderColor),
  261.             TopIsPermanent   : ((MenuLeft == null) || (MenuTop == null)) ? false : HM_f_EvalParameters(TreeParams[9],false,"boolean"),
  262.             TopIsHorizontal  : TopIsHorizontal = HM_f_EvalParameters(TreeParams[10],false,"boolean"),
  263.             TreeIsHorizontal : TreeHasChildren ? HM_f_EvalParameters(TreeParams[11],false,"boolean") : false,
  264.             PositionUnder    : (!TopIsHorizontal || !TreeHasChildren) ? false : HM_f_EvalParameters(TreeParams[12],false,"boolean"),
  265.             TopImageShow     : TreeHasChildren ? HM_f_EvalParameters(TreeParams[13],true,"boolean")  : false,
  266.             TreeImageShow    : TreeHasChildren ? HM_f_EvalParameters(TreeParams[14],true,"boolean")  : false,
  267.             UponDisplay      : HM_f_EvalParameters(TreeParams[15],HM_UponDisplay,"delayed"),
  268.             UponHide         : HM_f_EvalParameters(TreeParams[16],HM_UponHide,"delayed"),
  269.             RightToLeft      : HM_f_EvalParameters(TreeParams[17],HM_RightToLeft,"boolean"),
  270.             NSFontOver         : HM_NSFontOver ? (FontColor != FontColorOver) : false,
  271.             ClickStart         : HM_f_EvalParameters(TreeParams[18],HM_ClickStart,"boolean"),
  272.             TopIsVariableWidth  : HM_f_EvalParameters(TreeParams[19],false,"boolean"),
  273.             TreeIsVariableWidth  : HM_f_EvalParameters(TreeParams[20],false,"boolean")
  274.         }
  275.  
  276.         HM_CurrentMenu = null;
  277.         HM_f_MakeMenu(HM_a_TreesToBuild[t]);
  278.         HM_a_TopMenus[HM_TotalTrees] = HM_CurrentTree.treeParent;
  279.         HM_TotalTrees++;
  280.         if(HM_CurrentTree.TopIsPermanent){
  281.             with(HM_CurrentTree.treeParent) {
  282.                 moveTo(eval(HM_CurrentTree.MenuLeft),eval(HM_CurrentTree.MenuTop));
  283.                 zIndex = HM_ZIndex;
  284.                 visibility = "show";
  285.             }
  286.         }
  287.     }
  288.  
  289.     if(HM_StatusDisplayBuild) status = HM_TotalTrees + " Hierarchical Menu Trees Created";
  290.     HM_AreCreated = true;
  291.     HM_BeingCreated = false;
  292. }
  293.  
  294. function HM_f_GetItemHtmlStr(arraystring){
  295.     var TempString = arraystring;
  296.     if (HM_FontBold) TempString = TempString.bold();
  297.     if (HM_FontItalic) TempString = TempString.italics();
  298.     TempString = "<FONT FACE='" + HM_FontFamily + "' POINT-SIZE=" + HM_FontSize + ">" + TempString + "</FONT>";
  299.     var TempStringOver = TempString.fontcolor(HM_CurrentTree.FontColorOver);
  300.     TempString = TempString.fontcolor(HM_CurrentTree.FontColor);
  301.     return [TempString,TempStringOver];
  302. }
  303.  
  304. function HM_f_MakeMenu(menucount) {
  305.     if(!HM_f_ValidateArray(HM_ArrayIDPrefix + menucount)) return false;
  306.     HM_CurrentArray = eval(HM_ArrayIDPrefix + menucount);
  307.  
  308.     NewMenu = eval("window." + HM_MenuIDPrefix + menucount);
  309.     if(!NewMenu) {
  310.         eval(HM_MenuIDPrefix + menucount + " = new Layer(HM_CurrentTree.MenuWidth,window)");
  311.         NewMenu = eval(HM_MenuIDPrefix + menucount);
  312.     
  313.         if(HM_CurrentMenu) {
  314.             NewMenu.parentMenu = HM_CurrentMenu;
  315.             NewMenu.parentItem = HM_CurrentItem;
  316.             NewMenu.parentItem.child = NewMenu;
  317.             NewMenu.hasParent = true;
  318.             NewMenu.isHorizontal = HM_CurrentTree.TreeIsHorizontal;
  319.             NewMenu.showImage = HM_CurrentTree.TreeImageShow;
  320.         }
  321.         else {
  322.             NewMenu.isHorizontal = HM_CurrentTree.TopIsHorizontal;
  323.             NewMenu.showImage = HM_CurrentTree.TopImageShow;
  324.         }
  325.     
  326.         HM_CurrentMenu = NewMenu;
  327.         HM_CurrentMenu.count = menucount;
  328.         HM_CurrentMenu.tree  = HM_CurrentTree;
  329.         HM_CurrentMenu.array = HM_CurrentArray;
  330.         HM_CurrentMenu.maxItems = HM_CurrentArray.length - 1;
  331.         HM_CurrentMenu.bgColor = HM_CurrentTree.BorderColor;
  332.         HM_CurrentMenu.IsVariableWidth = ((HM_CurrentMenu.hasParent && HM_CurrentTree.TreeIsVariableWidth) || (!HM_CurrentMenu.hasParent && HM_CurrentTree.TopIsVariableWidth));
  333.         HM_CurrentMenu.onmouseover = HM_f_MenuOver;
  334.         HM_CurrentMenu.onmouseout = HM_f_MenuOut;
  335.         HM_CurrentMenu.moveTo(0,0);
  336.     }
  337.  
  338.     if(!HM_CurrentTree.treeParent) HM_CurrentTree.treeParent = HM_CurrentTree.startChild = HM_CurrentMenu;
  339.  
  340.     while (HM_CurrentMenu.itemCount < HM_CurrentMenu.maxItems) {
  341.         HM_CurrentMenu.itemCount++;
  342.         HM_CurrentItem = eval("window." + HM_ItemIDPrefix + menucount + "_" + HM_CurrentMenu.itemCount);
  343.         if(!HM_CurrentItem) {
  344.             eval(HM_ItemIDPrefix + menucount + "_" + HM_CurrentMenu.itemCount + " = new Layer(HM_CurrentTree.ItemWidth - (HM_ItemPadding*2),HM_CurrentMenu)")
  345.             if(HM_StatusDisplayBuild) status = "Creating Hierarchical Menus: " + menucount + " / " + HM_CurrentMenu.itemCount;
  346.             HM_CurrentItem = eval(HM_ItemIDPrefix + menucount + "_" + HM_CurrentMenu.itemCount);
  347.             HM_CurrentItem.itemSetup(menucount + "_" + HM_CurrentMenu.itemCount);
  348.         }
  349.         if(HM_CurrentItem.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.                 HM_CurrentArray = HM_CurrentMenu.array;
  354.             }
  355.         }
  356.     }
  357.     HM_CurrentMenu.itemCount = 0;
  358.     if (HM_CurrentMenu.isHorizontal) {
  359.         HM_CurrentMenu.clip.right = HM_CurrentMenu.lastItem.left + HM_CurrentMenu.lastItem.clip.right + HM_BorderWidth;
  360.     }
  361.     else {
  362.         HM_CurrentMenu.clip.right = HM_CurrentMenu.lastItem.clip.width + (HM_BorderWidth*2);
  363.     }
  364.     HM_CurrentMenu.clip.bottom = HM_CurrentMenu.lastItem.top + HM_CurrentMenu.lastItem.clip.bottom + HM_BorderWidth;
  365.     return HM_CurrentMenu;
  366. }
  367.  
  368. function HM_f_ItemSetup(itemidsuffix) {
  369.     this.menu = HM_CurrentMenu;
  370.     this.tree = HM_CurrentTree;
  371.     this.index = HM_CurrentMenu.itemCount - 1;
  372.     this.array = HM_CurrentArray[HM_CurrentMenu.itemCount];
  373.     this.dispText = this.array[0];
  374.     this.linkText = this.array[1];
  375.     this.permHilite  = HM_f_EvalParameters(this.array[3],false,"boolean");
  376.     this.hasRollover = (!this.permHilite && HM_f_EvalParameters(this.array[2],true,"boolean"));
  377.     this.hasMore     = HM_f_EvalParameters(this.array[4],false,"boolean") && HM_f_ValidateArray(HM_ArrayIDPrefix + itemidsuffix);
  378.     var HtmlStrings = HM_f_GetItemHtmlStr(this.dispText);
  379.     this.htmStr = HtmlStrings[0];
  380.     this.htmStrOver = HtmlStrings[1];
  381.     this.visibility = "inherit";
  382.     this.onmouseover = HM_f_ItemOver;
  383.     this.onmouseout  = HM_f_ItemOut;
  384.     this.menu.lastItem = this;
  385.     this.showChild = HM_f_ShowChild;
  386.  
  387.     this.ClickStart = this.hasMore && this.tree.ClickStart && (this.tree.TopIsPermanent && (this.tree.treeParent==this.menu));
  388.     if(this.ClickStart) {
  389.         this.captureEvents(Event.MOUSEUP);
  390.         this.onmouseup = this.showChild;
  391.         this.linkText = "";
  392.     }
  393.     else {
  394.         if (this.linkText) {
  395.             this.captureEvents(Event.MOUSEUP);
  396.             this.onmouseup = HM_f_LinkIt;
  397.         }
  398.     }
  399.  
  400.     this.txtLyrOff = new Layer(HM_CurrentTree.ItemTextWidth - (HM_ItemPadding*2),this);
  401.     with(this.txtLyrOff) {
  402.         document.write(this.permHilite ? this.htmStrOver : this.htmStr);
  403.         document.close();
  404.         if (HM_CurrentTree.RightToLeft && this.menu.showImage && (!this.menu.isHorizontal || (this.menu.isHorizontal && (!this.menu.IsVariableWidth || (this.menu.IsVariableWidth && this.hasMore))) )) left = HM_ItemPadding + HM_ImageSize + HM_ImageHorizSpace;
  405.         visibility = "inherit";
  406.     }
  407.  
  408.     if(this.menu.IsVariableWidth){
  409.         this.ItemTextWidth = this.txtLyrOff.document.width;
  410.         this.ItemWidth = this.ItemTextWidth + (HM_ItemPadding*2);
  411.         if(HM_CurrentMenu.showImage) {
  412.             if(!this.menu.isHorizontal || this.hasMore) {
  413.                 this.ItemWidth += (HM_ItemPadding + HM_ImageSize + HM_ImageHorizSpace);
  414.             }
  415.         }
  416.     }
  417.     else {
  418.         this.ItemWidth = this.tree.ItemWidth;
  419.         this.ItemTextWidth = this.tree.ItemTextWidth;
  420.     }
  421.     if (this.menu.isHorizontal) {
  422.         if (this.index) this.left = this.siblingBelow.left + this.siblingBelow.clip.width + HM_SeparatorSize;
  423.         else this.left = (HM_BorderWidth + HM_ItemPadding);
  424.         this.top = (HM_BorderWidth + HM_ItemPadding);
  425.     }
  426.     else {
  427.         this.left = (HM_BorderWidth + HM_ItemPadding);
  428.         if (this.index) this.top = this.siblingBelow.top + this.siblingBelow.clip.height + HM_SeparatorSize;
  429.         else this.top = (HM_BorderWidth + HM_ItemPadding)
  430.     }
  431.     this.clip.top = this.clip.left = -HM_ItemPadding;
  432.     this.clip.right = this.ItemWidth - HM_ItemPadding;
  433.     this.bgColor = this.permHilite ? this.tree.BGColorOver : this.tree.BGColor;
  434.  
  435.     if(this.tree.NSFontOver) {
  436.         if(!this.permHilite){
  437.             this.txtLyrOn = new Layer(this.ItemTextWidth,this);
  438.             with(this.txtLyrOn) {
  439.                 if (HM_CurrentTree.RightToLeft && this.menu.showImage && (!this.menu.isHorizontal || (this.menu.isHorizontal && (!this.menu.IsVariableWidth || (this.menu.IsVariableWidth && this.hasMore))) ))  left = HM_ItemPadding + HM_ImageSize + HM_ImageHorizSpace;
  440.                 visibility = "hide";
  441.             }
  442.         }
  443.     }
  444.  
  445.     this.fullClip = this.txtLyrOff.document.height + (HM_ItemPadding * 2);
  446.     if(this.menu.isHorizontal) {
  447.         if(this.index) {
  448.             var SiblingHeight = this.siblingBelow.clip.height;
  449.             this.fullClip = Math.max(SiblingHeight,this.fullClip);
  450.             if(this.fullClip > SiblingHeight) {
  451.                 var SiblingPrevious = this.siblingBelow;
  452.                 while(SiblingPrevious != null) {
  453.                     SiblingPrevious.clip.height = this.fullClip;
  454.                     SiblingPrevious = SiblingPrevious.siblingBelow;
  455.                 }
  456.             }
  457.         }
  458.     }
  459.     this.clip.height = this.fullClip;
  460.  
  461.     if(!this.menu.isHorizontal && this.menu.IsVariableWidth) {
  462.         this.fullWidth = this.clip.width;
  463.         if(this.index) {
  464.             var SiblingWidth = this.siblingBelow.clip.width;
  465.             this.fullWidth = Math.max(SiblingWidth,this.fullWidth);
  466.             SiblingPrevious = this.siblingBelow;
  467.             while(SiblingPrevious != null) {
  468.                 SiblingPrevious.clip.width = this.fullWidth;
  469.                 SiblingPrevious.dummyLyr.clip.width = this.fullWidth;
  470.                 if(SiblingPrevious.hasMore) {
  471.                     SiblingPrevious.DistanceToRightEdge = SiblingPrevious.clip.right + SiblingPrevious.WhatsOnRight;
  472.                     SiblingPrevious.DistanceToLeftEdge = HM_ItemPadding + SiblingPrevious.WhatsOnLeft;
  473.                     SiblingPrevious.CompleteWidth = SiblingPrevious.ItemWidth + SiblingPrevious.WhatsOnLeft + SiblingPrevious.WhatsOnRight;
  474.                     SiblingPrevious.ChildOverlap = (parseInt((HM_ChildPerCentOver != null) ? (HM_ChildPerCentOver  * SiblingPrevious.CompleteWidth) : HM_ChildOverlap));
  475.                 }
  476.                 if(SiblingPrevious.imgLyr && !HM_CurrentTree.RightToLeft) {
  477.                     SiblingPrevious.imgLyr.left = this.fullWidth - (HM_ItemPadding * 2) - HM_ImageSize - HM_ImageHorizSpace;
  478.                 }
  479.                 SiblingPrevious = SiblingPrevious.siblingBelow;
  480.             }
  481.         }
  482.         this.clip.width = this.fullWidth;
  483.     }
  484.  
  485.     this.dummyLyr = new Layer(100,this);
  486.     with(this.dummyLyr) {
  487.         left = top = -HM_ItemPadding;
  488.         clip.width = this.clip.width;
  489.         clip.height = this.clip.height;
  490.         visibility = "inherit";
  491.     }
  492.  
  493.     if(this.hasMore && HM_CurrentMenu.showImage) {
  494.         this.imageSrc = this.tree.RightToLeft ? HM_ImageSrcLeft : HM_ImageSrc;
  495.         this.hasImageRollover = ((!this.tree.RightToLeft && HM_ImageSrcOver) || (this.tree.RightToLeft && HM_ImageSrcLeftOver));
  496.         if(this.hasImageRollover) {
  497.             this.imageSrcOver = this.tree.RightToLeft ? HM_ImageSrcLeftOver : HM_ImageSrcOver;
  498.             if(this.permHilite) this.imageSrc = this.imageSrcOver;
  499.         }
  500.         this.imgLyr = new Layer(HM_ImageSize,this);
  501.  
  502.         with(this.imgLyr) {
  503.             document.write("<IMG SRC='" + this.imageSrc + "' WIDTH=" + HM_ImageSize + " VSPACE=0 HSPACE=0 BORDER=0>");
  504.             document.close();
  505.             moveBelow(this.txtLyrOff);
  506.             left = (HM_CurrentTree.RightToLeft) ? HM_ImageHorizSpace : this.ItemWidth - (HM_ItemPadding * 2) - HM_ImageSize - HM_ImageHorizSpace;
  507.             top = HM_ImageVertSpace;
  508.             visibility = "inherit";
  509.         }
  510.         this.imageElement = this.imgLyr.document.images[0];
  511.     }
  512.  
  513.     if(this.hasMore) {
  514.         this.WhatsOnRight = (!this.menu.isHorizontal || (this.menu.isHorizontal && this.isLastItem)) ?  HM_BorderWidth : HM_SeparatorSize;
  515.         this.DistanceToRightEdge = this.clip.right + this.WhatsOnRight;
  516.         this.WhatsOnLeft = (!this.menu.isHorizontal || (this.menu.isHorizontal && this.index==0)) ? HM_BorderWidth : HM_SeparatorSize;
  517.         this.DistanceToLeftEdge = HM_ItemPadding + this.WhatsOnLeft;
  518.         this.CompleteWidth = this.ItemWidth + this.WhatsOnLeft + this.WhatsOnRight;
  519.         this.ChildOverlap = (parseInt((HM_ChildPerCentOver != null) ? (HM_ChildPerCentOver  * this.CompleteWidth) : HM_ChildOverlap));
  520.     }
  521. }
  522.  
  523. function HM_f_PopUp(menuname,e){
  524.     if (!HM_AreLoaded) return;
  525.     menuname = menuname.replace("elMenu",HM_MenuIDPrefix);
  526.     var TempMenu = eval("window."+menuname);
  527.     if(!TempMenu)return;
  528.     HM_CurrentMenu = TempMenu;
  529.     if (HM_CurrentMenu.tree.ClickStart) {
  530.         var ClickElement = e.target;
  531.         ClickElement.onclick = HM_f_PopMenu;
  532.     }
  533.     else HM_f_PopMenu(e);
  534. }
  535.  
  536. function HM_f_PopMenu(e){
  537.     if (!HM_AreLoaded || !HM_AreCreated) return true;
  538.     if (HM_CurrentMenu.tree.ClickStart && e.type != "click") return true;
  539.     HM_f_HideAll();
  540.     HM_CurrentMenu.hasParent = false;
  541.     HM_CurrentMenu.tree.startChild = HM_CurrentMenu;
  542.     var mouse_x_position = e.pageX;
  543.     var mouse_y_position = e.pageY;
  544.     HM_CurrentMenu.xPos = (HM_CurrentMenu.tree.MenuLeft!=null) ? eval(HM_CurrentMenu.tree.MenuLeft) : mouse_x_position;
  545.     HM_CurrentMenu.yPos = (HM_CurrentMenu.tree.MenuTop!=null)  ? eval(HM_CurrentMenu.tree.MenuTop)  : mouse_y_position;
  546.  
  547.     HM_CurrentMenu.keepInWindow();
  548.     HM_CurrentMenu.moveTo(HM_CurrentMenu.xPos,HM_CurrentMenu.yPos);
  549.     HM_CurrentMenu.isOn = true;
  550.     HM_CurrentMenu.showIt(true);
  551.     return false;
  552. }
  553.  
  554. function HM_f_MenuOver() {
  555.     if(!this.tree.startChild){this.tree.startChild = this}
  556.     if(this.tree.startChild == this) HM_f_HideAll(this)
  557.     this.isOn = true;
  558.     HM_UserOverMenu = true;
  559.     HM_CurrentMenu = this;
  560.     if (this.hideTimer) clearTimeout(this.hideTimer);
  561. }
  562.  
  563. function HM_f_MenuOut() {
  564.     this.isOn = false;
  565.     HM_UserOverMenu = false;
  566.     if(HM_StatusDisplayLink) status = "";
  567.     if(!HM_ClickKill) {
  568.         clearTimeout(HM_HideAllTimer);
  569.         HM_HideAllTimer = null;
  570.         HM_HideAllTimer = setTimeout("HM_CurrentMenu.hideTree()",HM_ChildMilliSecondsVisible);
  571.     }
  572. }
  573.  
  574. function HM_f_ShowChild(){
  575.     if(!this.child) {
  576.         HM_CurrentTree = this.tree;
  577.         HM_CurrentMenu = this.menu;
  578.         HM_CurrentItem = this;
  579.         this.child = HM_f_MakeMenu(this.menu.count + "_"+(this.index+1));
  580.         this.tree.treeParent = this.menu;
  581.         this.tree.startChild = this.menu;
  582.     }
  583.     if (this.tree.PositionUnder && (this.menu == this.tree.treeParent)) {
  584.         this.child.xPos = this.pageX + this.clip.left - HM_BorderWidth;
  585.         this.child.yPos = this.menu.top + this.menu.clip.height - HM_BorderWidth;
  586.     }
  587.     else {
  588.         this.oL = this.pageX;
  589.         this.child.offsetWidth = this.child.clip.width;
  590.         this.oT = this.pageY + this.clip.top - HM_BorderWidth;
  591.         if(this.tree.RightToLeft) {
  592.             this.child.xPos = ((this.oL - this.DistanceToLeftEdge) + this.ChildOverlap) - this.child.offsetWidth;
  593.         }
  594.         else {        
  595.             this.child.xPos = (this.oL + this.DistanceToRightEdge) - this.ChildOverlap;
  596.         }
  597.         this.child.yPos = this.oT + HM_ChildOffset + HM_BorderWidth;
  598.     }
  599.     if(!this.tree.PositionUnder || this.menu!=this.tree.treeParent) this.child.keepInWindow();
  600.     this.child.moveTo(this.child.xPos,this.child.yPos);
  601.     this.menu.hasChildVisible = true;
  602.     this.menu.visibleChild = this.child;
  603.     this.child.showIt(true);
  604. }
  605.  
  606. function HM_f_ItemOver(){
  607.     if (HM_KeepHilite) {
  608.         if (this.menu.currentItem && this.menu.currentItem != this && this.menu.currentItem.hasRollover) {
  609.             with(this.menu.currentItem){
  610.                 bgColor = this.tree.BGColor;
  611.                 if(this.tree.NSFontOver) {
  612.                     txtLyrOff.visibility = "inherit";
  613.                     txtLyrOn.visibility = "hide";
  614.                 }
  615.             }
  616.             if(this.menu.currentItem.hasImageRollover)this.menu.currentItem.imageElement.src = this.menu.currentItem.imageSrc;
  617.         }
  618.     }
  619.     if(this.hasRollover) {
  620.         this.bgColor = this.tree.BGColorOver;
  621.         if(this.tree.NSFontOver) {
  622.             if(!this.txtLyrOn.isWritten){
  623.                 this.txtLyrOn.document.write(this.htmStrOver);
  624.                 this.txtLyrOn.document.close();
  625.                 this.txtLyrOn.isWritten = true;
  626.             }
  627.             this.txtLyrOff.visibility = "hide";
  628.             this.txtLyrOn.visibility = "inherit";
  629.         }
  630.         if(this.hasImageRollover)this.imageElement.src = this.imageSrcOver;
  631.     }
  632.  
  633.     if(HM_StatusDisplayLink) status = this.linkText;
  634.     this.menu.currentItem = this;
  635.     if (this.menu.hasChildVisible) {
  636.         if(this.menu.visibleChild == this.child && this.menu.visibleChild.hasChildVisible) this.menu.visibleChild.hideChildren(this);
  637.         else this.menu.hideChildren(this);
  638.     }
  639.  
  640.     if (this.hasMore && !this.ClickStart) this.showChild();
  641. }
  642.  
  643. function HM_f_ItemOut() {
  644.     if ( (!HM_KeepHilite || ((this.tree.TopIsPermanent && (this.tree.treeParent==this)) && !this.menu.hasChildVisible)) && this.hasRollover) {
  645.         with(this){
  646.             bgColor = this.tree.BGColor;
  647.             if(this.tree.NSFontOver) {
  648.                 txtLyrOff.visibility = "inherit";
  649.                 txtLyrOn.visibility = "hide";
  650.             }
  651.             if(this.hasImageRollover)this.imageElement.src = this.imageSrc;
  652.         }
  653.     }
  654.     if(!HM_ClickKill && !HM_UserOverMenu) {
  655.         clearTimeout(HM_HideAllTimer);
  656.         HM_HideAllTimer = null;
  657.         HM_HideAllTimer = setTimeout("HM_CurrentMenu.hideTree()",HM_ChildMilliSecondsVisible);
  658.     }
  659. }
  660.  
  661. function HM_f_ShowIt(on) {
  662.     if (!(this.tree.TopIsPermanent && (this.tree.treeParent==this))) {
  663.         if(!this.hasParent || (this.hasParent && this.tree.TopIsPermanent && (this.tree.treeParent==this.parentMenu)    )) {
  664.             if (on == this.hidden)
  665.                 eval(on ? this.tree.UponDisplay : this.tree.UponHide)
  666.         }
  667.         if (on) this.zIndex = ++HM_ZIndex;
  668.         this.visibility = on ? "show" : "hide";
  669.     }
  670.     if (HM_KeepHilite && this.currentItem && this.currentItem.hasRollover) {
  671.         with(this.currentItem){
  672.             bgColor = this.tree.BGColor;
  673.             if(this.tree.NSFontOver) {
  674.                 txtLyrOff.visibility = "inherit";
  675.                 txtLyrOn.visibility = "hide";
  676.             }
  677.         }
  678.         if(this.currentItem.hasImageRollover)this.currentItem.imageElement.src = this.currentItem.imageSrc;
  679.     }
  680.     this.currentItem = null;
  681. }
  682.  
  683. function HM_f_KeepInWindow() {
  684.     var ExtraSpace     = 10;
  685.     var WindowLeftEdge = window.pageXOffset;
  686.     var WindowTopEdge  = window.pageYOffset;
  687.     var WindowWidth    = window.innerWidth;
  688.     var WindowHeight   = window.innerHeight;
  689.     var WindowRightEdge  = (WindowLeftEdge + WindowWidth) - ExtraSpace;
  690.     var WindowBottomEdge = (WindowTopEdge + WindowHeight) - ExtraSpace;
  691.  
  692.     var MenuLeftEdge = this.xPos;
  693.     var MenuRightEdge = MenuLeftEdge + this.clip.width;
  694.     var MenuBottomEdge = this.yPos + this.clip.height;
  695.  
  696.     if (this.hasParent) {
  697.         var ParentLeftEdge = this.parentItem.pageX;
  698.         this.offsetWidth = this.clip.width;
  699.     }
  700.     if (MenuRightEdge > WindowRightEdge) {
  701.         if (this.hasParent) {
  702.             this.xPos = ((ParentLeftEdge - this.parentItem.DistanceToLeftEdge) + this.parentItem.ChildOverlap) - this.offsetWidth;
  703.         }
  704.         else {
  705.             dif = MenuRightEdge - WindowRightEdge;
  706.             this.xPos -= dif;
  707.         }
  708.         this.xPos = Math.max(5,this.xPos);
  709.     }
  710.  
  711.     if (MenuBottomEdge > WindowBottomEdge) {
  712.         dif = MenuBottomEdge - WindowBottomEdge;
  713.         this.yPos -= dif;
  714.     }
  715.  
  716.     if (MenuLeftEdge < WindowLeftEdge) {
  717.         if (this.hasParent) {
  718.             this.xPos = (ParentLeftEdge + this.parentItem.DistanceToRightEdge) - this.parentItem.ChildOverlap;
  719.             MenuRightEdge = this.xPos + this.offsetWidth;
  720.             if(MenuRightEdge > WindowRightEdge) this.xPos -= (MenuRightEdge - WindowRightEdge);
  721.         }
  722.         else {this.xPos = 5}
  723.     }       
  724. }
  725.  
  726. function HM_f_LinkIt() {
  727.     if (this.linkText.indexOf("javascript:")!=-1) eval(this.linkText)
  728.     else {
  729.         HM_f_HideAll();
  730.         location.href = this.linkText;
  731.     }
  732. }
  733.  
  734. function HM_f_PopDown(menuname){
  735.     if (!HM_AreLoaded || !HM_AreCreated) return;
  736.     menuname = menuname.replace("elMenu",HM_MenuIDPrefix);
  737.     var MenuToHide = eval("window."+menuname);
  738.     if(!MenuToHide)return;
  739.     MenuToHide.isOn = false;
  740.     if (!HM_ClickKill) MenuToHide.hideTop();
  741. }
  742.  
  743. function HM_f_HideAll(callingmenu) {
  744.     for(var i=0; i<HM_TotalTrees; i++) {
  745.         var TopMenu = HM_a_TopMenus[i].tree.startChild;
  746.         if(TopMenu == callingmenu)continue
  747.         TopMenu.isOn = false;
  748.         if (TopMenu.hasChildVisible) TopMenu.hideChildren();
  749.         TopMenu.showIt(false);
  750.     }    
  751. }
  752.  
  753. function HM_f_HideTree() { 
  754.     HM_HideAllTimer = null;
  755.     if (HM_UserOverMenu) return;
  756.     if (this.hasChildVisible) this.hideChildren();
  757.     this.hideParents();
  758. }
  759.  
  760. function HM_f_HideTop() {
  761.     TopMenuToHide = this;
  762.     (HM_ClickKill) ? TopMenuToHide.hideSelf() : (this.hideTimer = setTimeout("TopMenuToHide.hideSelf()",HM_TopMilliSecondsVisible));
  763. }
  764.  
  765. function HM_f_HideSelf() {
  766.     this.hideTimer = null;
  767.     if (!this.isOn && !HM_UserOverMenu) this.showIt(false);
  768. }
  769.  
  770. function HM_f_HideParents() {
  771.     var TempMenu = this;
  772.     while(TempMenu.hasParent) {
  773.         TempMenu.showIt(false);
  774.         TempMenu.parentMenu.isOn = false;        
  775.         TempMenu = TempMenu.parentMenu;
  776.     }
  777.     TempMenu.hideTop();
  778. }
  779.  
  780. function HM_f_HideChildren(callingitem) {
  781.     var TempMenu = this.visibleChild;
  782.     while(TempMenu.hasChildVisible) {
  783.         TempMenu.visibleChild.showIt(false);
  784.         TempMenu.hasChildVisible = false;
  785.         TempMenu = TempMenu.visibleChild;
  786.     }
  787.  
  788.     if (!this.isOn || !callingitem.hasMore || this.visibleChild != callingitem.child) {
  789.         this.visibleChild.showIt(false);
  790.         this.hasChildVisible = false;
  791.     }
  792. }
  793.  
  794. function HM_f_PageClick() {
  795.     if (!HM_UserOverMenu && HM_CurrentMenu!=null && !HM_CurrentMenu.isOn) HM_f_HideAll();
  796. }
  797.  
  798. popUp = HM_f_PopUp;
  799. popDown = HM_f_PopDown;
  800.  
  801. HM_f_OtherOnLoad = (window.onload) ? window.onload :  new Function;
  802. window.onload = HM_f_StartIt;
  803.  
  804.  
  805. //end