/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources = new Array("button1up.png","button2up.png","button3up.png","button4up.png","button5up.png","button6up.png","button7up.png","button8up.png","button9up.png");

overSources = new Array("button1over.png","button2over.png","button3over.png","button4over.png","button5over.png","button6over.png","button7over.png","button8over.png","button9over.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo = new Array();
subInfo[1] = new Array();
subInfo[2] = new Array();
subInfo[3] = new Array();
subInfo[4] = new Array();
subInfo[5] = new Array();
subInfo[6] = new Array();
subInfo[7] = new Array();
subInfo[8] = new Array();
subInfo[9] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo[1][1] = new Array("Old Maps","Maps.html","");
subInfo[1][2] = new Array("Directory","Directory.html","");
subInfo[1][3] = new Array("Guestbook","Guestbook.html","");
subInfo[1][4] = new Array("Guestbook Archive","GuestArchive.html","");
subInfo[1][5] = new Array("Index","indexpage.html","");
subInfo[1][6] = new Array("Lost ENY","LostENY.html","");
subInfo[1][7] = new Array("Reunions","Reunions.html","");
subInfo[1][8] = new Array("Links","Links.html","");
subInfo[1][9] = new Array("Mysteries","Mysteries.html","");
subInfo[1][10] = new Array("Credits","Credits.html","");
subInfo[1][11] = new Array("Contacts","Contacts.html","");



subInfo[2][1] = new Array("Schenck","Schenck.html","");
subInfo[2][2] = new Array("Hendrix","Hendrix.html","");
subInfo[2][3] = new Array("Van Siclen","VanSiclen.html","");
subInfo[2][4] = new Array("Bradford","Bradford.html","");
subInfo[2][5] = new Array("Wyona","Wyona.html","");
subInfo[2][6] = new Array("St. Malachy's","StMal.html","");
subInfo[2][7] = new Array("Evergreen Cemetery","Evergreen.html","");
subInfo[2][8] = new Array("Trinity Hospital","Trinity.html","");
subInfo[2][9] = new Array("Gotham Theater","Gotham.html","");
subInfo[2][10] = new Array("Good Shepherd","GoodShepherd.html","");
subInfo[2][11] = new Array("LIRR","LIRR.html","");
subInfo[2][12] = new Array("Zone 1","Zone1.html","");


subInfo[3][1] = new Array("Barbey","Barbey.html","");
subInfo[3][2] = new Array("Jerome","Jerome.html","");
subInfo[3][3] = new Array("Warwick","Warwick.html","");
subInfo[3][4] = new Array("Ashford","Ashford.html","");
subInfo[3][5] = new Array("Cleveland","Cleveland.html","");
subInfo[3][6] = new Array("Elton","Elton.html","");
subInfo[3][7] = new Array("Arlington Ave","Arlington.html","");
subInfo[3][8] = new Array("Library","ArlLib.html","");
subInfo[3][9] = new Array("Reformation","Reformation.html","");
subInfo[3][10] = new Array("Parades","Parades.html","");
subInfo[3][11] = new Array("Arl Av Pres","ArlChurch.html","");

subInfo[4][1] = new Array("Linwood","Linwood.html","");
subInfo[4][2] = new Array("Essex","Essex.html","");
subInfo[4][3] = new Array("Shepherd","Shepherd.html","");
subInfo[4][4] = new Array("Highland Pl","HiPl.html","");
subInfo[4][5] = new Array("Hale","Hale.html","");
subInfo[4][6] = new Array("Norwood","Norwood.html","");

subInfo[4][7] = new Array("Logan","Logan.html","");
subInfo[4][8] = new Array("Richmond","Richmond.html","");
subInfo[4][9] = new Array("Chestnut","Chestnut.html","");
subInfo[4][10] = new Array("Etna","Etna.html","");
subInfo[4][11] = new Array("Ridgewood","Ridgewood.html","");

subInfo[4][12] = new Array("PS 65","PS65.html","");
subInfo[4][13] = new Array("PS 108","PS108.html","");
subInfo[4][14] = new Array("YMCA","YMCA.html","");
subInfo[4][15] = new Array("Andrews Methodist","Andrews.html","");



subInfo[5][1] = new Array("Euclid","Euclid.html","");
subInfo[5][2] = new Array("Pine","Pine.html","");

subInfo[5][3] = new Array("Crescent","Crescent.html","");
subInfo[5][4] = new Array("Hemlock","Crescent.html","");
subInfo[5][5] = new Array("Nichols","Nichols.html","");

subInfo[5][6] = new Array("Elderts Lane","Elderts.html","");
subInfo[5][7] = new Array("Cypress Pool","Pool.html","");
subInfo[5][8] = new Array("FK Lane","FKLane.html","");
subInfo[5][9] = new Array("Blessed Sacrament","BlessedSac.html","");
subInfo[5][10] = new Array("I.S. 171","IS171.html","");
subInfo[5][11] = new Array("Cypress Cemetery","CyCem.html","");
subInfo[5][12] = new Array("Zone 4","Zone4.html","");





subInfo[6][1] = new Array("Atlantic Ave.","AtlanticZ5.html","");
subInfo[6][1] = new Array("Williams Ave.","Williams.html","");
subInfo[6][2] = new Array("Pennsylvania Ave.","Penn.html","");
subInfo[6][3] = new Array("Georgia Ave.","Georgia.html","");
subInfo[6][4] = new Array("Hendrix Street","HendrixZ5.html","");
subInfo[6][5] = new Array("Ashford Street","AshfordZ5.html","");
subInfo[6][6] = new Array("Cleveland Street","ClevelandZ5.html","");
subInfo[6][7] = new Array("P.S. 149","PS149.html","");
subInfo[6][8] = new Array("Liberty Ave.","LibertyZ5.html","");
subInfo[6][9] = new Array("St. Michael's","StMichaels.html","");
subInfo[6][10] = new Array("Maxwell Vocational","Maxwell.html","");
subInfo[6][11] = new Array("Jefferson High","TJHigh.html","");
subInfo[6][12] = new Array("St. John's","StJohns.html","");
subInfo[6][13] = new Array("St. John Cantius","STJCant.html","");
subInfo[6][14] = new Array("Piels Brewery","Piels.html","");
subInfo[6][15] = new Array("26th Ward Bank","26WardBank.html","");
subInfo[6][16] = new Array("26th Ward YMCA","26WardYMCA.html","");
subInfo[6][17] = new Array("New Lots Road","NewLotsW.html","");
subInfo[6][18] = new Array("Zone 5","Zone5.html","");


subInfo[7][1] = new Array("Atlantic Avenue","AtlanticZ6.html","");
subInfo[7][2] = new Array("Elton/Linwood","EltonZ6.html","");
subInfo[7][3] = new Array("Essex","EssexZ6.html","");
subInfo[7][4] = new Array("Liberty Playground","LibertyPlay.html","");
subInfo[7][5] = new Array("Liberty Avenue","Liberty.html","");
subInfo[7][6] = new Array("St. Rita's","StRitas.html","");
subInfo[7][7] = new Array("Logan","LoganZ6.html","");

subInfo[7][8] = new Array("Water Works","RidgeWW.html","");
subInfo[7][9] = new Array("P.S. 64","PS64.html","");
subInfo[7][10] = new Array("ENY Vocational","ENYVoc.html","");
subInfo[7][11] = new Array("Pitkin Ave","Pitkin.html","");
subInfo[7][12] = new Array("New Lots Road","NewLotsE.html","");
subInfo[7][13] = new Array("Old Mill","OldMill.html","");
subInfo[7][14] = new Array("Zone 6","Zone6.html","");



subInfo[8][1] = new Array("Lower","HPLower.html","");
subInfo[8][2] = new Array("Upper","HPUpper.html","");
subInfo[8][3] = new Array("Reservoir","Reservoir.html","");
subInfo[8][4] = new Array("Schenck House","SchenckHouse.html","");
subInfo[8][5] = new Array("Pavilion","Pavilion.html","");
subInfo[8][6] = new Array("Sunnyside","Sunnyside.html","");
subInfo[8][7] = new Array("HP Postcards","HPPostcards.html","");


subInfo[9][1] = new Array("1963","171_1963.html","");
subInfo[9][2] = new Array("1964","171_1964.html","");
subInfo[9][3] = new Array("1965","171_1965.html","");
subInfo[9][4] = new Array("1966","171_1966.html","");
subInfo[9][5] = new Array("1967","171_1967.html","");
subInfo[9][6] = new Array("1968","171_1968.html","");
subInfo[9][7] = new Array("1969","171_1969.html","");
subInfo[9][8] = new Array("1970","171_1970.html","");
subInfo[9][9] = new Array("1973","171_1973.html","");


//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 2;
var ySubOffset = 24;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub = false;
var delay = 1000;
totalButtons = upSources.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons; x++) {
    // SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
    if ( subInfo[x+1].length < 1 ) {
        document.write('<div id="submenu' + (x+1) + '">');
    // SET DIV FOR BUTTONS WITH SUBMENU
    } else {
        document.write('<div id="submenu' + (x+1) + '" class="dropmenu" ');
        document.write('onMouseOver="overSub=true;');
        document.write('setOverImg(\'' + (x+1) + '\',\'\');"');
        document.write('onMouseOut="overSub=false;');
        document.write('setTimeout(\'hideSubMenu(\\\'submenu' + (x+1) + '\\\')\',delay);');
        document.write('setOutImg(\'' + (x+1) + '\',\'\');">');


        document.write('<ul>');
        for ( k=0; k<subInfo[x+1].length-1; k++ ) {
            document.write('<li>');
            document.write('<a href="' + subInfo[x+1][k+1][1] + '" ');
            document.write('target="' + subInfo[x+1][k+1][2] + '">');
            document.write( subInfo[x+1][k+1][0] + '</a>');
            document.write('</li>');
        }
        document.write('</ul>');
    }
    document.write('</div>');
}





//*** MAIN BUTTONS FUNCTIONS ***//
// PRELOAD MAIN MENU BUTTON IMAGES
function preload() {
    for ( x=0; x<totalButtons; x++ ) {
        buttonUp = new Image();
        buttonUp.src = buttonFolder + upSources[x];
        buttonOver = new Image();
        buttonOver.src = buttonFolder + overSources[x];
    }
}

// SET MOUSEOVER BUTTON
function setOverImg(But, ID) {
    document.getElementById('button' + But + ID).src = buttonFolder + overSources[But-1];
}

// SET MOUSEOUT BUTTON
function setOutImg(But, ID) {
    document.getElementById('button' + But + ID).src = buttonFolder + upSources[But-1];
}



//*** SUB MENU FUNCTIONS ***//
// GET ELEMENT ID MULTI BROWSER
function getElement(id) {
    return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null;
}

// GET X COORDINATE
function getRealLeft(id) {
    var el = getElement(id);
    if (el) {
        xPos = el.offsetLeft;
        tempEl = el.offsetParent;
        while (tempEl != null) {
            xPos += tempEl.offsetLeft;
            tempEl = tempEl.offsetParent;
        }
        return xPos;
    }
}

// GET Y COORDINATE
function getRealTop(id) {
    var el = getElement(id);
    if (el) {
        yPos = el.offsetTop;
        tempEl = el.offsetParent;
        while (tempEl != null) {
            yPos += tempEl.offsetTop;
            tempEl = tempEl.offsetParent;
        }
        return yPos;
    }
}

// MOVE OBJECT TO COORDINATE
function moveObjectTo(objectID,x,y) {
    var el = getElement(objectID);
    el.style.left = x;
    el.style.top = y;
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu(subID, buttonID) {
    hideAllSubMenus();
    butX = getRealLeft(buttonID);
    butY = getRealTop(buttonID);
    moveObjectTo(subID,butX+xSubOffset, butY+ySubOffset);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus() {
    for ( x=0; x<totalButtons; x++) {
        moveObjectTo("submenu" + (x+1) + "",-500, -500 );
    }
}

// HIDE ONE SUB MENU
function hideSubMenu(subID) {
    if ( overSub == false ) {
        moveObjectTo(subID,-500, -500);
    }
}



//preload();