﻿/*** 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","button8up.gif","button9up.gif","button10up.gif","button11up.gif","button12up.gif");

overSources = new Array("button1over.gif","button2over.gif","button3over.gif","button4over.gif","button5over.gif","button6over.gif","button7over.gif","button8over.gif","button9over.gif","button10over.gif","button11over.gif","button12over.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();
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[2][1] = new Array("Team Blog","http://blog.OremDodgers.com","");
subInfo[2][2] = new Array("Author Access","https://app.quickblogcast.com/","");


subInfo[3][1] = new Array("Game Schedule","http://www.OremDodgers.com/schedule.html","");
subInfo[3][2] = new Array("Game Summaries","http://www.OremDodgers.com/games.html","");
subInfo[3][3] = new Array("--#14 Padres","http://www.OremDodgers.com/G14Padres.html","");
subInfo[3][4] = new Array("--#13 Nationals","http://www.OremDodgers.com/G13Nationals.html","");
subInfo[3][5] = new Array("--#12 Rangers","http://www.OremDodgers.com/G12Rangers.html","");
subInfo[3][6] = new Array("--#11 Red Sox","http://www.OremDodgers.com/G11RedSox.html","");
subInfo[3][7] = new Array("--#10 Cardinals","http://www.OremDodgers.com/G10Cardinals.html","");
subInfo[3][8] = new Array("--#9 Padres","http://www.OremDodgers.com/G09Padres.html","");
subInfo[3][9] = new Array("--#8 Angels","http://www.OremDodgers.com/G08Angels.html","");
subInfo[3][10] = new Array("--#7 Yankees","http://www.OremDodgers.com/G07Yankees.html","");
subInfo[3][11] = new Array("--#6 Mariners","http://www.OremDodgers.com/G06Mariners.html","");
subInfo[3][12] = new Array("--#5 WhiteSox","http://www.OremDodgers.com/G05WhiteSox.html","");
subInfo[3][13] = new Array("--#4 Nationals","http://www.OremDodgers.com/G04Nationals.html","");
subInfo[3][14] = new Array("--#3 Cardinals","http://www.OremDodgers.com/G03Cardinals.html","");
subInfo[3][15] = new Array("--#2 Cubs","http://www.OremDodgers.com/G02Cubs.html","");
subInfo[3][16] = new Array("--#1 Cubs","http://www.OremDodgers.com/G01Cubs.html","");
subInfo[3][17] = new Array("Practice","http://www.OremDodgers.com/practice.html","");
subInfo[3][18] = new Array("Feedback","http://www.OremDodgers.com/feedback.html","");


subInfo[4][1] = new Array("Players","http://www.OremDodgers.com/players.html","");
subInfo[4][2] = new Array("Roster","http://www.OremDodgers.com/roster.html","");
subInfo[4][3] = new Array("Players Only","http://www.oremdodgers.com/Password/players.html","");

subInfo[5][1] = new Array("Coaches ","http://www.OremDodgers.com/coaches.html","");

subInfo[6][1] = new Array("Hot Topics","http://www.OremDodgers.com/hottopics.html","");
subInfo[6][2] = new Array("Team Blog","http://blog.OremDodgers.com","");
subInfo[6][3] = new Array("Feedback","http://www.OremDodgers.com/feedback.html","");
subInfo[6][4] = new Array("Coaches Meeting","http://www.OremDodgers.com/coachesmeeting.html","");
subInfo[6][5] = new Array("Refreshments","http://www.OremDodgers.com/refreshment.html","");
subInfo[6][6] = new Array("Protect Arms","http://www.OremDodgers.com/protectarm.html","");
subInfo[6][7] = new Array("Parent Orientation","http://www.OremDodgers.com/parentorientation.html","");
subInfo[6][8] = new Array("Parent Pledge","http://www.OremDodgers.com/parentorientation.html","");

subInfo[7][1] = new Array("Games","http://www.OremDodgers.com/games.html","");
subInfo[7][2] = new Array("Feedback","http://www.OremDodgers.com/feedback.html","");

subInfo[8][1] = new Array("Game Pics","http://www.OremDodgers.com/photos.html","");
subInfo[8][2] = new Array("Practice Pics","http://www.OremDodgers.com/photospractice.html","");

subInfo[9][1] = new Array("Roster","http://www.OremDodgers.com/roster.html","");
subInfo[9][2] = new Array("Players Only","http://www.oremdodgers.com/Password/players.html","");

subInfo[10][1] = new Array("Quotes","http://www.OremDodgers.com/quotes.html","");
subInfo[10][2] = new Array("Team Blog","http://blog.OremDodgers.com","");

subInfo[11][1] = new Array("Links","http://www.OremDodgers.com/links.html","");
subInfo[11][2] = new Array("Team Blog","http://blog.OremDodgers.com","");

subInfo[12][1] = new Array("Contact Us","http://www.OremDodgers.com/contact.html","");
subInfo[12][2] = new Array("Contact League","http://www.OremDodgers.com/contact.html","");
subInfo[12][3] = new Array("Feedback","http://www.OremDodgers.com/feedback.html","");
subInfo[12][4] = new Array("Team Blog","http://blog.OremDodgers.com","");



//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 135;
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();

