/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources = new Array("button1up.gif","button2up.gif","button3up.gif","button4up.gif","button5up.gif","button6up.gif","button7up.gif");

overSources = new Array("button1over.gif","button2over.gif","button3over.gif","button4over.gif","button5over.gif","button6over.gif","button7over.gif");

// 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();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//

//*** learn Drop Down Configuration ***//

subInfo[1][1] = new Array(" Sam Wyly Hall","http://www.lzarch.com/projects/learn/wyly/wyly.html","_parent");
subInfo[1][2] = new Array(" Randall Lab","http://www.lzarch.com/projects/learn/randall/randall.html","_parent");
subInfo[1][3] = new Array(" Tappan Hall Addition","http://www.lzarch.com/projects/learn/tappan/tappan.html","_parent");
subInfo[1][4] = new Array(" Malletts Creek Branch Library","http://www.lzarch.com/projects/learn/malletts/malletts.html","_parent");
subInfo[1][5] = new Array(" Pittsfield Branch Library","http://www.lzarch.com/projects/learn/pittsfield/pittsfield.html","_parent");
subInfo[1][6] = new Array(" Farmington Community Library","http://www.lzarch.com/projects/learn/farmington/farmington.html","_parent");
subInfo[1][7] = new Array(" Haworth Collage of Business","http://www.lzarch.com/projects/learn/haworth/haworth.html","_parent");
subInfo[1][8] = new Array(" Environmental Interperative Center","http://www.lzarch.com/projects/learn/eic/eic.html","_parent");

//*** work Drop Down Configuration ***//

subInfo[2][1] = new Array(" Syndeco Plaza","http://www.lzarch.com/projects/work/syndeco/syndeco.html","_parent");
subInfo[2][2] = new Array(" South State Commons","http://www.lzarch.com/projects/work/ssc/ssc.html","_parent");
subInfo[2][3] = new Array(" Michigan Information Technology Center","http://www.lzarch.com/projects/work/mitc/mitc.html","_parent");
subInfo[2][4] = new Array(" Munder Capitol Center","http://www.lzarch.com/projects/work/munder/munder.html","_parent");
subInfo[2][5] = new Array(" North Valley Offices","http://www.lzarch.com/projects/work/nv/nv.html","_parent");
subInfo[2][6] = new Array(" Kellogg Foundation","http://www.lzarch.com/projects/work/kellogg/kellogg.html","_parent");
subInfo[2][7] = new Array(" 260 Merrill","http://www.lzarch.com/projects/work/260/260.html","_parent");
subInfo[2][8] = new Array(" Flat Rock Municipal","http://www.lzarch.com/projects/work/flatrock/flatrock.html","_parent");
subInfo[2][9] = new Array(" American Axle","http://www.lzarch.com/projects/work/axle/axle.html","_parent");
subInfo[2][10] = new Array(" Bank of Birmingham","http://www.lzarch.com/projects/work/bank/bank.html","_parent");

//*** live Drop Down Configuration ***//

subInfo[3][1] = new Array(" Romney Residence","http://www.lzarch.com/projects/live/romney/romney.html","_parent");
subInfo[3][2] = new Array(" Ziegelman Residence","http://www.lzarch.com/projects/live/ziegelman/ziegelman.html","_parent");
subInfo[3][3] = new Array(" Ashley Mews","http://www.lzarch.com/projects/live/ashley/ashley.html","_parent");
subInfo[3][4] = new Array(" Ann Arbor Loft","http://www.lzarch.com/projects/live/loft/loft.html","_parent");
subInfo[3][5] = new Array(" North Main Proposal","http://www.lzarch.com/projects/live/nmain/nmain.html","_parent");
subInfo[3][6] = new Array(" Library Towers Proposal","http://www.lzarch.com/projects/live/towers/towers.html","_parent");
subInfo[3][7] = new Array(" The Ashton","http://www.lzarch.com/projects/live/ashton/ashton.html","_parent");
subInfo[3][8] = new Array(" Rogel Residence","http://www.lzarch.com/projects/live/mountain/mountain.html","_parent");

//*** shop Drop Down Configuration ***//

subInfo[4][1] = new Array(" Fred Lavery Dealership","http://www.lzarch.com/projects/shop/lavery/lavery.html","_parent");
subInfo[4][2] = new Array(" Park West","http://www.lzarch.com/projects/shop/parkwest/parkwest.html","_parent");
subInfo[4][3] = new Array(" Bivouac","http://www.lzarch.com/projects/shop/bivouac/bivouac.html","_parent");

//*** civic Drop Down Configuration ***//

subInfo[5][1] = new Array(" Farmington Police Station","http://www.lzarch.com/projects/civic/farmington/farmington.html","_parent");
subInfo[5][2] = new Array(" Birmingham Fire Station","http://www.lzarch.com/projects/civic/birmingham/birmingham.html","_parent");
subInfo[5][3] = new Array(" AATA Bus Shelters","http://www.lzarch.com/projects/civic/bus/bus.html","_parent");
subInfo[5][4] = new Array(" Street Exhibits","http://www.lzarch.com/projects/civic/street/street.html","_parent");
subInfo[5][5] = new Array(" Synagogue-Lubavitch","http://www.lzarch.com/projects/civic/sclj/sclj.html","_parent");
subInfo[5][6] = new Array(" Affirmations","http://www.lzarch.com/projects/civic/affirm/affirm.html","_parent");

//*** park Drop Down Configuration ***//

subInfo[6][1] = new Array(" Chester Structure","http://www.lzarch.com/projects/park/chester/chester.html","_parent");
subInfo[6][2] = new Array(" Glen Structure","http://www.lzarch.com/projects/park/glen/glen.html","_parent");
subInfo[6][3] = new Array(" Forest Structure","http://www.lzarch.com/projects/park/forest/forest.html","_parent");

//*** prefab Drop Down Configuration ***//

subInfo[7][1] = new Array(" Modular","http://www.lzarch.com/projects/prefab/modular/modular.html","_parent");
subInfo[7][2] = new Array(" Branch Banks","http://www.lzarch.com/projects/prefab/banks/banks.html","_parent");
subInfo[7][3] = new Array(" Control Room","http://www.lzarch.com/projects/prefab/control/control.html","_parent");
subInfo[7][4] = new Array(" Hospital","http://www.lzarch.com/projects/prefab/hospital/hospital.html","_parent");
subInfo[7][5] = new Array(" Housing","http://www.lzarch.com/projects/prefab/housing/housing.html","_parent");


//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 4;
var ySubOffset = 23;



//*** 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();

