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

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_Menu = new Array("button1up_Menu.png","button2up_Menu.png","button3up_Menu.png","button4up_Menu.png","button5up_Menu.png","button6up_Menu.png","button7up_Menu.png");

overSources_Menu = new Array("button1over_Menu.png","button2over_Menu.png","button3over_Menu.png","button4over_Menu.png","button5over_Menu.png","button6over_Menu.png","button7over_Menu.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_Menu = new Array();
subInfo_Menu[1] = new Array();
subInfo_Menu[2] = new Array();
subInfo_Menu[3] = new Array();
subInfo_Menu[4] = new Array();
subInfo_Menu[5] = new Array();
subInfo_Menu[6] = new Array();
subInfo_Menu[7] = new Array();


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




subInfo_Menu[5][1] = new Array("Main Sponsors","Main_Sponsors.html","");
subInfo_Menu[5][2] = new Array("Supporters","Supporters.html","");

subInfo_Menu[6][1] = new Array("2011","2011.html","");
subInfo_Menu[6][2] = new Array("2010","2010.html","");
subInfo_Menu[6][3] = new Array("2009","2009.html","");
subInfo_Menu[6][4] = new Array("2008","2008.html","");



//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset_Menu = 5;
var ySubOffset_Menu = 21;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub_Menu = false;
var delay_Menu = 1000;
totalButtons_Menu = upSources_Menu.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons_Menu; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo_Menu[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '_Menu">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '_Menu" class="dropmenu_Menu" ');
		document.write('onMouseOver="overSub_Menu=true;');
		document.write('setOverImg_Menu(\'' + (x+1) + '\',\'_Menu\');"');
		document.write('onMouseOut="overSub_Menu=false;');
		document.write('setTimeout(\'hideSubMenu_Menu(\\\'submenu' + (x+1) + '_Menu\\\')\',delay_Menu);');
		document.write('setOutImg_Menu(\'' + (x+1) + '\',\'_Menu\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo_Menu[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo_Menu[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo_Menu[x+1][k+1][2] + '">');
			document.write( subInfo_Menu[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_Menu() {
	for ( x=0; x<totalButtons_Menu; x++ ) {
		buttonUp_Menu = new Image();
		buttonUp_Menu.src = buttonFolder_Menu + upSources_Menu[x];
		buttonOver_Menu = new Image();
		buttonOver_Menu.src = buttonFolder_Menu + overSources_Menu[x];
	}
}

// SET MOUSEOVER BUTTON
function setOverImg_Menu(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_Menu + overSources_Menu[But-1];
}

// SET MOUSEOUT BUTTON
function setOutImg_Menu(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder_Menu + upSources_Menu[But-1];
}



//*** SUB MENU FUNCTIONS ***//
// GET ELEMENT ID MULTI BROWSER
function getElement_Menu(id) {
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
}

// GET X COORDINATE
function getRealLeft_Menu(id) { 
	var el = getElement_Menu(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_Menu(id) {
	var el = getElement_Menu(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_Menu(objectID,x,y) {
	var el = getElement_Menu(objectID);
	el.style.left = x;
	el.style.top = y;
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu_Menu(subID, buttonID) {
	hideAllSubMenus_Menu();
	butX = getRealLeft_Menu(buttonID);
	butY = getRealTop_Menu(buttonID);
	moveObjectTo_Menu(subID,butX+xSubOffset_Menu, butY+ySubOffset_Menu);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus_Menu() {
	for ( x=0; x<totalButtons_Menu; x++) {
		moveObjectTo_Menu("submenu" + (x+1) + "_Menu",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu_Menu(subID) {
	if ( overSub_Menu == false ) {
		moveObjectTo_Menu(subID,-500, -500);
	}
}



//preload_Menu();


