/*** 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");

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");

// 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();


/**  HIGH SCHOOL TAB   **/
subInfo[1][1] = new Array("Future Students","../hs/new_students.html","");
subInfo[1][2] = new Array("Athletics","../hs/hs_athletics.html","");
subInfo[1][3] = new Array("Newsletter","../hs/hs_newsletter.html","");
subInfo[1][4] = new Array("Lunch Menu May","../ms/lunch menus/Hot_Lunch_Menu_May_2010.htm","");
subInfo[1][5] = new Array("Lunch Menu Jun","../ms/lunch menus/Hot_Lunch_Menu_Jun_2010.htm","");
subInfo[1][6] = new Array("School Calendar","../master_calendar.htm","");
subInfo[1][7] = new Array("Tuition","../general/tuition.html","");
subInfo[1][8] = new Array("Curriculum","../hs/hs_curriculum.html","");
subInfo[1][9] = new Array("Dress Code","../hs/Dress_code.pdf","");
subInfo[1][10] = new Array("Staff","../hs/hs_staff.html","");
subInfo[1][11] = new Array("Edline; Online Assignments & Grades","http://www.edline.net/pages/Our_Lady_of_the_Lakes_HS","");
subInfo[1][12] = new Array("Senior Info","../hs/seniors/index.html","");
subInfo[1][13] = new Array("Christian Service requirements","../hs/Christian_Service/christian_service_index.htm","");
subInfo[1][14] = new Array("Yearbook","../hs/Yearbook/index.html","");
subInfo[1][15] = new Array("Media Center","../Media/media_newsletter.htm","");
subInfo[1][16] = new Array("Student Council","../hs/Student_Council/Student%20Council%20page.htm","");
subInfo[1][17] = new Array("National Honor Society","../hs/NHS/honor.html","");
subInfo[1][18] = new Array("Drama Dept.","../drama/index_drama.html","");
subInfo[1][19] = new Array("TCA Study Guide-ACT Test Prep","http://www.tcaprep.com/studyguide/?school_code=1628135699","");
subInfo[1][20] = new Array("MEAP Scores","../general/MeapScores.html","");


/**  MIDDLE SCHOOL TAB   **/
subInfo[2][1] = new Array("Future Students","../ms/new_students.html","");
subInfo[2][2] = new Array("Athletics","../ms/ms_athletics.html","");
subInfo[2][3] = new Array("NewsLetter","../ms/ms_newsletter.htm","");
subInfo[2][4] = new Array("Lunch Menu May","../ms/lunch menus/Hot_Lunch_Menu_May_2010.htm","");
subInfo[2][5] = new Array("Lunch Menu Jun","../ms/lunch menus/Hot_Lunch_Menu_Jun_2010.htm","");
subInfo[2][6] = new Array("School Calendar","../master_calendar.htm","");
subInfo[2][7] = new Array("Tuition","../general/tuition.html","");
subInfo[2][8] = new Array("Curriculum","../ms/ms_curriculum.html","");
subInfo[2][9] = new Array("Dress Code","../ms/Dress_code.pdf","");
subInfo[2][10] = new Array("Staff","../ms/ms_staff.html","");
subInfo[2][11] = new Array("Edline; Online Assignments & Grades","http://www.edline.net/pages/Our_Lady_of_the_Lakes_HS","");
subInfo[2][12] = new Array("Christian Service requirements","../ms/Christian_Service/christian_service_index.htm","");
subInfo[2][13] = new Array("Media Center","../Media/media_newsletter.htm","");
subInfo[2][14] = new Array("NJHS","../ms/njhs.html","");
subInfo[2][15] = new Array("Drama Dept.","../drama/index_drama.html","");
subInfo[2][16] = new Array("Robotics","../ms/Robotics/index.html","");

/**  ELEMENTARY SCHOOL TAB   **/
subInfo[3][1] = new Array("PreSchool Info","../elem/Preschoolpage.pdf","");
subInfo[3][2] = new Array("PreK parent meeting","../elem/preKmeeting2010.pdf","");
subInfo[3][3] = new Array("Newsletter","../elem/elem_newsletter.html","");
subInfo[3][4] = new Array("Lunch Menu May","../elem/Lunch Menus/Lunch_Menu_May10.html","");
subInfo[3][5] = new Array("Lunch Menu June","../elem/Lunch Menus/Lunch_Menu_Jun10.html","");
subInfo[3][6] = new Array("School Calendar","../master_calendar.htm","");
subInfo[3][7] = new Array("Tuition","../general/tuition.html","");
subInfo[3][8] = new Array("Curriculum","../elem/Curriculum.htm","");
subInfo[3][9] = new Array("Dress Code","../elem/DressCodeElementary.pdf","");
subInfo[3][10] = new Array("Staff","../elem/elem_staff.html","");
subInfo[3][11] = new Array("Edline; Online Assignments & Grades","http://www.edline.net/pages/Our_Lady_of_the_Lakes_HS","");
subInfo[3][12] = new Array("Media Center","../elem/lib_newsletter_feb09.pdf","");
subInfo[3][13] = new Array("Parent Student Hand-book","../elem/ELEM%20HANDBOOK.htm","");

//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
/**  GENERAL TAB   **/
subInfo[4][1] = new Array("Admission","../general/admission.html","");
subInfo[4][2] = new Array("Map To School","../general/school_map.html","");
subInfo[4][3] = new Array("TRIP information","http://www.freewebs.com/olltrip","");
subInfo[4][4] = new Array("School Fight Song","../Fight_Song/index.html","");
subInfo[4][5] = new Array("About Us","../general/about.html","");
subInfo[4][6] = new Array("OLL Facebook - Learn About Lakes","http://www.facebook.com/pages/Waterford-MI/Waterford-Our-Lady-of-the-Lakes-School/88573851749?created",""); 


/**  MASTER CALENDAR TAB   **/
subInfo[5][1] = new Array("School Calendar","../master_calendar.htm","");

/**  SCHOOLBOARD TAB   **/
subInfo[6][1] = new Array("Information","../schoolboard/index.html","");
subInfo[6][2] = new Array("Meeting Minutes","../schoolboard/index.html#Meeting_Minutes","");

/**  BOOSTER TAB   **/
subInfo[7][1] = new Array("Information","../boosters/index.html","");
subInfo[7][2] = new Array("OLL Sports Registration Form","../boosters/Registration Form 2010-11 Update.pdf","");
subInfo[7][3] = new Array("Medical Release Forms","../boosters/MedicalTreatmentRelease.pdf","");
subInfo[7][4] = new Array("MHSAA Physical Form","http://www.mhsaa.com/resources/physical.pdf","");
subInfo[7][5] = new Array("High School Sports Schedules","../hs/hs_athletics.html","");
subInfo[7][6] = new Array("Middle School Sports Schedules","../ms/ms_athletics.html","");

/**  ALUMNI TAB   **/
subInfo[8][1] = new Array("Information","../alumni/index.html","");
subInfo[8][2] = new Array("2009-2010 Tuition Gift Application","../alumni/Tuition Gift Application 2008_2009.doc","");

/**  PTG TAB   **/
subInfo[9][1] = new Array("Information","../ptg/index.html","");


/**  DEVELOPMENT FUNDRAISERS   **/
subInfo[10][1] = new Array("Bowl-A-Fund","../BowlAFund/bowlafund.html",""); 
subInfo[10][2] = new Array("Silent Auction Information","../SilentAuction/auction_index.html","");
subInfo[10][3] = new Array("Brick by Brick Paver Program","../brick paver index.html","");


/**  LAKER2LAKER   **/
subInfo[11][1] = new Array("Laker2Laker Directory","../laker2laker/index.html","");


//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 99;
var ySubOffset = 10;



//*** 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();

