// Script Library 01 for the Tehillah Worship Website - www.tehillah-worship.net
// copyright Robert Fisher, 24th February 2007.
// You may copy this code but please keep the copyright notice as well.

navimages = new Array()
navimages_sel = new Array()	

function populate() {
	//Sets up the all thumbs and images on the page in the startup positions.
		
	navimages[0] = "images/button_about.jpg";
	navimages[1] = "images/button_home.jpg";
	navimages[2] = "images/button_team.jpg";
	navimages[3] = "images/button_worship.jpg";
	navimages[4] = "images/button_links.jpg";
	navimages[5] = "images/button_contact.jpg";
	navimages_sel[0] = "images/button_about_sel.jpg";
	navimages_sel[1] = "images/button_home_sel.jpg";
	navimages_sel[2] = "images/button_team_sel.jpg";
	navimages_sel[3] = "images/button_worship)sel.jpg";
	navimages_sel[4] = "images/button_links_sel.jpg";
	navimages_sel[5] = "images/button_contact_sel.jpg";
	
	//-## Pre-load the nav and selected nav images:
	image_preloader(navimages);
	image_preloader(navimages_sel);
	
	thumb_mo(GLOBAL_thispage);
	
	setObjVis('navbar','visible');
	
}

function nav_mo(objID) {
	//runs the mouseover action for the navigation buttons...
	
	if (GLOBAL_thispage == "about" && objID == "about") {}       //Do nothing...		
	else if (GLOBAL_thispage == "home" && objID == "home") {}  //Do nothing...		
	else if (GLOBAL_thispage == "team" && objID == "team") {}  //Do nothing...		
	else if (GLOBAL_thispage == "worship" && objID == "worship") {}  //Do nothing...		
	else if (GLOBAL_thispage == "links" && objID == "links") {}  //Do nothing...		
	else if (GLOBAL_thispage == "contact" && objID == "contact") {}  //Do nothing...		
	else {
		thumb_mo(objID);  //makes use of the thumb mouse over code.
		}
}

function thumb_mo(objID) {
	// Runs from the onmouseover event of the thumbs.
	
	var imgsrc = getimagesrc(objID);
	var dotpos = imgsrc.lastIndexOf('.');
	var tempfilename = imgsrc.substring(0,dotpos);
	var tempfiletype = imgsrc.substring(dotpos,imgsrc.length);
	var newimgsrc = '';
			
	if (imgsrc.lastIndexOf('_sel.') == -1) {
		//This image is not a mouseover.
		newimgsrc = tempfilename + '_sel' + tempfiletype;
	}
	else {
		//This image is a mouseover already.
		newimgsrc = tempfilename.substring(0,tempfilename.length-4) + tempfiletype;
	}
	
//		alert("ObjID: " + objID + "  -- newimgsrc: " + newimgsrc);
	
	swapimage(objID, newimgsrc);
		
}

function nav_clk(objID) {
	
	
	if (GLOBAL_thispage == "about" && objID == "about") {}       //Do nothing...		
	else if (GLOBAL_thispage == "home" && objID == "home") {}  //Do nothing...		
	else if (GLOBAL_thispage == "team" && objID == "team") {}  //Do nothing...		
	else if (GLOBAL_thispage == "worship" && objID == "worship") {}  //Do nothing...		
	else if (GLOBAL_thispage == "links" && objID == "links") {}  //Do nothing...		
	else if (GLOBAL_thispage == "contact" && objID == "contact") {}  //Do nothing...		
	else {
		if (objID =='about') {
			window.location = 'about.html';
		}
		else if (objID =='home') {
			window.location = 'home.html';
		}
		else if (objID =='team') {
			window.location = 'team.html';
		}
		else if (objID =='worship') {
			window.location = 'worship.html';
		}
		else if (objID =='links') {
			window.location = 'links.html';			
		}
		else if (objID =='contact') {
			window.location = 'contact.html';
		}
	}
}
