home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 October / Chip_2002-10_cd1.bin / tema / reseni / b2b.mht / menu.js < prev    next >
Encoding:
Text File  |  2002-09-07  |  21.7 KB  |  858 lines

  1. <!--
  2. lev0 = new Array ("x-small","2",true,false,"White","#291772","White","Verdana","#82A2D6") ;
  3. lev1 = new Array ("x-small","2",true,false,"White","#291772","White","Verdana","#82A2D6") ;
  4.  
  5.  
  6.  
  7. mn1 = new Array
  8. (
  9. "B2B Centrum","o_firme.htm",0
  10. ,"Kontakty","kontakt.htm",0
  11. )
  12.  
  13.  
  14. mn2 = new Array
  15. (
  16. "Co znamenß B2B","b2b_ecomerce.htm",0
  17. ,"E-tr₧iÜt∞","e_marketplace.htm",0
  18. ,"V²hody e-tr₧iÜ¥","intelligo.htm",0
  19. )
  20.  
  21.  
  22. mn3 = new Array
  23. (
  24. "TiskovΘ zprßvy","tiskove_zpravy.htm",0
  25. ,"O B2B Centru","o_firme_tisk.htm",0
  26. ,"Obrazov² materißl","obr_material.htm",0
  27. ,"Tiskov² kontakt","tiskovy_kontakt.htm",0
  28. ,"Äßdost o informace","zadost_o_informace.htm",0
  29. )
  30.  
  31.  
  32. mn4 = new Array
  33. (
  34. "KariΘra u B2B Centra","kariera_b2b.htm",0
  35. ,"VolnΘ pozice","volne_pozice.htm",0
  36. )
  37.  
  38. mn5 = new Array
  39. ("","",0
  40. )
  41.  
  42. absPath="";
  43. if (sepFrame && !openSameFrame)
  44.     {
  45.     if (document.URL.lastIndexOf("\\")>document.URL.lastIndexOf("/")) {sepCh = "\\" ;} else {sepCh = "/" ;}
  46.     absPath = document.URL.substring(0,document.URL.lastIndexOf(sepCh)+1);
  47.     }
  48. iconTag = "<IMG SRC=\'"+(NS4?absPath:unescape(absPath))+"images/sxicona.gif\' BORDER=0 WIDTH=8 HEIGHT=8 ALIGN=RIGHT>" ;
  49. popupOffset = 3;
  50. toCnt = 0;
  51. stStr = new Array ('\\','|','/','-'+'-');
  52. newpx=0;
  53. newpy=0;
  54. stPos = 0 ;
  55. lev0menus = 1 ;
  56. loadStatus = 0;
  57. brSizeChg = false;
  58. readyStatus = 0;
  59. contentPage = null;
  60. brPage = (sepFrame) ? (NS4) ? parent : parent.document.body : window;
  61. brPage.onload = onCreate;
  62. prevActiveItem = null ;
  63. if(NS4) {startWidth = brPage.innerWidth; startHeight = brPage.innerHeight; brPage.onresize = reDo;}
  64. if(!mac)
  65.    {
  66.    iconTag = "<IMG SRC=\'"+(NS4?absPath:unescape(absPath))+"img/sxicona.gif\' BORDER=0 WIDTH=8 HEIGHT=8 ALIGN=RIGHT>" ;
  67.    if(IE4) {iconTag = "<SPAN STYLE='height:100%;width:"+ iconSize +";overflow:hidden;float:right'>"+ iconTag +"</SPAN>";}
  68.    }
  69. onReady();
  70.  
  71. function chgVisib(obj,bVis)
  72.     {
  73.     if (NS4) {obj.visibility = (bVis) ? "show" : "hide";} else {obj.style.visibility = (bVis) ? "visible" : "hidden";}
  74.     obj.activeId = null;
  75.     }
  76.  
  77. function onItemClick()
  78.     {
  79.     if (sepFrame && openSameFrame)
  80.         {
  81.         if (IE4){cntPage = eval("parent.frames."+cntFrame); cntPage.location.href=this.itemLink;}
  82.         omo=mout;mout=false;bMenuActive=false;
  83.         if (activeMenu) {activeMenu.bActive=false;itemId=activeMenu;closeMenu(itemId);}
  84.         mout=omo;
  85.         }
  86.     else if (IE4){contentPage.location.href = this.itemLink;}
  87.     prevActiveItem = null ;
  88.     }
  89.  
  90. function onDocClick()
  91.     {
  92.     if (!bMenuActive && activeMenu!=null && !activeMenu.bActive)
  93.         {
  94.         itemId = activeMenu;
  95.         closeMenu(itemId);
  96.         }
  97.     prevActiveItem = null ;
  98.     }
  99. function onUnloadNS() {loadStatus = 0;}
  100. function onLoadNS(e) {if (e.target.name == contentFrame) {onReady(); onCreate();} }
  101. function onUnloadIE() {onReady(); loadStatus = 0; setTimeout("waitReady()",50);}
  102.  
  103. function onOver(e)
  104.     {
  105.     this.bActive = true;
  106.     bMenuActive = true;
  107.     activeMenu = this;
  108.     if (this.collapseTime)
  109.         {
  110.         clearTimeout(this.collapseTime);
  111.         this.collapseTime=null;
  112.         }
  113.     }
  114.  
  115. function onOut()
  116.     {
  117.     if (IE4)
  118.         {
  119.         ev = contentPage.event;
  120.         if (ev.srcElement.contains(ev.toElement)) return;
  121.         }
  122.     this.bActive = false;
  123.     bMenuActive = false;
  124.     contentPage.status = "";
  125.     if (mout) smCollapseTime = setTimeout("closeMenu(activeMenu)",10);  
  126.     }
  127.  
  128. function onOverItem()
  129.     {
  130.     if (IE4)
  131.         {
  132.         ev = contentPage.event;
  133.         if (ev.srcElement.tagName == "IMG") return;
  134.         this.style.backgroundColor = this.brCont.itemHlBgCol;
  135.         this.style.color = this.brCont.fontHlCol;
  136.         }
  137.     else
  138.         {
  139.         this.bgColor = this.brCont.itemHlBgCol;
  140.         this.itemLayer.document.write(this.innerHlTag);
  141.         this.itemLayer.document.close();
  142.         }
  143.     contentPage.status = this.itemLink;
  144.     this.brCont.activeId = this;
  145.     if (this.brCont.bExp) closeSubmenus(this.brCont,this);
  146.     if (this.bParent)
  147.         {
  148.         horOffset = (this.brCont.popupWidth - this.brCont.levelOffset);
  149.         if (NS4)
  150.             {
  151.             this.childX = this.brCont.left + horOffset;
  152.             this.childY = (this.pageY+this.clip.top) + 6;
  153.             }
  154.         else
  155.             {
  156.             this.childX = this.brCont.style.pixelLeft + horOffset;
  157.             this.childY = this.offsetTop + this.brCont.style.pixelTop + 6 + bord;
  158.             }
  159.         this.child.moveTo(this.childX,this.childY);
  160.         ensureVisib(this.child);
  161.         this.brCont.bExp = true;
  162.         this.brCont.visibleChild = this.child;
  163.         chgVisib(this.child, true);
  164.         }
  165.     }
  166.  
  167. function onItemOut()
  168.     {
  169.     if (IE4)
  170.         {
  171.         ev = contentPage.event;
  172.         if (ev.srcElement.contains(ev.toElement) || (ev.fromElement.tagName=="IMG" && ev.toElement.contains(ev.fromElement))) return;
  173.         this.style.backgroundColor = this.brCont.itemBgCol;
  174.         this.style.color = this.brCont.fontCol;
  175.         }
  176.     else
  177.         {
  178.         this.bgColor = this.brCont.itemBgCol;
  179.         with (this.itemLayer.document)
  180.             {
  181.             write(this.innerTag);
  182.             close();
  183.             }
  184.         if (!bMenuActive && mout)
  185.             smCollapseTime = setTimeout("closeMenu(activeMenu)",10); 
  186.         }
  187.     }
  188.  
  189. function onReady()
  190.     {
  191.     if(readyStatus)
  192.         {
  193.         for(i=1; i<lev0menus; i++)
  194.             {
  195.             cur = eval("mnu"+i);
  196.             clearTimeout(cur.collapseTime);
  197.             cur.collapseTime=null;
  198.             }
  199.         clearTimeout(smCollapseTime);
  200.         }
  201.     lev0menus = 1;
  202.     readyStatus = 0;
  203.     createStatus = 0;
  204.     bMenuActive = false;
  205.     activeMenu = null;
  206.     smCollapseTime = null;
  207.     }
  208.  
  209. function onCreate()
  210.     {
  211.     loadStatus = 1;
  212.     if (sepFrame)
  213.         {
  214.         contentPage = eval("parent.frames." + contentFrame);
  215.         if (NS4)
  216.             {
  217.             brPage.captureEvents(Event.LOAD);
  218.             brPage.onload = onLoadNS;
  219.             contentPage.onunload = onUnloadNS;
  220.             }
  221.         if (IE4) contentPage.document.body.onunload = onUnloadIE;
  222.         }
  223.     else
  224.         {
  225.         contentPage = window;
  226.         }
  227.     contentPage.nav = window;
  228.     if (!mout)
  229.         {
  230.         if (NS4) contentPage.document.captureEvents(Event.MOUSEDOWN);
  231.         contentPage.document.onmousedown = onDocClick;
  232.         }
  233.     createStatus = 1;
  234.     if(IE4)
  235.         {
  236.         topZ = 0;
  237.         for (z=0;z<contentPage.document.all.length;z++)
  238.             {
  239.             oldEl = contentPage.document.all(z);
  240.             topZ = Math.max(oldEl.style.zIndex,topZ)
  241.             }
  242.         }
  243.     while(eval("window.mn" + lev0menus))
  244.         {
  245.         if (NS4) {createNS(0,false,lev0menus);} else {createIE(0,false,lev0menus);}
  246.         lev0menus++
  247.         }
  248.     status = ""
  249.     readyStatus = 1;
  250.     createStatus = 0;
  251.     }
  252.  
  253. function waitReady()
  254.     {
  255.     if (contentPage.document.readyState == "complete")
  256.         {
  257.         onReady();
  258.         onCreate();
  259.         }
  260.     else
  261.         {
  262.         setTimeout("waitReady()",50);
  263.         }
  264.     }
  265.  
  266. function setMenuTree(obj,bPopup,mnuPar)
  267.     {
  268.     if (obj.lev > maxlev) {levArr = eval ("lev" + maxlev) ;} else {levArr = eval ("lev" + obj.lev) ;}
  269.     obj.popupWidth = popupWidth ;
  270.     obj.fontCol = levArr [4] ;
  271.     obj.fontHlCol = levArr [6] ;
  272.     obj.itemBgCol = levArr [5] ;
  273.     obj.itemHlBgCol = levArr [8] ;
  274.     obj.popupBorderCol = borderCol ;
  275.     if (!bPopup)
  276.         {
  277.         obj.rootId = obj ;
  278.         obj.first = obj ;
  279.         }
  280.     else
  281.         {
  282.         obj.rootId = mnuPar.rootId ;
  283.         }
  284.     obj.itemCount = obj.array.length/3;
  285.     obj.bPopup = bPopup;
  286.     obj.itemIter = 0;
  287.     }
  288.  
  289. function createIE(lev,bPopup,mnuId,mnuPar)
  290.     {
  291.     menu = createMenuTag("mnu" + mnuId);
  292.     menu.array = eval("mn" + mnuId);
  293.     menu.lev=lev;
  294.     setMenuTree(menu,bPopup,mnuPar);
  295.     menu.itemTag = "";
  296.     while (menu.itemIter < menu.itemCount)
  297.         {
  298.         menu.itemIter++;
  299.         if (++stPos == stStr.length) stPos = 0 ;
  300.         status = "Loading menu... " + stStr [stPos] ;
  301.         curId = "item" + mnuId + "_" + menu.itemIter;
  302.         nMnuItem = (menu.itemIter-1)*3 ;
  303.         itemText = menu.array[nMnuItem];
  304.         bParent = menu.array[nMnuItem + 2];
  305.         if(mac)
  306.             {
  307.             addText = contentPage.document.createElement("SPAN");
  308.             with(addText)
  309.                 {
  310.                 id = curId;
  311.                 with(style)
  312.                    {
  313.                    width = (menu.popupWidth-(bord*2));
  314.                    fontSize = 10;
  315.                    fontWeight = "normal";
  316.                    fontStyle =    "normal";
  317.                    fontFamily = "Arial";
  318.                    padding = vertSpace;
  319.                    }
  320.                 innerHTML = itemText;
  321.                 }
  322.             addLine = contentPage.document.createElement("BR");
  323.             menu.appendChild(addText);
  324.             menu.appendChild(addLine);
  325.             if(bParent)
  326.                {
  327.                addIm=contentPage.document.createElement("IMAGE");
  328.                with(addIm)
  329.                   {
  330.                   src=unescape(absPath)+"img/sxicona.gif";
  331.                   with(style)
  332.                      {
  333.                      position="absolute";
  334.                      width=8;
  335.                      height=8;
  336.                      left=addText.style.pixelWidth-vertSpace-8;
  337.                      top=addText.offsetTop+vertSpace;
  338.                      }
  339.                   }
  340.                addText.appendChild(addIm);
  341.                }
  342.             }
  343.         else
  344.             {
  345.             innerTag = (bParent) ? iconTag + itemText : itemText;
  346.             menu.itemTag += "<SPAN ID=" + curId + " STYLE=\"width:" + (menu.popupWidth-(bord*2)) + "\">" + innerTag + "</SPAN><BR>";
  347.             }
  348.         if (bParent)
  349.             {
  350.             createIE(lev+1,true,mnuId + "_" + menu.itemIter,menu);
  351.             menu = menu.parentMenu;
  352.             }    
  353.         }
  354.     if (!mac)
  355.         menu.innerHTML = menu.itemTag;
  356.     spanArray = menu.children.tags("SPAN");
  357.     for (i=0; i<spanArray.length; i++)
  358.         {
  359.         it = spanArray(i);
  360.         createSingleItem(it,i+1,menu.array);
  361.         }
  362.     menu.lastId = spanArray(spanArray.length-1);
  363.     createItemArr(menu,bPopup,mnuPar);
  364.     }
  365.  
  366. function createNS(lev,bPopup,mnuId,mnuPar,parId)
  367.     {
  368.     tempArray = eval("mn" + mnuId);
  369.     if (!bPopup) {menu = createMenuTag("mnu" + mnuId,popupWidth,null,null);} else {menu = createMenuTag("mnu" + mnuId,null,mnuPar,null);}
  370.     menu.lev=lev;
  371.     menu.array = tempArray;
  372.     setMenuTree(menu,bPopup,mnuPar);
  373.     while (menu.itemIter < menu.itemCount)
  374.         {
  375.         menu.itemIter++;
  376.         if (++stPos == stStr.length) stPos = 0 ;
  377.         status = "Loading menu... " + stStr [stPos] ;
  378.         prevId = (menu.itemIter > 1) ? menu.item : null;
  379.         curId = "item" + mnuId + "_" + menu.itemIter;
  380.         menu.item = createMenuTag(curId,null,null,menu);
  381.         menu.item.prevId = prevId;
  382.         createSingleItem(menu.item,menu.itemIter,menu.array);
  383.         if (menu.item.bParent)
  384.             {
  385.             createNS(lev+1,true,mnuId + "_" + menu.itemIter,menu,menu.item);
  386.             menu = menu.parentMenu;
  387.             }
  388.         }
  389.     menu.lastId = menu.item;
  390.     createItemArr(menu,bPopup,mnuPar,parId);
  391.     }
  392.  
  393. function createMenuTag(itemId,itemWidth,parentId,conId)
  394.     {
  395.     if (NS4)
  396.         {
  397.         if (itemWidth)
  398.             {
  399.             elWidth = itemWidth;
  400.             }
  401.         else
  402.             {
  403.             elWidth = (conId) ? conId.popupWidth : parentId.popupWidth;
  404.             if (conId) elWidth = elWidth-(bord*2)-(vertSpace*2);
  405.             }
  406.         if (!conId) conId = contentPage;
  407.         eval(itemId + "= new Layer(elWidth,conId)");
  408.         }
  409.     else if (mac)
  410.         {
  411.         addTag = contentPage.document.createElement ("DIV");
  412.         addTag.id = itemId;
  413.         addTag.style.position = "absolute";
  414.         contentPage.document.body.appendChild(addTag);
  415.         }
  416.     else
  417.         {
  418.         elStr = "<DIV ID=" + itemId + " STYLE='position:absolute'></DIV>";
  419.         contentPage.document.body.insertAdjacentHTML("BeforeEnd",elStr);
  420.         if (sepFrame && !openSameFrame) eval(itemId + "= contentPage." + itemId);
  421.         }
  422.     return eval(itemId);
  423.     }
  424.  
  425. function createSingleItem(obj,itemId,arr)
  426.     {
  427.     if (mac)
  428.         {
  429.         if (obj.id.indexOf ("item")==-1)
  430.             return ;
  431.         }
  432.     obj.onmouseover = onOverItem;
  433.     obj.onmouseout = onItemOut;
  434.     obj.brCont = (NS4) ? obj.parentLayer : obj.parentElement;
  435.     nMnuItem = (itemId-1)*3;
  436.     obj.itemText = arr[nMnuItem];
  437.     obj.itemLink = arr[nMnuItem + 1];
  438.     obj.bParent = arr[nMnuItem + 2];
  439.     if (IE4 && obj.bParent)
  440.         {
  441.         obj.child = eval("mnu" + obj.id.substr(4));
  442.         obj.child.parentMenu = obj.brCont;
  443.         obj.child.parentItem = obj;
  444.         }
  445.     if (obj.itemLink)
  446.         {
  447.         if (NS4)
  448.             {
  449.             obj.captureEvents(Event.MOUSEUP)
  450.             obj.onmouseup = onItemClick;
  451.             }
  452.         else
  453.             {
  454.             obj.onclick = onItemClick;
  455.             obj.style.cursor = "hand";
  456.             }
  457.         }
  458.     if (obj.brCont.lev > maxlev) {levArr = eval ("lev" + maxlev) ;} else {levArr = eval ("lev" + obj.brCont.lev) ;}
  459.     fontSizeNS = levArr [1] ;
  460.     fontSizeIE = levArr [0] ;
  461.     fontB = levArr [2] ;
  462.     fontI = levArr [3] ;
  463.     fontFace = levArr [7] ;
  464.     if (NS4)
  465.         {
  466.         innerTag = obj.itemText;
  467.         if (fontB) innerTag = innerTag.bold();
  468.         if (fontI) innerTag = innerTag.italics();
  469.         innerTag = "<FONT FACE='" + fontFace + "' SIZE=" + fontSizeNS + ">" + innerTag+ "</FONT>";
  470.         if (obj.itemLink)
  471.             {
  472.             with (obj.document)
  473.                 {
  474.                 linkColor = obj.brCont.fontCol ;
  475.                 alinkColor = obj.brCont.fontCol ;
  476.                 vlinkColor = obj.brCont.fontCol ;
  477.                 }
  478.             cmna = "<a ";
  479.             if (sepFrame && openSameFrame) cmna += "target='"+cntFrame+"' ";
  480.             cmna += "style='text-decoration:none' href='" + obj.itemLink + "'>";
  481.             obj.innerHlTag = innerTag.fontcolor (obj.brCont.fontHlCol);
  482.             obj.innerHlTag = cmna+obj.innerHlTag+"</a>";
  483.             obj.innerTag = cmna + innerTag + "</a>";
  484.             }
  485.         else
  486.             {
  487.             obj.innerHlTag = innerTag.fontcolor(obj.brCont.fontHlCol);
  488.             obj.innerTag = innerTag.fontcolor(obj.brCont.fontCol);
  489.             }
  490.         obj.innerTag = (obj.bParent) ? iconTag + obj.innerTag : obj.innerTag ;
  491.         obj.innerHlTag = (obj.bParent) ? (iconTag + obj.innerHlTag) : obj.innerHlTag ;
  492.         obj.visibility = "inherit";
  493.         obj.bgColor = obj.brCont.itemBgCol;
  494.         if (itemId == 1) {obj.top = bord + vertSpace;} else {obj.top = obj.prevId.top + obj.prevId.clip.height + sep;}
  495.         obj.left = bord + vertSpace;
  496.         obj.clip.top = obj.clip.left = -vertSpace;
  497.         obj.clip.right = obj.brCont.popupWidth-(bord*2)-vertSpace;
  498.         itemWidth = obj.brCont.popupWidth-(bord*2)-(vertSpace*2);
  499.         if (obj.brCont.isTree) itemWidth-=(iconSize); 
  500.         obj.itemLayer = new Layer(itemWidth,obj);
  501.         obj.itemLayer.document.write(obj.innerTag);
  502.         obj.itemLayer.document.close();
  503.         obj.itemLayer.document.tags.A.textDecoration = "none" ;
  504.         obj.itemLayer.visibility = "inherit";
  505.         obj.clip.bottom = obj.itemLayer.document.height+vertSpace;
  506.         }
  507.     else
  508.         {
  509.         with (obj.style)
  510.             {
  511.             if (obj.brCont.isTree && (mac||(!mac && !obj.bParent))) paddingRight = vertSpace+iconSize;
  512.             color = obj.brCont.fontCol;
  513.             if(!mac)
  514.                 {
  515.                 fontSize = fontSizeIE;
  516.                 fontWeight = (fontB) ? "bold" : "normal";
  517.                 fontStyle = (fontI) ? "italic" : "normal";
  518.                 fontFamily = fontFace;
  519.                 padding = vertSpace;
  520.                 }
  521.             borderBottomWidth = sep + "px";
  522.             borderBottomColor = "black";
  523.             borderBottomStyle = "solid";
  524.             backgroundColor = obj.brCont.itemBgCol;
  525.             }
  526.         }
  527.     }    
  528.  
  529. function moveTo(xPos,yPos)
  530.     {
  531.     this.style.pixelLeft = xPos;
  532.     this.style.pixelTop = yPos;
  533.     }
  534.  
  535. function expandMenu(menuId,e,dItem)
  536.     {
  537.     if (NS4 && brSizeChg) onCreate();
  538.     if (IE4) se = event.srcElement;
  539.     if (!loadStatus) return;
  540.     activeItem = (NS4) ? e.target : se;
  541.     if (dItem != prevActiveItem) {prevActiveItem = dItem ;} else {return ;}
  542.     if (!createStatus && !readyStatus) onCreate();
  543.     activeItem.menuId = menuId;    
  544.     if (!loadStatus || !readyStatus) return true;
  545.     eType = (NS4) ? e.type : event.type;
  546.     for(i=1; i<lev0menus; i++)
  547.         {
  548.         temp = eval("mnu" + i + ".first");
  549.         temp.bActive = false;
  550.         if (temp.bExp) closeSubmenus(temp);
  551.         chgVisib(temp, false);
  552.         }    
  553.     activeItem = (NS4) ? e.target : se;
  554.     activeMenu = eval(activeItem.menuId);
  555.     activeMenu.bPopup = false;
  556.     activeMenu.rootId.first = activeMenu;
  557.     if (activeMenu.collapseTime)
  558.         {
  559.         clearTimeout (activeMenu.collapseTime);
  560.         activeMenu.collapseTime=null;
  561.         }
  562.     if (NS4) setNSXY (dItem); else setIEXY (dItem);
  563.     if (!sepFrame || openSameFrame)
  564.         {
  565.         xPos=newpx;
  566.         yPos=newpy;
  567.         }
  568.     else
  569.         {
  570.         switch (menuPos)
  571.             {
  572.             case 0:
  573.                 xPos = (NS4) ? contentPage.pageXOffset : contentPage.document.body.scrollLeft;
  574.                 yPos = (NS4) ? newpy + contentPage.pageYOffset : newpy + contentPage.document.body.scrollTop;
  575.                 break;
  576.             case 1:
  577.                 xPos = (NS4) ? contentPage.pageXOffset+contentPage.innerWidth : contentPage.document.body.scrollLeft+contentPage.document.body.clientWidth;
  578.                 yPos = (NS4) ? newpy+contentPage.pageYOffset : newpy + contentPage.document.body.scrollTop;
  579.                 break;
  580.             case 2:
  581.                 xPos = (NS4) ? newpx+contentPage.pageXOffset : newpx + contentPage.document.body.scrollLeft;
  582.                 yPos = (NS4) ? contentPage.pageYOffset : contentPage.document.body.scrollTop;
  583.                 break;
  584.             case 3:
  585.                 xPos = (NS4) ? newpx+contentPage.pageXOffset : newpx + contentPage.document.body.scrollLeft;
  586.                 yPos = (NS4) ? contentPage.pageYOffset+contentPage.innerHeight : contentPage.document.body.scrollTop + contentPage.document.body.clientHeight;
  587.                 break;
  588.             }
  589.         }
  590.     activeMenu.moveTo(xPos,yPos);
  591.     ensureVisib(activeMenu);
  592.     activeMenu.bActive = true;
  593.     chgVisib(activeMenu,true);
  594.     return false;
  595.     }
  596.  
  597. function ensureVisib(obj)
  598.     {
  599.     botScrBar = (sepFrame && !openSameFrame && menuPos==3) ? (bord*2) : 20;
  600.     rtScrBar = (sepFrame && !openSameFrame && menuPos==1) ? (bord*2) : 20;
  601.     if (NS4)
  602.         {
  603.         winRight = (contentPage.pageXOffset + contentPage.innerWidth) - rtScrBar;
  604.         rightPos = obj.left + obj.popupWidth;
  605.         if (rightPos > winRight)
  606.             {
  607.             if (obj.bPopup)
  608.                 {
  609.                 parentLeft = obj.parentMenu.left;
  610.                 newLeft = ((parentLeft-obj.popupWidth) + obj.levelOffset);
  611.                 obj.left = newLeft;
  612.                 }
  613.             else
  614.                 {
  615.                 dif = rightPos - winRight;
  616.                 obj.left -= dif;
  617.                 }
  618.             }
  619.         winBot = (contentPage.pageYOffset + contentPage.innerHeight) - botScrBar ;
  620.         botPos = obj.top + obj.fullHeight;
  621.         if (botPos > winBot)
  622.             {
  623.             dif = botPos - winBot;
  624.             obj.top -= dif;
  625.             }
  626.         winLeft = contentPage.pageXOffset;
  627.         leftPos = obj.left;
  628.         if (leftPos < winLeft)
  629.             {
  630.             if (obj.bPopup)
  631.                 {
  632.                 parentLeft = obj.parentMenu.left;
  633.                 newLeft = ((parentLeft+obj.popupWidth) - obj.levelOffset);
  634.                 obj.left = newLeft;
  635.                 }
  636.             else
  637.                 {
  638.                 obj.left = 5;
  639.                 }
  640.             }
  641.         }
  642.     else
  643.         {
  644.         winRight = (contentPage.document.body.scrollLeft + contentPage.document.body.clientWidth) - rtScrBar;
  645.         rightPos = obj.style.pixelLeft + obj.popupWidth;
  646.         if (rightPos > winRight)
  647.             {
  648.             if (obj.bPopup)
  649.                 {
  650.                 parentLeft = obj.parentMenu.style.pixelLeft;
  651.                 newLeft = ((parentLeft - obj.popupWidth) + obj.levelOffset);
  652.                 obj.style.pixelLeft = newLeft;
  653.                 }
  654.             else
  655.                 {
  656.                 dif = rightPos - winRight;
  657.                 obj.style.pixelLeft -= dif;
  658.                 }
  659.             }
  660.         winBot = (contentPage.document.body.scrollTop + contentPage.document.body.clientHeight) - botScrBar;
  661.         botPos = obj.style.pixelTop + obj.fullHeight;
  662.         if (botPos > winBot)
  663.             {
  664.             dif = botPos - winBot;
  665.             obj.style.pixelTop -= dif;
  666.             }
  667.         winLeft = contentPage.document.body.scrollLeft;
  668.         leftPos = obj.style.pixelLeft;
  669.         if (leftPos < winLeft)
  670.             {
  671.             if (obj.bPopup)
  672.                 {
  673.                 parentLeft = obj.parentMenu.style.pixelLeft;
  674.                 newLeft = ((parentLeft+obj.popupWidth) - obj.levelOffset);
  675.                 obj.style.pixelLeft = newLeft;
  676.                 }
  677.             else
  678.                 {
  679.                 obj.style.pixelLeft = 5;
  680.                 }
  681.             }
  682.         }
  683.     }
  684.  
  685. function collapseMenu(menuId)
  686.     {
  687.     if (!loadStatus || !readyStatus) return;
  688.     itemId = eval(menuId);
  689.     itemId.bActive = false;
  690.     if (mout) closePopup(itemId);
  691.     }
  692.  
  693. function closeMenu(obj)
  694.     {
  695.     smCollapseTime = null;
  696.     if (bMenuActive) return;
  697.     if (obj.bExp) closeSubmenus(obj);
  698.     tempMenu = obj;
  699.     while (tempMenu.bPopup)
  700.         {
  701.         chgVisib(tempMenu,false);
  702.         tempMenu.parentMenu.bActive = false;        
  703.         tempMenu = tempMenu.parentMenu;
  704.         }
  705.     closePopup(tempMenu);
  706.     }
  707.  
  708. function tf(oldToCnt)
  709.     {
  710.     if (oldToCnt!=toCnt)
  711.         return ;
  712.     closeItem(hideId);
  713.     hideId.collapseTime=null;
  714.     prevActiveItem = null ;
  715.     }
  716.  
  717. function closePopup(obj)
  718.     {
  719.     hideId = obj;
  720.     if(!mout)
  721.         {
  722.         closeItem(hideId);
  723.         }
  724.     else
  725.         {
  726.         if (obj.collapseTime)
  727.             clearTimeout (obj.collapseTime);
  728.         if (toCnt++ >= 1000)
  729.             toCnt = 0 ;
  730.         obj.collapseTime = setTimeout("tf("+toCnt+")",1000);
  731.         }
  732.     }
  733.  
  734. function closeSubmenus(obj,item)
  735.     {
  736.     tempMenu = obj.visibleChild;
  737.     while (tempMenu.bExp)
  738.         {
  739.         chgVisib(tempMenu.visibleChild,false);
  740.         tempMenu.bExp = false;
  741.         tempMenu = tempMenu.visibleChild;
  742.         }
  743.     if (!obj.bActive || !obj.bParent || obj.visibleChild != obj.child)
  744.         {
  745.         chgVisib(obj.visibleChild,false);
  746.         obj.bExp = false;
  747.         }
  748.     }
  749.  
  750. function cancelSelect(){return false}
  751. function reDo()
  752.     {
  753.     if (brPage.innerWidth==startWidth && brPage.innerHeight==startHeight) return;
  754.     onReady();
  755.     brSizeChg=true;
  756.     contentPage.location.reload();
  757.     }
  758.  
  759. function createItemArr(obj,bPopup,parMnu,parId)
  760.     {
  761.     obj.onmouseover = onOver;
  762.     obj.onmouseout = onOut;
  763.     obj.bExp = false;
  764.     obj.bActive = false;
  765.     obj.collapseTime = null;
  766.     obj.levelOffset = levelOffset;
  767.     obj.activeId = null;
  768.     if (bPopup)
  769.         {
  770.         obj.bPopup = true;
  771.         obj.parentMenu = parMnu;
  772.         if (NS4)
  773.             {
  774.             obj.parentItem = parId;
  775.             obj.parentItem.child = obj;
  776.             }
  777.         }
  778.     else
  779.         {
  780.         obj.bPopup = false;
  781.         }
  782.     if (NS4)
  783.         {
  784.         obj.bgColor = obj.popupBorderCol;
  785.         obj.fullHeight = obj.lastId.top + obj.lastId.clip.bottom + bord;
  786.         obj.clip.right = obj.popupWidth;
  787.         obj.clip.bottom = obj.fullHeight;
  788.         }
  789.     else
  790.         {
  791.         if(!mac)
  792.             {
  793.             with (obj.style)
  794.                 {
  795.                 width = obj.popupWidth;
  796.                 borderWidth = bord;
  797.                 borderColor = obj.popupBorderCol;
  798.                 borderStyle = "solid";
  799.                 }
  800.             }
  801.         zIndex = topZ;
  802.         obj.lastId.style.border="";
  803.         obj.fullHeight = obj.offsetHeight;
  804.         if (mac)
  805.             obj.style.pixelHeight=obj.fullHeight;
  806.         chgVisib(obj,false);
  807.         obj.onselectstart = cancelSelect;
  808.         obj.moveTo = moveTo;
  809.         obj.moveTo(0,0);
  810.         }
  811.     }
  812.  
  813. function closeItem(obj)
  814.     {
  815.     if (obj.collapseTime)
  816.         {
  817.         clearTimeout (obj.collapseTime);
  818.         obj.collapseTime=null;
  819.         }
  820.     if (!obj.bActive && !bMenuActive)
  821.         chgVisib(obj,false);
  822.     }
  823.  
  824. function setIEXY (dItem)
  825.     {
  826.     divColl = document.all.tags ("DIV")
  827.     dItemEl = divColl [dItem] ;
  828.     if (menuHorizontal) {newpy = dItemEl.offsetHeight + popupOffset ;newpx=0;} else {newpx = dItemEl.offsetWidth + popupOffset ;newpy=0;}
  829.     if (version < 5 || mac)
  830.         {
  831.         newpx += dItemEl.offsetLeft ;
  832.         newpy += dItemEl.offsetTop ;
  833.         while (dItemEl.offsetParent)
  834.             {
  835.             if (dItemEl.offsetParent == dItemEl || dItemEl.offsetParent == document.body) break ;
  836.             newpx += dItemEl.offsetParent.offsetLeft ;
  837.             newpy += dItemEl.offsetParent.offsetTop ;
  838.             dItemEl = dItemEl.offsetParent ;
  839.             }
  840.         }
  841.       else
  842.         {
  843.         r = dItemEl.getBoundingClientRect();
  844.         newpx += r.left;
  845.         newpy += r.top ;
  846.         }
  847.     }
  848.  
  849. function setNSXY (dItem)
  850.     {
  851.     dItemEl = document.layers[dItem];
  852.     newpx = dItemEl.pageX ;
  853.     newpy = dItemEl.pageY ;
  854.     if (menuHorizontal) {newpy += dItemEl.document.height + popupOffset ;} else {newpx += dItemEl.document.width + popupOffset ;}
  855.     }
  856.  
  857. //-->
  858.