             /*
                 Initialize and render the MenuBar when its elements are ready 
                 to be scripted.
            */

            YAHOO.util.Event.onContentReady("nm-top-menu", function () {

                /*
					Instantiate a MenuBar:  The first argument passed to the constructor
					is the id for the Menu element to be created, the second is an 
					object literal of configuration properties.
                */

                var oMenuBar = new YAHOO.widget.MenuBar("nm-top-menu", { 
                                                            autosubmenudisplay: true, 
                                                            hidedelay: 750, 
                                                            lazyload: true });

                /*
                     Define an array of object literals, each containing 
                     the data necessary to create a submenu.
                */

                var aSubmenuData = [

                    {
                        id: "leadership", 
                        itemdata: [
                            { text: "Mayor",        url: "mayor.htm" },
                            { text: "Town Council", url: "council.htm" },
                            { text: "Committees",   url: "committees.htm" },
                            { text: "P & Z Officer", url : "pandz.htm" },
                            { text: "Clerks",       url: "clerks.htm" }                   
                        ]    
                    }
                    
                ];


                /*
                     Subscribe to the "beforerender" event, adding a submenu 
                     to each of the items in the MenuBar instance.
                */

                oMenuBar.subscribe("beforeRender", function () {


                    if (this.getRoot() == this) {
                        	this.getItem(1).cfg.setProperty("submenu", aSubmenuData[0]);

                    }

                });


                /*
                     Call the "render" method with no arguments since the 
                     markup for this MenuBar instance is already exists in 
                     the page.
                */

                oMenuBar.render();         
            
            });
