﻿/*** 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("Hot Topics","http://www.thehomeinspector.com/Sites/Dodgers/hottopics.html","");
subInfo[2][2] = new Array("Season Summary","http://www.thehomeinspector.com/Sites/Dodgers/Summary.html","");
subInfo[2][3] = new Array("Feedback Form","http://www.thehomeinspector.com/Sites/Dodgers/feedback.html","");
subInfo[2][4] = new Array("Coaches Meeting","http://www.thehomeinspector.com/Sites/Dodgers/coachesmeeting1.html","");
subInfo[2][5] = new Array("Refreshments","http://www.thehomeinspector.com/Sites/Dodgers/refreshment.html","");
subInfo[2][6] = new Array("Protect Arms","http://www.thehomeinspector.com/Sites/Dodgers/protectarm.html","");
subInfo[2][7] = new Array("Parent Orientation","http://www.thehomeinspector.com/Sites/Dodgers/parentorientation.html","");
subInfo[2][8] = new Array("Parent Pledge","http://www.thehomeinspector.com/Sites/Dodgers/parentorientation.html","");

subInfo[3][1] = new Array("Game Schedule","http://www.thehomeinspector.com/Sites/Dodgers/schedule.html","");
subInfo[3][2] = new Array("Tournament","http://www.thehomeinspector.com/Sites/Dodgers/TournamentGroupAJuniors.pdf","_blank");
subInfo[3][3] = new Array("Games","http://www.thehomeinspector.com/Sites/Dodgers/games.html","");
subInfo[3][4] = new Array("Season Summary","http://www.thehomeinspector.com/Sites/Dodgers/Summary.html","");
subInfo[3][5] = new Array("Feedback Form","http://www.thehomeinspector.com/Sites/Dodgers/feedback.html","");


subInfo[4][1] = new Array("Players","http://www.thehomeinspector.com/Sites/Dodgers/players.html","");
subInfo[4][2] = new Array("Roster","http://www.thehomeinspector.com/Sites/Dodgers/roster.html","");
subInfo[4][3] = new Array("Aaron","http://www.thehomeinspector.com/Sites/Dodgers/YAaron.html","_blank");
subInfo[4][4] = new Array("Adam","http://www.thehomeinspector.com/Sites/Dodgers/YAdam.html","_blank");
subInfo[4][5] = new Array("Brian","http://www.thehomeinspector.com/Sites/Dodgers/YBrian.html","_blank");
subInfo[4][6] = new Array("Dylan","http://www.thehomeinspector.com/Sites/Dodgers/YDylan.html","_blank");
subInfo[4][7] = new Array("Elijah","http://www.thehomeinspector.com/Sites/Dodgers/YElijah.html","_blank");
subInfo[4][8] = new Array("Jeremy","http://www.thehomeinspector.com/Sites/Dodgers/YJeremy.html","_blank");
subInfo[4][9] = new Array("Joshua","http://www.thehomeinspector.com/Sites/Dodgers/YJoshua.html","_blank");
subInfo[4][10] = new Array("Julian","http://www.thehomeinspector.com/Sites/Dodgers/YJulian.html","_blank");
subInfo[4][11] = new Array("Matt","http://www.thehomeinspector.com/Sites/Dodgers/YMatt.html","_blank");
subInfo[4][12] = new Array("Nathan","http://www.thehomeinspector.com/Sites/Dodgers/YNathan.html","_blank");
subInfo[4][13] = new Array("Nathaniel","http://www.thehomeinspector.com/Sites/Dodgers/YNathaniel.html","_blank");
subInfo[4][14] = new Array("Zach","http://www.thehomeinspector.com/Sites/Dodgers/YZach.html","_blank");
subInfo[4][15] = new Array("Aaron Leavitt","http://www.thehomeinspector.com/Sites/Dodgers/YAaronLeavitt.html","_blank");



subInfo[5][1] = new Array("Coaches ","http://www.thehomeinspector.com/Sites/Dodgers/coaches.html","");
subInfo[5][2] = new Array("Chuck","http://www.thehomeinspector.com/Sites/Dodgers/coaches.html","");
subInfo[5][3] = new Array("Michael","http://www.thehomeinspector.com/Sites/Dodgers/coaches.html","");
subInfo[5][4] = new Array("Matthew","http://www.thehomeinspector.com/Sites/Dodgers/coaches.html","");

subInfo[6][1] = new Array("Practice","http://www.thehomeinspector.com/Sites/Dodgers/practice.html","");

subInfo[7][1] = new Array("Games","http://www.thehomeinspector.com/Sites/Dodgers/games.html","");
subInfo[7][2] = new Array("Championship Preview","http://www.thehomeinspector.com/Sites/Dodgers/gtChampionshipPadresAPreview.html","");
subInfo[7][3] = new Array("Championship Game 1","http://www.thehomeinspector.com/Sites/Dodgers/gtChampionshipPadresA.html","");
subInfo[7][4] = new Array("Championship Game 2","http://www.thehomeinspector.com/Sites/Dodgers/gtChampionshipPadresB.html","");
subInfo[7][5] = new Array("Season Summary","http://www.thehomeinspector.com/Sites/Dodgers/Summary.html","");
subInfo[7][6] = new Array("Feedback Form","http://www.thehomeinspector.com/Sites/Dodgers/feedback.html","");

subInfo[8][1] = new Array("Games","http://www.thehomeinspector.com/Sites/Dodgers/photos.html","");
subInfo[8][2] = new Array("Practice","http://www.thehomeinspector.com/Sites/Dodgers/photospractice.html","");

subInfo[9][1] = new Array("Statistics","http://www.thehomeinspector.com/Sites/Dodgers/statistics.html","");

subInfo[10][1] = new Array("Quotes","http://www.thehomeinspector.com/Sites/Dodgers/quotes.html","");

subInfo[11][1] = new Array("Links","http://www.thehomeinspector.com/Sites/Dodgers/links.html","");

subInfo[12][1] = new Array("Contact Us","http://www.thehomeinspector.com/Sites/Dodgers/contact.html","");
subInfo[12][2] = new Array("Contact League","http://www.thehomeinspector.com/Sites/Dodgers/contact.html","");
subInfo[12][3] = new Array("Feedback Form","http://www.thehomeinspector.com/Sites/Dodgers/feedback.html","");


//*** 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();

