/*** 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","button12up.png","button13up.png","button14up.png","button15up.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","button12over.png","button13over.png","button14over.png","button15over.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();
subInfo[12] = new Array();
subInfo[13] = new Array();
subInfo[14] = new Array();
subInfo[15] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//






subInfo[7][1] = new Array("Jesus\' Leadership Style","../et/page3.htm","");
subInfo[7][2] = new Array("Humility","../dl/humility.htm","");
subInfo[7][3] = new Array("Building Trust","../dl/trust.htm","");
subInfo[7][4] = new Array("Maintaining Integrity","../dl/integrity.htm","");
subInfo[7][5] = new Array("Servant Leadership","../servantleadership/index.htm","");
subInfo[7][6] = new Array("Servant Leadership and Servanthood","../Trainingbox/Servant%20Leadership.pdf","");
subInfo[7][7] = new Array("Forgiveness","../Trainingbox/Leadership%20and%20Forgiveness.pdf","");
subInfo[7][8] = new Array("Ready to Obey and Serve","../Trainingbox/Ready%20to%20Obey%20and%20Serve.pdf","");
subInfo[7][9] = new Array("Why is Leadership Important?","../why.htm","");
subInfo[7][10] = new Array("Leadership Model","../leadership/model.htm","");
subInfo[7][11] = new Array("Handling Conflict","../et/page8.htm","");
subInfo[7][12] = new Array("Bible Study:Conflict","../conflict/conflict1.htm","");
subInfo[7][13] = new Array("Handling Conflict Situations","../conflict/resolution.htm","");
subInfo[7][14] = new Array("Characteristics of Stategic Leaders","../sv/characte.htm","");
subInfo[7][15] = new Array("Bible Study:Strategy","../sv/strategy.htm","");
subInfo[7][16] = new Array("Risk","../sv/risk.htm","");
subInfo[7][17] = new Array("Evaluation Options","../sv/evaluati.htm","");
subInfo[7][18] = new Array("Tool:SWOT Analysis","../sv/swotanalysis.htm","");

subInfo[8][1] = new Array("Time Management","../sv/timemgnt.htm","");
subInfo[8][2] = new Array("Project Management","../Trainingbox/project.htm","");
subInfo[8][3] = new Array("Media Skills","../mat/media.htm","");
subInfo[8][4] = new Array("Understanding Paradigms","../leadership/paradigm.htm","");
subInfo[8][5] = new Array("Proactive Leadership","../leadership/proactive.htm","");
subInfo[8][6] = new Array("Jesus\' Leadership Style","../dl/jesus.htm","");
subInfo[8][7] = new Array("Spiritual Defences","../Trainingbox/Shield%20of%20Victory.pdf","");

subInfo[9][1] = new Array("Bible Study: Nehemiah","../vl/nehemiah.htm","");
subInfo[9][2] = new Array("A Process for Developing Vision","../vl/vl4proc.htm","");
subInfo[9][3] = new Array("Praying Through Vision","../ep/prayvis.htm","");
subInfo[9][4] = new Array("Thinking It","../vl/vlindex.htm","");
subInfo[9][5] = new Array("Writing It","../vl/vl3vlead.htm","");
subInfo[9][6] = new Array("Presenting It","../vl/vl2bibm.htm","");
subInfo[9][7] = new Array("Living It","../mat/page8.htm","");
subInfo[9][8] = new Array("Sharing It","../vl/vl5pray.htm","");
subInfo[9][9] = new Array("Biblical View of Strategy","../sv/strategy.htm","");
subInfo[9][10] = new Array("Being Salt & Light","../mat/saltand.htm","");
subInfo[9][11] = new Array("Vision Killers","../Trainingbox/Vision%20Killers.pdf","");

subInfo[10][1] = new Array("Mission and Vision","../et/mission.htm","");
subInfo[10][2] = new Array("Team Process","../et/teampro.htm","");
subInfo[10][3] = new Array("Teambuilding","../et/page2.htm","");
subInfo[10][4] = new Array("Team in Acts","../et/page3.htm","");
subInfo[10][5] = new Array("Delegation","../et/page7.htm","");
subInfo[10][6] = new Array("Unlocking Diversity","../et/page4.htm","");
subInfo[10][7] = new Array("Handling Conflict","../et/page8.htm","");
subInfo[10][8] = new Array("Team Leadership","../et/page5.htm","");
subInfo[10][9] = new Array("Team Membership","../et/members.htm","");
subInfo[10][10] = new Array("Team Health Checks","../et/page10.htm","");
subInfo[10][11] = new Array("Team in Acts","../et/page3.htm","");
subInfo[10][12] = new Array("Conflict","../conflict/conflict1.htm","");
subInfo[10][13] = new Array("Bodybuilding","../Trainingbox/bodybuil.htm","");

subInfo[11][1] = new Array("Share the Vision for Change","../ic/vision.htm","");
subInfo[11][2] = new Array("Form a Change Team","../ic/team.htm","");
subInfo[11][3] = new Array("Deciding the Strategy for Change","../ic/strategy.htm","");
subInfo[11][4] = new Array("Implementation","../ic/reactions.htm","");
subInfo[11][5] = new Array("What Else? Other Factors to Consider","../ic/elements.htm","");
subInfo[11][6] = new Array("Review","../ic/review.htm","");
subInfo[11][7] = new Array("Influencing Society","../mat/influenc.htm","");
subInfo[11][8] = new Array("Bible Study: Salt and Light","../mat/saltand.htm","");

subInfo[12][1] = new Array("Organisational Involvement","../mat/page2.htm","");
subInfo[12][2] = new Array("Building Trust","../mat/page4.htm","");
subInfo[12][3] = new Array("Organisational Values","../mat/page6.htm","");
subInfo[12][4] = new Array("Developing Individuals","../coaching/leaders.htm","");
subInfo[12][5] = new Array("Mapping out the Church\'s Gifting","../coaching/overview.htm","");
subInfo[12][6] = new Array("The Step Development Plan","../coaching/process.htm","");
subInfo[12][7] = new Array("Coaching Tips","../coaching/tips.htm","");
subInfo[12][8] = new Array("Coaching vs Mentoring","../coaching/coaching.htm","");

subInfo[13][1] = new Array("Developing a Prayer Strategy","../ep/praystrat.htm","");
subInfo[13][2] = new Array("Building Intercession for Leaders","../ff/ffindex.htm","");
subInfo[13][3] = new Array("How to Pray for your Leader","../ep/pastor.htm","");
subInfo[13][4] = new Array("Prayer in Neighbourhoods","../ep/prayerin.htm","");
subInfo[13][5] = new Array("On our Knees: Prayer Survey","../ep/onour.htm","");




//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 165;
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();

