/** * Nuon Navigation * ------------------------- */ var navigation = null; /** * Navigation class constructor */ function Navigation(element) { if(!element) { return; } navigation = this; navigation.container = element; navigation.activeSubNav = null; this.init(); } /** * Navigation class definition */ Navigation.prototype = { ZINDEX_ACTIVE: 103, ZINDEX_PASSIVE: 102, OPEN_CLASS: "open", OPEN_DELAY: 250, CLOSE_DELAY: "fast", container: null, activeSubNav: null, /** * Initializes the navigation. */ init:function() { $("ol>li ul:has(li)", this.container).each(function() { navigation.fixDropDownWidth($(this)); }); $("ol>li:not(:has(ul)) a", this.container).addClass("empty"); $("ol>li", this.container).hover( /** * Handles the foldout of the subnavigation */ function () { //the mouseover $ul = $('ul', this); if($ul.size()==0 ||$ul.queue("fx").length>1) { return; } if(navigation.activeSubNav!=null&&navigation.activeSubNav!=this) { $(navigation.activeSubNav).css("z-index", navigation.ZINDEX_PASSIVE); $(navigation.activeSubNav).stop(true, true); } navigation.activeSubNav = this; $(this).addClass(navigation.OPEN_CLASS); $(this).css({"position":"relative","z-index":navigation.ZINDEX_ACTIVE}); $ul.slideDown(navigation.OPEN_DELAY); }, /** * Handles the foldin of the subnavigation */ function () { $(this).removeClass(navigation.OPEN_CLASS); $('ul', this).slideUp(navigation.CLOSE_DELAY); } ); }, /** * Makes the dropdown visible and bold to dermine the required fixed width and sets this as * a CSS property on the dropdown element. A "fixed" class is used to mark processed items. If the * item is smaller than the subnavigation the width is adjusted accordingly. */ fixDropDownWidth: function($ul) { if(!$ul.is(".fixed")) { $ul.css({"display":"block","font-weight":"bold"}); ulWidth = $ul.find("li:first").width(); navWidth = $ul.parent("li").width() + 15; if(navWidth > ulWidth) { ulWidth = navWidth; } $ul.css({"font-weight":"normal", "width":ulWidth,"display":"none"}); $ul.addClass("fixed"); } } } /** * Client group navigation * -------------------------- */ var NavClientgroup = { init: function(node) { NavClientgroup.node = document.getElementById(node); if (!NavClientgroup.node) { return; } EventListener.addEvent(NavClientgroup.node, "click", function(e){ NavClientgroup.clickHandler(e) }); }, clickHandler: function(e) { var target = EventListener.getTarget(e) while (!target.nodeName || target.nodeType == 3) { target = target.parentNode; } if (/^a$/i.test(target.nodeName) && target.parentNode.parentNode == NavClientgroup.node) { NavClientgroup.setSelected(target.parentNode); return EventListener.preventDefault(e); } }, setSelected: function(target) { if (ClassName.contains(target, "selected")) { return; } for (var i = 0; i < NavClientgroup.node.childNodes.length; i++) { ClassName.remove(NavClientgroup.node.childNodes[i], "selected"); } ClassName.add(target, "selected"); } } EventListener.addEvent(window, 'load', function(){ if(/MSIE 5/.test(navigator.userAgent)) { return; } new Navigation(document.getElementById('subnavigation')); NavClientgroup.init("nav-clientgroup") });