// JavaScript Document
// Initialize and render the menu bar when it is available in the DOM

    YAHOO.util.Event.onContentReady("topmenu", function () {

        // "beforerender" event handler for the menu bar
		function onMenuBarBeforeRender(p_sType, p_sArgs) {

                    var oSubmenuData = {
                    
                        "company_menulink": [ 
                
							{ text: "our company", url: "html/company.html" },
							{ text: "our team", url: "html/team.html" },
							{ text: "community involvement", url: "html/community.html" }		
				
						],
                        
                        "commercial_menulink": [
							
							{ text: "philosophy", url: "html/commercial-leasing.html" },
							{ text: "properties", url: "html/properties.html" },
							{ text: "commercial sales", url: "html/commercial-sales.html" },
							{ text: "property management", url: "html/property-management.html" }
						
						]						
						
						
                    
                    };

                    // Add a submenu to each of the menu items in the menu bar

                    this.getItem(0).cfg.setProperty("submenu", { id: "company_menulink", itemdata: oSubmenuData["company_menulink"] });					
					this.getItem(3).cfg.setProperty("submenu", { id: "commercial_menulink", itemdata: oSubmenuData["commercial_menulink"] });														

                }

        /*
             Instantiate the menubar.  The first argument passed to the 
             constructor is the id of the element in the DOM that 
             represents the menubar; the second is an object literal 
             representing a set of configuration properties for 
             the menubar.
        */

        var oMenuBar = new YAHOO.widget.MenuBar("topmenu", { autosubmenudisplay: true, showdelay: 250, hidedelay:  750, lazyload: false });


        // Subscribe to the "beforerender" event

        oMenuBar.beforeRenderEvent.subscribe(onMenuBarBeforeRender);


        /*
             Call the "render" method with no arguments since the markup for 
             this menu already exists in the DOM.
        */

        oMenuBar.render();            
    
    });
