// Open and close menus

function displayMenu(currentMenu) {

    var thisMenu = document.getElementById(currentMenu).style

    // If the menu is expanded, contract it
    if (thisMenu.display == "block") {
        thisMenu.display = "none"
    }
    else {
        // If the menu is contracted, expand it
        thisMenu.display = "block"
    }
    return false
}

// Rollover for menu buttons

function swap(id, newsrc) {
    var theImage = locateImage(id);
    if (theImage) {
        theImage.src = newsrc;
    }
}

function locateImage(name) {
    var theImage = false;
    if (document.images) {
        theImage = document.images[name];
    }
    if (theImage) {
        return theImage;
    }
    return (false);
}

var newWindow = null;

function popMonth(month) {
    var windowFile = "./news/calendar/" + month + ".html"
    newWindow = open(windowFile, month, "scrollbars,resizable,width=900,height=900");
}

function popMap() {
    newWindow = open("./map.html", "Map", "scrollbars,resizable,width=600,height=600");
}

function popSiteMap() {
    newWindow = open("../sitemap.html", "SiteMap", "scrollbars,resizable,width=800,height=800");
}

function popEventForm() {
    newWindow = open("./news/request.html", "Form", "scrollbars,resizable,width=500,height=750");
}

function popEvent(eventName) {
    var eventFile = "./news/events/" + eventName + ".html"
    newWindow = open(eventFile, eventName, "scrollbars,resizable,width=750,height=600");
}

function popWord() {
    newWindow = open("http://www.stjamescaledoneast.ca/word/thisweek.html", "Word", "scrollbars,resizable,width=750,height=700");
}

function popPrayer() {
    newWindow = open("http://www.stjamescaledoneast.ca/prayer.html", "Prayer", "scrollbars,resizable,width=650,height=450");
}

function popPhoto(photoName) {
    var photoFile = "./images/" + photoName + ".jpg"
    newWindow = open(photoFile, "Tour", "scrollbars,resizable,width=500,height=400");
}
