/* L I N K   A R R A Y */
function lclink( str, href, lvl ) {
    this.str = str;
    this.href = href;
    this.lvl = lvl;
}

// Fill in the array below to manage the left sash links
//     str = The text to display in the link
//     href = The url the link should go to
//     lvl = Either 1 or 2. Major headings are 1 and minor headings are 2.

var myLinkArray = new Array();
myLinkArray[myLinkArray.length] = new lclink("Home", "index.html", 1);

myLinkArray[myLinkArray.length] = new lclink("Get help", "gethelp.html", 1);
myLinkArray[myLinkArray.length] = new lclink("Services", "services.html", 2);
myLinkArray[myLinkArray.length] = new lclink("Contact us", "contactus.html", 2);

myLinkArray[myLinkArray.length] = new lclink("How to help", "howtohelp.html", 1);
myLinkArray[myLinkArray.length] = new lclink("Donate funds", "donatefunds.html", 2);
myLinkArray[myLinkArray.length] = new lclink("Donate goods", "donategoods.html", 2);
myLinkArray[myLinkArray.length] = new lclink("Join our food drive", "fooddrive.html", 2);
myLinkArray[myLinkArray.length] = new lclink("Volunteer", "volunteer.html", 2);
myLinkArray[myLinkArray.length] = new lclink("Link to our website", "linktous.html", 2);


myLinkArray[myLinkArray.length] = new lclink("Who we help", "whowehelp.html", 1);

myLinkArray[myLinkArray.length] = new lclink("About us", "aboutus.html", 1);
myLinkArray[myLinkArray.length] = new lclink("Mission statement", "mission.html", 2);
myLinkArray[myLinkArray.length] = new lclink("How we work", "howwework.html", 2);
myLinkArray[myLinkArray.length] = new lclink("Acknowledgements", "acknowledgements.html", 2);
myLinkArray[myLinkArray.length] = new lclink("History", "history.html", 2);
myLinkArray[myLinkArray.length] = new lclink("News & events blog", "http://stfrancishousefoodpantry.blogspot.com/", 2);

myLinkArray[myLinkArray.length] = new lclink("Contact us", "contactus.html", 1);


/* M A K E   T H E   P A G E */

// As long as this is just HTML text, it can simply be written into the stream using document.write()
function makeTopBanner() {
    document.write("\n<table border=\"0\" cellpadding=\"8\" cellspacing=\"8\" width=\"900\" align=\"center\">");
    document.write("\n<col width=\"180\">");
    document.write("\n<col width=\"720\">");
    document.write("\n<tr valign=\"top\"><td colspan=\"2\" class=\"pageBlock\">");
    // main logo
    document.write("\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"900\">");
    document.write("\n<col width=\"180\">");
    document.write("\n<col width=\"180\">");
    document.write("\n<col width=\"180\">");
    document.write("\n<col width=\"180\">");
    document.write("\n<col width=\"180\">");
    document.write("\n<tr>");
    document.write("\n<td align=\"center\" class=\"bannerBlock\"><a href=\"index.html\"><img src=\"images/logo.jpg\" width=\"162\" height=\"162\" border=\"0\"></a></td>");
    document.write("\n<td align=\"center\" class=\"bannerBlock\"><img src=\"images/pic1.jpg\" width=\"162\" height=\"162\"></td>");
    document.write("\n<td align=\"center\" class=\"bannerBlock\"><img src=\"images/pic2.jpg\" width=\"162\" height=\"162\"></td>");
    document.write("\n<td align=\"center\" class=\"bannerBlock\"><img src=\"images/pic3.jpg\" width=\"162\" height=\"162\"></td>");
    document.write("\n<td align=\"center\" class=\"bannerBlock\"><img src=\"images/pic4.jpg\" width=\"162\" height=\"162\"></td>");
    document.write("\n</tr>");
    document.write("\n</table>");
    document.write("\n</td></tr>");
    // left sash links
    document.write("\n<tr valign=\"top\"><td class=\"pageBlock\">");
    document.write("\n<div id=\"sashLinks\"></div>");
    document.write("\n</td><td class=\"pageBlock\"><div style=\"margin-top:8px;\">");
}

function makeBottomBanner() {
    document.write("\n</div></td></tr>");
    document.write("\n<tr><td colspan=\"2\" class=\"footer\">Helping our neighbors in need.</td></tr>");
    document.write("</table>");
}

/* S A S H   L I N K S */
// Since the sash links rely on the link array, they processed AFTER the poage finishes loading.
// If you don't do this, you risk javascript errors because the array might not be "ready" when you try to use it.
// The link building code is called by the onload method of the BODY tag

function preparePage() {
    if ( document.getElementById("sashLinks") != null ) {
        makeSashLinks();
    }
}

function makeSashLinks() {
    var fname = document.location.pathname.substr( document.location.pathname.lastIndexOf("/")+1 );
    var str = "";
    for (var i = 0 ; i < myLinkArray.length ; i++ ) {
        if (fname != myLinkArray[i].href) {
            str += "<a href='" + myLinkArray[i].href + "' class='rollover2'>"
            if (myLinkArray[i].lvl == "1") {
                str += "<div class='link1' "
            } else {
                str += "<div class='link2' "
            }
            str += "   onMouseOver=\"W2_roll( this, 'over' )\""
            str += "   onMouseOut=\"W2_roll( this, 'out' )\">"
            str += myLinkArray[i].str
            str += "</div>"
            str += "</a>"
        } else {
            if (myLinkArray[i].lvl == "1") {
                str += "<div class='link1'>"
            } else {
                str += "<div class='link2'>"
            }
            str += myLinkArray[i].str
            str += "</div>"
        }
    }
    document.getElementById("sashLinks").innerHTML = str;
}

/* R O L L O V E R S */
// Walter Barry - 2007 - Rollover using CSS and DHTML - no images required
// Simply change the visual properties of the calling element as the mouse passes over the element

function W2_roll( obj, val ) {
    if ( val == "over" ) {
        obj.style.backgroundColor = "#eeeeee";
    }
    if ( val == "out" ) {
        obj.style.backgroundColor = "#ffffff";
    }
}

