//JavaScript
//Javascript code for menu button rollover/rollout
//and preload of images
//and makes menus on home.htm appear

function Do_BG()
{
	var scr_height = screen.availHeight;
	window.resizeTo( 800, scr_height );
}


if( document.images )
{
	var whoweare_btn = PreLoad( 'wwa' );			//pre-loading all the images, so they don't have to load
	var resources_btn = PreLoad( 'res' );			//when the user actually places the mouse over them,
	var prayer_btn = PreLoad( 'prayer' );			//by loading them into a var for each one
	var travel_btn = PreLoad( 'travel' );
	var media_btn = PreLoad( 'media' );
}

function PreLoad( btn )
{

	var img_path = "graphics/buttons/";			//file path to find button images
	var temp = new Array();
	
	temp[ 0 ] = new Image();				//don't know which image we're actually loading
	temp[ 1 ] = new Image();				//so format temp to hold an image, any image
											//then we can use .src to load each button img
	temp[ 0 ].src = img_path + "home_" + btn + "_btn1.gif";		//first version: no mouse over image
	temp[ 1 ].src = img_path + "home_" +  btn + "_btn2.gif";		//second version: mouse over image

	return temp;
}

function Swap( btn, mouse_on )				//reads img name from page and which version of the img 
{
	var btn_name = ( "menu_" + btn );		//(mouse_on) then inserts correct one	

	if( document.images )
	{	
		var temp = eval( btn + "_btn" );
	
		document[ btn_name ].src = temp[ mouse_on ].src;
	}
}

function Menu( menu )
{
	var menu_div = document.getElementById( "contents" );

	var whoweare = "<a href=\"whoweare.pl\">WHO WE ARE</a><br /> "+
				"<a href=\"whoweare.pl\#introduction\">=> introduction</a><br /> "+
				"<a href=\"whoweare.pl\#contact_info\">=> contact info</a><br />"+
				"<a href=\"whoweare.pl\#tax\">=> tax exempt status</a><br />"+
				"<a href=\"whoweare.pl\#purpose_statement\">=> purpose statement</a><br />"+
				"<a href=\"whoweare.pl\#mission_statement\">=> mission statement</a><br />"+
				"<a href=\"whoweare.pl\#core_values\">=> core values</a><br />"+
				"<a href=\"whoweare.pl\#statement_faith\">=> statement of faith</a><br />"+
				"<a href=\"whoweare.pl\#board_advisors\">=> board & advisors</a><br />"+
				"<a href=\"whoweare.pl\#vision_for_ministry\">=> vision for ministry</a><br />"+
				"<a href=\"whoweare.pl\#goals_objectives\">=> goals and objectives</a><br />"+
				"<a href=\"whoweare.pl\#partner\">=> how can you partner?</a><br />"+
				"<a href=\"whoweare.pl\#child_protection\">=> child protection policy</a>";
	var resources = "<a href=\"resources.pl\">RESOURCES</a><br /> "+
						"<a href=\"resources.pl\#articles\">=> articles</a><br />"+
						"<a href=\"resources.pl\#books_other_info\">=> books & other info</a><br />"+
						"<a href=\"resources.pl\#on_leadership\">=> on leadership</a><br />"+
						"<a href=\"resources.pl\#teaching_outlines\">=> teaching outlines</a><br />"+
						"<a href=\"resources.pl\#tools_for_min\">=> tools for ministry</a><br />"+
						"<a href=\"resources.pl\#tools_for_personal\">=> tools for personal</a><br />"+
						"<a href=\"resources.pl\#links\">=> links</a>";
	var prayer = "<a href=\"prayer.pl\">PRAYER REQUESTS</a><br /> "+
					"<a href=\"prayer.pl\#carters_ministry_cal\">=> carter's min. calender</a><br />"+
					"<a href=\"prayer.pl\#email_updates\">=> e-mail updates</a><br />"+
					"<a href=\"prayer.pl\#prayer_update\">=> prayer letter</a>";
	var travel = "<a href=\"travel.pl\">MISSION & TRAVEL</a><br /> "+
					"<a href=\"travel.pl\#carters_ministry_cal\">=> carter's min. calender</a><br />"+
					"<a href=\"travel.pl\#short_term_opp\">=> short term opp's</a><br />"+
					"<a href=\"travel.pl\#information_on_europe\">=> information on europe</a>";
	var media = "<a href=\"media.pl\">PHOTOS / VIDEOS</a><br /> "+
					"<a href=\"media.pl\#photo_albums\">=> photo albums</a><br />"+
					"<a href=\"media.pl\#videos\">=> videos</a>";
	var opening_message = "<b>Welcome to the Discipling the Nations website!<br>"+
							"<br />"+
							"Please take some time to browse around the site, using the"+
							" links to the left!</b>";

	if( menu == 'body' )
	{
		menu_div.innerHTML = opening_message;
		menu_div.style.background = "#000000";
		menu_div.style.width = "160px";
		menu_div.style.height = "128px";
	}
	else
	{
		if( menu == "whoweare" )
		{
			menu_div.innerHTML = whoweare;
			menu_div.style.background = "#FFFFFF";
			menu_div.style.width = "160px";
			menu_div.style.height = "208px";
		}
		if( menu == "resources" )
		{
			menu_div.innerHTML = resources;
			menu_div.style.background = "#FFFFFF";
			menu_div.style.width = "160px";
			menu_div.style.height = "125px";
		}
		if( menu == "prayer" )
		{
			menu_div.innerHTML = prayer;
			menu_div.style.background = "#FFFFFF";
			menu_div.style.width = "160px";
			menu_div.style.height = "89px";
		}
		if( menu == "travel" )
		{
			menu_div.innerHTML = travel;
			menu_div.style.background = "#FFFFFF";
			menu_div.style.width = "160px";
			menu_div.style.height = "89px";
		}
		if( menu == "media" )
		{
			menu_div.innerHTML = media;
			menu_div.style.background = "#FFFFFF";
			menu_div.style.width = "160px";
			menu_div.style.height = "89px";
		}
	}
}