﻿ /*
     Initialize and render the MenuBar when its elements are ready 
     to be scripted.
*/

YAHOO.util.Event.onContentReady("topNav", function () {

    /*
         Instantiate a MenuBar:  The first argument passed to the 
         constructor is the id of the element in the page 
         representing the MenuBar; the second is an object literal 
         of configuration properties.
    */
    
    function onSubmenuBeforeShow(p_sType, p_sArgs) 
    {
        this.cfg.setProperty("submenualignment", ["tl", "tl"]);
    }


    var oMenuBar = new YAHOO.widget.MenuBar("topNav", { 
                                                autosubmenudisplay: true, 
                                                //submenualignment: ["tr", "tl"],
                                                hidedelay: 750, 
                                                lazyload: false });

    oMenuBar.subscribe("beforeShow", onSubmenuBeforeShow);

//    var productsMenu = oMenuBar.getItem(2).cfg.getProperty("submenu");
//    var productsSubMenu = productsMenu.getItem(0).cfg.getProperty("submenu");
//    productsSubMenu.align("bl", "br");
    /*
         Call the "render" method with no arguments since the 
         markup for this MenuBar instance is already exists in 
         the page.
    */

    oMenuBar.render();
    
    

});

 
