/*** 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","button10up.png","button11up.png","button12up.png");

overSources = new Array("button1over.png","button2over.png","button3over.png","button4over.png","button5over.png","button6over.png","button7over.png","button8over.png","button9over.png","button10over.png","button11over.png","button12over.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();
subInfo[10] = new Array();
subInfo[11] = new Array();
subInfo[12] = new Array();


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

subInfo[3][1] = new Array("Wallingford 07/07/10","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202010/07-07-10%20Wallingford/?albumview=grid","_blank");
subInfo[3][2] = new Array("Jakes Tavern 06/05/10","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202010/06-05-10%20Jakes%20Tavern/?albumview=grid","_blank");
subInfo[3][3] = new Array("Downtown Cafe 05/21/10","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202010/05-21-10%20Downtown%20Cafe/?albumview=grid","_blank");
subInfo[3][4] = new Array("Friends Cafe 05/07/10","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202010/05-07-10%20Friends%20Cafe/?albumview=grid","_blank");
subInfo[3][5] = new Array("The Main Pub 01/29/10","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202010/01-29-10%20Main%20Pub/?albumview=grid","_blank");
subInfo[3][6] = new Array("Downtown Cafe 12/18/09","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202009/12-18-09%20Downtown%20Cafe/?albumview=grid","_blank");
subInfo[3][7] = new Array("The Public 10/23/09","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202009/10-23-09%20The%20Public/?albumview=grid","_blank");
subInfo[3][8] = new Array("Leon's 10/02/09","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202009/10-02-09%20Leons/?albumview=grid","_blank");
subInfo[3][9] = new Array("Camp Overflow 09/06/09","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202009/09-06-09%20Camp%20Overflow/?albumview=grid","_blank");
subInfo[3][10] = new Array("The Main Pub 08/29/09","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202009/08-29-09%20Main%20Pub/?albumview=grid","_blank");
subInfo[3][11] = new Array("Joe Paul's 50th 08/22/09","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202009/08-22-09%20PigStock/?albumview=grid","_blank");
subInfo[3][12] = new Array("Wallingford 08/19/09","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202009/08-19-09%20Wallingford/?albumview=grid","_blank");
subInfo[3][13] = new Array("Harbor Park 08/15/09","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202009/08-15-09%20Harbor%20Park/?albumview=grid","_blank");
subInfo[3][14] = new Array("Downtown Cafe 06/19/09","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202009/06-19-09%20Downtown%20Cafe/?albumview=grid","_blank");
subInfo[3][15] = new Array("Sunset Ribs 06/14/09","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202009/06-14-09%20Sunset%20Ribs/?albumview=grid","_blank");
subInfo[3][16] = new Array("Black-Eyed Sally's 06/06/09","http://s75.photobucket.com/albums/i285/lcmarolda2/FBI%202009/06-06-09%20Black-Eyed%20Sallys/?albumview=grid","_blank");
subInfo[3][17] = new Array("Photo Archive","http://www.funkbrokers.com/PhotoArchive.html","_self");
subInfo[3][18] = new Array("Join the FBI Most Wanted","mailto:Info@FunkBrokers.com?subject=Subscribe&body=Please add me to the FBI Most Wanted e-mail list.","_self");

subInfo[4][1] = new Array("Lee-Ann Zarrella","http://www.funkbrokers.com/Lee-AnnBio.html","_self");
subInfo[4][2] = new Array("Chris Marolda","http://www.funkbrokers.com/ChrisBio.html","_self");
subInfo[4][3] = new Array("Jim Heetmann","http://www.funkbrokers.com/JimBio.html","_self");
subInfo[4][4] = new Array("Dave Lovelace","http://www.funkbrokers.com/DaveBio.html","_self");
subInfo[4][5] = new Array("Cole Christie","http://www.funkbrokers.com/ColeBio.html","_self");
subInfo[4][6] = new Array("Dennis O\'Neil","http://www.funkbrokers.com/DennisBio.html","_self");
subInfo[4][7] = new Array("Bob Sieracki","http://www.funkbrokers.com/BobBio.html","_self");
subInfo[4][8] = new Array("Amory Lester","http://www.funkbrokers.com/BrassBio2.html","_self");
subInfo[4][9] = new Array("The Bad-Ass Brass","http://www.funkbrokers.com/BrassBio.html","_self");
subInfo[4][10] = new Array("Kimberly Larche","http://www.funkbrokers.com/KimberlyBio.html","_self");
subInfo[4][11] = new Array("Tambourine Willie","http://www.funkbrokers.com/WillieBio.html","_self");

subInfo[6][1] = new Array("Details","http://www.funkbrokers.com/CIA.html","_self");
subInfo[6][2] = new Array("CIA Operations Sign Up","mailto:Info@FunkBrokers.com?subject=CIA Operations&body=I want to sit in with you guys.","_self");

subInfo[7][1] = new Array("Details","http://www.funkbrokers.com/TaskForce.html","_self");
subInfo[7][2] = new Array("Join the Task Force","mailto:Info@FunkBrokers.com?subject=Special Task Force&body=I want to join the FBI Special Task Force. How do I get started?","_self");


subInfo[10][1] = new Array("Info@FunkBrokers.com","mailto:Info@FunkBrokers.com","_self");
subInfo[10][2] = new Array("Join the E-mail List","mailto:Info@FunkBrokers.com?subject=FBI Most Wanted&body=Please add me to the FBI Most Wanted e-mail list.","_self");
subInfo[10][3] = new Array("Join the Street Team","mailto:Info@FunkBrokers.com?subject=Special Task Force&body=I want to join the FBI Special Task Force. How do I get started?","_self");
subInfo[10][4] = new Array("Take the CIA Challenge","mailto:Info@FunkBrokers.com?subject=CIA Operations&body=I want to sit in with you guys.","_self");
subInfo[10][5] = new Array("FBI on MySpace","http://www.myspace.com/funkbrokers","_blank");
subInfo[10][6] = new Array("FBI on Facebook","http://www.facebook.com/pages/Funk-Brokers-Inc-FBI/52777026255?ref=nf","_blank");
subInfo[10][7] = new Array("FBI on ReverbNation","http://www.reverbnation.com/funkbrokersincfbi","_blank");
subInfo[10][8] = new Array("FBI on Twitter","http://twitter.com/funkbrokers","_blank");




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



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

