function renderMenu(parent) {
    var oMenu = new YAHOO.widget.MenuBar("navmenu", { autosubmenudisplay : true });
	var hn = window.location.hostname;
    oMenu.addItems(
    [
        {text : "About BAM", submenu : {
            id : "aboutbam", 
            itemdata : [
                {text : "Home", url : "http://" + hn + "/" + "index.php"},
                {text : "Emergency Information", url : "emergency.html"},
                {text : "Overview", url : "overview.html"},
                {text : "Policies and Procedures", url : "policies.html"},
                {text : "School History", url : "history.html"},
				{text: "BUSD Planning and Oversight Meetings", url: "busdpando.html"},
				{text: "SGC Meetings and Notes", url: "sgc.html"},
				{text : "Photos", url: "photos.html"},
                 {text : "Links", url : "links.html"}
               ]
        }},
        {text : "Programs", submenu : {
            id : "programs",
            itemdata : [
                {text : "Academic Program", url : "coreprograms.html"},
                {text : "After School Programs", url : "afterschool.html"},
                {text : "Arts Education", url : "artisttime.html"},
                {text : "Garden", url : "garden.html"},
               {text : "Library", url : "library.html"},
                {text : "Physical Education", url : "pe.html"},
                {text : "Student Support", url : "support.html"},
				{text : "School Lunch", url : "lunch.html"},
            ]
        }},
        {text : "Calendar", submenu : {
            id : "calendar",
            itemdata : [
                {text: "Calendar of Events", url : "http://www.google.com/calendar/embed?src=bampta%40gmail.com&ctz=America/Los_Angeles"},
                {text : "Friday News Newsletters", url : "news.html"},
                {text : "Daily Schedule", url : "dailyschedule.html"}
            ]
        }},
        {text : "PTA", submenu : {
            id : "pta",
            itemdata : [
                {text : "BAM PTA", url : "pta.html"},
                {text : "PTA Executive Board", url : "ptaboard.html"},
                {text : "Volunteering", url : "ptavolunteer.php"},
                {text : "Membership & Meetings", url : "join.html"},
				
            ]
        }},
        {text : "Staff", submenu: {
            id : "staff",
            itemdata : [
                {text : "Principal & School Operations", url : "principal.html"},
                {text : "Staff", url : "staff.html"},
                {text : "Specialists", url : "specialists.html"},
                {text : "Art & Music", url : "artandmusicstaff.html"}
            ]
        }},
        {text : "Class Blogs", submenu: {
            id : "blogs",
            itemdata : [
                {text : "Ms. Klein's Homework Blog", url : "http://misskleinshomeworkblog.blogspot.com/"},
                {text : "Mr. Weis' Classroom Blog", url : "http://mrweis.wordpress.com/"},
				{text: "Teacher Karl's Singing Blog", url: "http://littlebirdmusicforkids.blogspot.com/"}
            ]
        }},
		 {text : "Support BAM", submenu: {
            id : "support",
            itemdata : [
                {text : "Fundraising", url : "fundraising.html"},
                {text : "Giving Campaign", url : "giving_campaign.php"},
				{text : "Cal Football Parking", url: "calfootballparking.html"},
				{text : "Donate Now", url: "donate.php"}
            ]
        }}
    ]
    );
    
    oMenu.render(parent);
    oMenu.show();
}

YAHOO.util.Event.onContentReady("body", function () {
    // load up the banner and all global content.  Done using an included script so it is shared across all pages, without server-side dependencies
    var table = document.createElement("table");
    var children = [];
	for (var i=0; i < document.body.childNodes.length; i++) {
        children.push(document.body.childNodes.item(i));
    }
    document.body.insertBefore(table, document.body.firstChild);
    table.className = "page";
    var tr = table.insertRow(-1);
    var td = tr.insertCell(-1);
    var div = document.createElement("div");
    td.appendChild(div);
    div.id = "banner";
    div.className = "banner";

    var banners = [
        "/images/artwork_banner.jpg",
        "/images/friends_banner.jpg",
        "/images/doves_banner.jpg"
    ];
    //pick a random banner
    var banner = banners[Math.floor(Math.random() * banners.length)];

    div.innerHTML = "<a href=\"index.php\"><img src=\"" + banner + "\" alt=\"[banner]\"/></a>";
    tr = table.insertRow(-1);
    td = tr.insertCell(-1);
    // render the menu
    renderMenu(td);
    // move existing body content into a cell
    tr = table.insertRow(-1);
    td = tr.insertCell(-1);
    for (var c in children) {
        document.body.removeChild(children[c]);    
        td.appendChild(children[c]);
    }
    document.body.style.display = "";
    // add on global footer information
    tr = table.insertRow(-1);
    td = tr.insertCell(-1);
    div = document.createElement("div");
    td.appendChild(div);
    div.innerHTML = "<HR> Berkeley Arts Magnet&nbsp;&bull;&nbsp;2015 Virginia St.  Berkeley, CA 94709&nbsp;&bull;&nbsp;(510) 644-6225&nbsp;&bull;&nbsp;Tax ID: 94-6174776&nbsp;&bull;&nbsp;Kristin Collins, Principal<br/>Questions or comments about this website: contact <A HREF=\"mailto:webmaster@bampta.org\">webmaster@bampta.org</A>";
});

