      /*
                 Initialize and render the MenuBar when its elements are ready 
                 to be scripted.
            */

            YAHOO.util.Event.onContentReady("productsandservices", 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.
                */

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

                /*
                     Define an array of object literals, each containing 
                     the data necessary to create a submenu.
                */

                var aSubmenuData = [
                
                    {
                      id: "HOME",
                        itemdata: [
                           
                        ]
                    },

                    {
                        id: "ABOUTUS", 
                        itemdata: [
                            { text: "History", url: "about.html?#history" },
                            { text: "Awards &amp; Achievements", url: "about.html?#awards" },
                            { text: "Board &amp; Staff", url: "about.html?#board" },
                            { text: "Press", url: "about.html?#press" },
                            { text: "Newsletter", url: "media/TNYnewssummer09.pdf" },
                            { text: "Contact Us", url: "contact.html" },
                                            
                        ]    
                    },
                    
                   {
                        id: "PROGRAMS2", 
                        itemdata: [
                       		{ text: "MillionTreesNYC", url: "programs.html?#mtnyc" },
                            { text: "Citizen Pruner", url: "programs.html?#citizenpruner" },
                            { text: "Youth Environmental Literacy", url: "programs.html?#youth" },
                            { text: "Trees Mean Business", url: "programs.html?#treesmeanbusiness" },                           
                            { text: "Arborist Job Training", url: "programs.html?#arborist" },
                            { text: "Asian Longhorned Beetle", url: "programs.html?#alb" },
                                
                        ] 
                    },
                    
                    {
                        id: "RESOURCES2",
                        itemdata: [
                        	{ text: "Street Tree Pit Guards", url: "resources.html?#treeguards" },
                        	{ text: "Curb Your Dog Signs", url: "resources.html?#dogsandtrees" },
                            { text: "Educational Publications", url: "educationalpublications.html" },
                           
                        ]
                    },
                    
                    
                    {
                        id: "FAQ",
                        itemdata: [
                           
                        ]
                    },
                    
                        
                    {
                        id: "EVENTS",
                        itemdata: [
                           
                        ]
                    },
                    
                    
                        
                    {
                        id: "DONATE",
                        itemdata: [
                           
                        ]
                    },
                    
                ];


                /*
                     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[1]);
                        this.getItem(2).cfg.setProperty("submenu", aSubmenuData[2]);
                        this.getItem(3).cfg.setProperty("submenu", aSubmenuData[3]);
                                         }

                });


                /*
                     Call the "render" method with no arguments since the 
                     markup for this MenuBar instance is already exists in 
                     the page.
                */

                oMenuBar.render();         
            
            });
