/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder_Menu1 = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources_Menu1 = new Array("button1up_Menu1.png","button2up_Menu1.png","button3up_Menu1.png","button4up_Menu1.png","button5up_Menu1.png","button6up_Menu1.png","button7up_Menu1.png","button8up_Menu1.png");

overSources_Menu1 = new Array("button1over_Menu1.png","button2over_Menu1.png","button3over_Menu1.png","button4over_Menu1.png","button5over_Menu1.png","button6over_Menu1.png","button7over_Menu1.png","button8over_Menu1.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo_Menu1 = new Array();
subInfo_Menu1[1] = new Array();
subInfo_Menu1[2] = new Array();
subInfo_Menu1[3] = new Array();
subInfo_Menu1[4] = new Array();
subInfo_Menu1[5] = new Array();
subInfo_Menu1[6] = new Array();
subInfo_Menu1[7] = new Array();
subInfo_Menu1[8] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//

subInfo_Menu1[2][1] = new Array("Welcome","http://www.moultriefirst.org/welcome.html","");
subInfo_Menu1[2][2] = new Array("About the Church","http://www.moultriefirst.org/about_the_church.html","");
subInfo_Menu1[2][3] = new Array("History","http://www.moultriefirst.org/history.html","");
subInfo_Menu1[2][4] = new Array("Purpose","http://www.moultriefirst.org/purpose.html","");
subInfo_Menu1[2][5] = new Array("Beliefs","http://www.moultriefirst.org/beliefs.html","");
subInfo_Menu1[2][6] = new Array("Values","http://www.moultriefirst.org/values.html","");
subInfo_Menu1[2][7] = new Array("FAQ","http://www.moultriefirst.org/faq.html","");

subInfo_Menu1[3][1] = new Array("Calendar","http://www.moultriefirst.org/calendar.html","");
subInfo_Menu1[3][2] = new Array("Worship Times","http://www.moultriefirst.org/schedule.html","");
subInfo_Menu1[3][3] = new Array("Officers","http://www.moultriefirst.org/officers.html","");
subInfo_Menu1[3][4] = new Array("Directions","http://www.moultriefirst.org/directions.html","");
subInfo_Menu1[3][5] = new Array("Prayer Requests","http://www.moultriefirst.org/prayer_requests.html","");
subInfo_Menu1[3][6] = new Array("Facebook","https://www.facebook.com/group.php?gid=30163050997&ref=ts","");
subInfo_Menu1[3][7] = new Array("Contact Us","http://www.moultriefirst.org/contact_us.html","");

subInfo_Menu1[4][1] = new Array("Missions","http://www.moultriefirst.org/missions.html","");
subInfo_Menu1[4][2] = new Array("Sunday School","http://www.moultriefirst.org/sundayschool.html","");
subInfo_Menu1[4][3] = new Array("Children's Ministries","http://www.moultriefirst.org/INC.html","");
subInfo_Menu1[4][4] = new Array("Youth Ministries","http://www.moultriefirst.org/nyi.html","");
subInfo_Menu1[4][5] = new Array("Women Ministries","http://www.moultriefirst.org/lift.html","");
subInfo_Menu1[4][6] = new Array("Men's Ministries","http://www.moultriefirst.org/men.html","");

subInfo_Menu1[5][1] = new Array("Ecards","http://thefarmersplace.org/coppermine/","");
subInfo_Menu1[5][2] = new Array("Downloads","http://www.moultriefirst.org/download_zone.html","");
subInfo_Menu1[5][3] = new Array("Study Aids","http://thefarmersplace.org/study_aids.html","");
subInfo_Menu1[5][4] = new Array("Salvation","http://www.moultriefirst.org/salvation.html","");





//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset_Menu1 = 120;
var ySubOffset_Menu1 = 7;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub_Menu1 = false;
var delay_Menu1 = 1000;
totalButtons_Menu1 = upSources_Menu1.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons_Menu1; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo_Menu1[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '_Menu1">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '_Menu1" class="dropmenu_Menu1" ');
		document.write('onMouseOver="overSub_Menu1=true;');
		document.write('setOverImg_Menu1(\'' + (x+1) + '\',\'_Menu1\');"');
		document.write('onMouseOut="overSub_Menu1=false;');
		document.write('setTimeout(\'hideSubMenu_Menu1(\\\'submenu' + (x+1) + '_Menu1\\\')\',delay_Menu1);');
		document.write('setOutImg_Menu1(\'' + (x+1) + '\',\'_Menu1\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo_Menu1[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo_Menu1[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo_Menu1[x+1][k+1][2] + '">');
			document.write( subInfo_Menu1[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_Menu1() {
	for ( x=0; x<totalButtons_Menu1; x++ ) {
		buttonUp_Menu1 = new Image();
		buttonUp_Menu1.src = buttonFolder_Menu1 + upSources_Menu1[x];
		buttonOver_Menu1 = new Image();
		buttonOver_Menu1.src = buttonFolder_Menu1 + overSources_Menu1[x];
	}
}

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

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



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

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

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu_Menu1(subID, buttonID) {
	hideAllSubMenus_Menu1();
	butX = getRealLeft_Menu1(buttonID);
	butY = getRealTop_Menu1(buttonID);
	moveObjectTo_Menu1(subID,butX+xSubOffset_Menu1, butY+ySubOffset_Menu1);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus_Menu1() {
	for ( x=0; x<totalButtons_Menu1; x++) {
		moveObjectTo_Menu1("submenu" + (x+1) + "_Menu1",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu_Menu1(subID) {
	if ( overSub_Menu1 == false ) {
		moveObjectTo_Menu1(subID,-500, -500);
	}
}



//preload_Menu1();


