/* external js file for top main navigation and quick access $Source: /usr/cvs/eMB/Clickstream_DCVD/js/nav2_nav3.js,v $ $Revision: 1.1 $ Check-In $Date: 2002/10/08 10:14:32 $ */ var arraysReady = false; // mainnavi var defaultHeight = 21; // default WhiteLayer-Height for NS4, only NS4 needs this var sumOfWidthes = 0; // sum of width of first level main navigation var resetMainMenu = true; // flag for idle handler so that showMenu is just called first time // mainnavi & quickAccess var mainnaviX, mainnaviY, mnMaxX; // coordinates for mousemove-eventhandler var extremeGmBonus = 10; // QuickAccess var lastActiveQaTab = -1; // flag to avoid senseless function calls var numberOfQaTabs; var qasubheight = 0; var qaLevel1Height = 16; var qaStartX = 0; var qaOverAllWidth = 300; // for qa 1st level highlight in ns4.x var resetQuickAccess = true; // flag for idle handler so that showQuickAccess is just called first time var lockQASearch = false; // flag to lock QuickAccess when in focus // sets coordinates for the mousemove-Event-handlers function setupCoordsAndArrays(){ if (bNav3InPage){ mainNavigationLayer = new eMBLayer( "mnv" ); mnSecondLevelBgLayer = new eMBLayer( "mnsub00" ); whiteLayer = new eMBLayer( "whiteNavLayer" ); naviMainUnderLine = new eMBLayer( "mnul" ); allNavLayerObjects = new Array( allNavLayer.length ); for (var i=0; i allMenu1LayersObjects[i].getWidth() ){ secondLevelXposition = currentXPosition + allNavLayerObjects[i].getWidth() - allMenu1LayersObjects[i].getWidth(); } else{ secondLevelXposition = -4 ; if (NS && allMenu1LayersObjects[i].isObject()) allMenu1LayersObjects[i].object.document.images[0].src = "/img/1pix.gif"; else if (document.images["nav3subedge"+i]) document.images["nav3subedge"+i].src = "/img/1pix.gif"; } allMenu1LayersObjects[i].setX( secondLevelXposition ); } sumOfWidthes = allNavLayerObjects[allNavLayerObjects.length-1].getX() + allNavLayerObjects[allNavLayerObjects.length-1].getWidth(); setupWhiteLayer(activeTab); naviMainUnderLine.setSize ( sumOfWidthes, 1 ); mainNavigationLayer.show(); // fix for first time loading NS4 (collapsing top navigation) if (document.layers){ /* may cause Problems, if there's only 1 topic in the topnavigation */ if ( allNavLayerObjects[allNavLayerObjects.length-1].getX()< 1 ){ DHTML_init(); setTimeout("setMenuLayerPositions()", 100); } } } function setQaTabPositions(){ if (!bNav2InPage) return true; if (IE4) setupQaTabWidthesForIE4(); var currentX = qaOverAllWidth; for (var i=allQuickAccessTabsObjects.length-1; i>=0; i--){ currentX -= allQuickAccessTabsObjects[i].getWidth(); allQuickAccessTabsObjects[i].setX( currentX ); allQuickAccessTabsObjects[i].show(); } qaBgLayer.setX( currentX ); qaBgTabLayer.setX( currentX + 1 ); qaBgLayer.setSize( qaOverAllWidth-1 - currentX, 15 ); qaBgTabLayer.setSize( qaOverAllWidth - currentX - 2 , 1 ); // "-2" for 'rounded' qa-corners qaStartX = currentX; if (NS) qaLayer.setSize( qaOverAllWidth, qaLevel1Height ); else if ( MAC && MS ) qaLayer.object.style.clip = "rect( 0px "+qaOverAllWidth+"px "+qaLevel1Height+"px 0px )"; } // positioning the white tab for highlightning the first level of main navigation // called by onmouseover on tab element function setupWhiteLayer(activeTabLayer){ if (activeTabLayer==0) { whiteLayer.hide(); return true; } // needed if screen has no default tab active if ((activeTab==0) && (activeTabLayer!=0)){ whiteLayer.show(); } // needed if screen has no default tab active whiteLayer.setX( allNavLayerObjects[activeTabLayer-1].getX() ); whiteLayer.setSize( allNavLayerObjects[activeTabLayer-1].getWidth(), defaultHeight ); } // workaround just for IE4: sets initial default widthes for first level tabs // just called on initialisation function setupNavLayerWidthesForIE4(){ if (!IE4) return; var w = 0; for (i=0; i mainnaviX+sumOfWidthes || coordY < mainnaviY || coordY > mainnaviY+20)) showMenuFlag=false; // check first level else if( !(coordX < mainnaviX || coordX > mnMaxX || coordY <= mainnaviY+20 || coordY > mainnaviY+20+20+extremeGmBonus)) showMenuFlag=false; // check second level if( !(coordX < 470-gmBonus || coordX > mnMaxX+gmBonus || coordY < 0 || coordY > qasubheight+4+gmBonus) ) showQuickAccessFlag=false; // check quick access if (showMenuFlag==true) showMenu(""); // execute showMenu if (showQuickAccessFlag==true && resetQuickAccess==true) { if (!lockQASearch) showQuickAccess( -1 ); // close QuickAccess only when no focus on Search-Field //showQuickAccess( -1 ); // close QuickAccess } } // initializing event handling for catching mousemove-events // this function is responsible for recognizing mouse-outs function Event_init() { if(!MS) { if (DOM && !OP) window.onunload=Event_quit; // for NS6 else if (NS) document.captureEvents(Event.MOUSEMOVE); document.onmousemove=handleMove; } else if ( !IE4 && !MAC ) document.getElementsByTagName("html")[0].onmousemove=handleMove; else document.all.tags("body")[0].onmousemove=handleMove; } // deactivate event-handler of site on unload. For NS6 to avoid senseless errorreports function Event_quit(ev){ if (DOM){ document.getElementsByTagName("body")[0].removeEventListener("mousemove", handleMove, true); document.onmousemove=null; } } // activate tab in QuickAccess function activateQuickAccessTab( activeQaTab, show ){ if ( activeQaTab >= 0 ) { if (show==true){ if (NS) qaLayer.setSize( qaOverAllWidth, 100 ); else if ( MAC && MS ) qaLayer.object.style.clip = "rect( 0px "+qaOverAllWidth+"px 100px 0px )"; qaHighlightLayer.setX( allQuickAccessTabsObjects[activeQaTab].getX() ); qaHighlightLayer.setSize( allQuickAccessTabsObjects[activeQaTab].getWidth(), allQuickAccessTabsObjects[activeQaTab].getHeight() ); qaBgLayer.setBgColor("#e4e4e4"); // this layer makes all tabs which are NOT shown to darker gray qaHighlightLayer.show(); if ( DOM && !OP && !MS) setTimeout("changeQaTabArrow("+ activeQaTab +", true )", 1); // needed for NS6 to avoid flicker else changeQaTabArrow( activeQaTab, true ); if ( activeQaTab!=0 ) changeQaTabLine( activeQaTab, true ); } else { if (NS) qaLayer.setSize( qaOverAllWidth, qaLevel1Height ); else if ( MAC && MS ) qaLayer.object.style.clip = "rect( 0px "+qaOverAllWidth+"px "+qaLevel1Height+"px 0px )"; qaHighlightLayer.hide(); qaBgLayer.setBgColor("#f0f0f0"); for (var i=0; i=0) imageObject.src = "/img/"+(on?"1pix":"1pix_gray_c1")+".gif"; } // changes qa level one arrows IF NESSESARY function changeQaTabArrow( nr, on ){ var imageObject = null; if (NS){ if (!allQuickAccessTabsObjects[nr].isObject() ) return true; imageObject = allQuickAccessTabsObjects[nr].object.document.images[1]; } else if (MS || DOM) imageObject = document.images["qaarrow0"+nr]; if (imageObject && imageObject.src.search("quickacc_o"+((!on)?"n":"ff")+".gif")>=0) imageObject.src = "/img/nav/quickacc_o"+((on)?"n":"ff")+".gif"; } // showQuickAccess is called when rollover/click on quickaccesstabs is performed // qaLayerNum is the number of the Layer which has to be shown // qaLayerNum is empty if called by handlemove/MShandlemove handler function showQuickAccess( qaLayerNum ) { if (!bNav2InPage) return true; if (!arraysReady) setupCoordsAndArrays(); if (lastActiveQaTab==qaLayerNum) return true; // after first time calling showQuickAccess resetQuickAccess is false, // so an showQuickAccess(-1) call (made by handlemove/MShandlemove handler) will just one time lead to an complete execution of showQuickAccess if ( (resetQuickAccess == false) && (qaLayerNum==-1) ) { return true; } else { // this reset to true is always executed if an call with an parameter other than "" is executed resetQuickAccess = true; } for (i=0; i=0 && qaLayerNum < numberOfQaTabs) { qaLayerObject.show(); qasubheight = qaLayerObject.getHeight()+qaLayerObject.getY(); } lastActiveQaTab=qaLayerNum; } // init has to be called by every html-page which has an top navigation and QuickAccess // init is called onload of the body tag function initialisation() { setupCoordsAndArrays(); setMenuLayerPositions(); // building layout of main menu and displaying showMenu(activeSubNavName,activeTab); // initialize submenu (setting right white layer and initial second level Event_init(); // initialize event-handling for main menu AND quick access setQaTabPositions(); // initialize quick access arraysReady = true; } // calls initialisation() using a timeout (needed for NS4), fixes slow menu initialisation on NS4 function init(){ setTimeout("initialisation()", OP ? 1000 : 1 ); }