/*
2	     Initialize and render the MenuBar when its elements are ready 
3	     to be scripted.
4	*/ 
 
	YAHOO.util.Event.onContentReady("sapmenu", function () { 
	 
    /*
9	         Instantiate a MenuBar:  The first argument passed to the 
10	         constructor is the id of the element in the page 
11	         representing the MenuBar; the second is an object literal 
12	         of configuration properties.
13	    */ 
	 
	    var oMenuBar = new YAHOO.widget.MenuBar("sapmenu", {  
	                                                autosubmenudisplay: true,  
	                                                hidedelay: 750,  
	                                                lazyload: true }); 
	 
 
    
    /*
2	     Define an array of object literals, each containing 
3	     the data necessary to create a submenu.
4	*/ 
	 
var aSubmenuData = [ 
 
    { 
        id: "Worship",  
        itemdata: [  
            { text:"Worship", url: "SAPWorship.html"},
            { text: "Worship Schedule", url: "SAPWorship.html" }, 
            { text: "Worship Minister Schedule", url: "WorshipMinisterSchedule.html" }, 
            { text: "Acolytes", url: "Acolytes.html" }, 
            { text: "Eucharistic Ministers", url: "EucharisticMinisters.html" }, 
            { text: "Lay Readers", url: "LayReaders.html" }, 
            { text: "Ushers", url: "pdf/USHERS-LIST.pdf" }, 
            { text: "Sunday Lessons", url: "SundayLessons.html" }, 
            { text: "St. Andrew's Labyrinth", url: "Labyrinth.html" }, 
        ] 
    }, 
 
    { 
        id: "Fellowship",  
        itemdata: [ 
            { text:"Fellowship", url: "SAPFellowship.html"},
            { text: "Alcohol Use Policy", url: "AlcoholPolicy.html" }, 
            { text: "St. Andrews Code Of Conduct", url: "CodeOfConduct.html" }, 
        ]     
    }, 
     
    { 
        id: "Discipleship",  
        itemdata: [ 
            { text:"Discipleship", url: "SAPDiscipleship.html"},
            { text: "Baptism FAQ", url: "BaptismFAQ.html" }, 
            { text: "Marriage", url: "Marriage.html" }, 
        ]  
    }, 
     
    { 
        id: "Mission", 
        itemdata: [ 
            { text:"Mission", url: "SAPMission.html"},
            { text: "Core Values", url: "CoreValues.html" }, 
            { text: "Core Values Definitions", url: "pdf/Mission-Definitions.pdf" }, 
        ] 
    },
   
    { 
        id: "Outreach", 
        itemdata: [ 
            { text:"Outreach", url: "SAPOutreach.html"},
            { text: "Christian Helping Hands", url: "http://www.christianhelpinghands.org/" }, 
            { text: "Compassion International", url: "http://www.compassion.com" }, 
            { text: "Operation Christmas Child", url: "http://www.samaritanspurse.org/home.asp" },
        ] 
    },

    { 
        id: "Children",  
        itemdata: [ 
            { text:"Children", url: "SAPChildren.html"},
            { text: "Rock U Registration Form", url: "pdf/2007-08_RU_Reg_form.pdf" },  
        ]  
    }, 
    
    { 
        id: "About",  
        itemdata: [ 
            { text:"About Us", url: "SAPAboutUs.html"},
            { text: "Worship Schedule", url: "SAPAboutUs.html" },  
            { text: "Where is St. Andrew's?", url: "SAPAboutUs.html" }, 
            { text: "Staff", url: "SAPStaff.html" }, 
            { text: "Vestry", url: "SAPVestry.html" }, 
            { text: "Related Links", url: "RelatedLinks.html" }, 
        ]  
    }, 
]; 
	 
	 
	/*
83	     Subscribe to the "beforerender" event, adding a submenu 
84	     to each of the items in the MenuBar instance.
85	*/ 
	 
oMenuBar.subscribe("beforeRender", function () { 
 
    if (this.getRoot() == this) { 
        //Skip 0 since Home has no menu items
        this.getItem(1).cfg.setProperty("submenu", aSubmenuData[0]); 
        this.getItem(2).cfg.setProperty("submenu", aSubmenuData[1]); 
        this.getItem(3).cfg.setProperty("submenu", aSubmenuData[2]); 
        this.getItem(4).cfg.setProperty("submenu", aSubmenuData[3]);
        this.getItem(5).cfg.setProperty("submenu", aSubmenuData[4]); 
        this.getItem(6).cfg.setProperty("submenu", aSubmenuData[5]); 
        this.getItem(7).cfg.setProperty("submenu", aSubmenuData[6]); 
        //Skip 8 since St. Andrew's Academy has no menu items.
 
    } 
 
}); 

/*
102	     Call the "render" method with no arguments since the 
103	     markup for this MenuBar instance is already exists in 
104	     the page.
105	*/ 
 
oMenuBar.render();    

	});