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

      YAHOO.util.Event.onContentReady("menubar", 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("menubar", { 
                                                      autosubmenudisplay: true, 
                                                      hidedelay: 750, 
                                                      lazyload: true });

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

          var aSubmenuData = [          
              {
                  id: "raceinfo", 
                  itemdata: [
                      { text: "Marathon", url: "race_marathon.php" },
                      { text: "Half Marathon", url: "race_half.php" },
                      { text: "Wheelchair Half", url: "wheelchair.php" },
                      { text: "Marathon Relay", url: "race_relay.php" },
                      { text: "10K", url: "race_10K.php" },
                      { text: "5K", url: "race_5K.php" },
                      { text: "I-Challenge", url: "race_i_challenge.php" },
                      { text: "Youth Run", url: "race_youth.php" },
                      { text: "Course Info", url: "course.php" },
                      { text: "Rules and Regulations", url: "rulesregs.php" },                    
                      { text: "Entertainment", url: "entertainment.php" },                    
                      { text: "Charity Runners", url: "charity.php" },                    
                      { text: "Training", url: "training.php" },
                      { text: "Pace Teams", url: "pacegroups.php" }                    
                  ]    
              },
              
              {
                  id: "registration", 
                  itemdata: [
                      { text: "General Registration Info", url: "registration.php" },
                      { text: "Elite Athlete Info", url: "elite.php" },
                      { text: "Registration Confirmation", url: "reg_confirm.php" }
                  ] 
              },
              
              {
                  id: "weekend",
                  itemdata: [
//                      { text: "Weekend Schedule", url: "schedule.php" },
                      { text: "Travel, Lodging, Dining", url: "hoteltravel.php" },
                      { text: "Parking", url: "parking.php" },
                      { text: "Packet Pickup", url: "packetpickup.php" },
                      { text: "Pasta Feed", url: "pastafeed.php" },
                      { text: "Health & Fitness Expo", url: "expo.php" },
//                      { text: "Speakers", url: "speakers.php" },
                      { text: "27th-Mile Celebrate Victory Bash", url: "postraceparty.php" }
                  ]
              }                    
          ];


          /*
               Subscribe to the "beforerender" event, adding a submenu 
               to each of the items in the MenuBar instance.
          */

          oMenuBar.subscribe("beforeRender", function () {

							var nSubmenus = aSubmenuData.length,
									i;


              if (this.getRoot() == this) {

                  	this.getItem(1).cfg.setProperty("submenu", aSubmenuData[0]);
                  	this.getItem(2).cfg.setProperty("submenu", aSubmenuData[1]);                 
                  	this.getItem(3).cfg.setProperty("submenu", aSubmenuData[2]);
              }

          });


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

          oMenuBar.render();         
      
      });
