// This file cycles through an array of links.  If the link references the current page, we display the text
// of the item only.  Otherwise, we display a link to the item.
var links_text = new Array ("Futures Goals", "About the Facilitator", "How to Register", "Retreat Home", "Futures Home");
var links = new Array ("goals", "facilitator", "register", "retreat", "http://www.ncat.edu/futures");
var links_url = new Array ("goals.html", "facilitator.html", "register.html", "retreat.html", "http://www.ncat.edu/futures/index.html");


function get_page_name () {
// Get URL of current page.  Convert it from object to string so we can work with it.
var loc = String (this.location); 
// loc is now http://www.ncat.edu/photo_gallery/springcomm02/pic1.html

// Replace slashes in URL with commas.  Also create an array that has each of the sections
// of the URL in one slot in the array.
loc=loc.split("/"); 
// loc is now http:,,www.ncat.edu,photo_gallery, springcomm02, pic1.html 
// Also:

// loc[0] = http:
// loc[1] = 
// loc[2] = www.ncat.edu
// loc[3] = photo_gallery
// loc[4] = springcomm02
// loc[5] = pic1.html

// Set loc to the last item in the array.
loc = loc[loc.length-1];
// loc is now pic1.html

// Create an array that splits pic1. and html apart from each other.
loc = loc.split(".");
// loc is now pic1, html
// loc[0] - pic1
// loc[1] = html

loc=loc[loc.length-2]; 
return (loc);
}


function get_page_num (page_name) {
	// This function returns the page number.  If the page name is pic1., this function
	// returns 1.  If the page name is 256., this function returns 256.
	var len, curr_page_number;
	len = page_name.length;
	curr_page_number = page_name.substring(3, len);
	return (curr_page_number);}
 
	var this_page_name = get_page_name();
//	document.write ("Page name:  " + this_page_name);

	var this_page_num = get_page_num(this_page_name);
//	document.write ("  Page number:  " + this_page_num);


	// Convert strings to integers, and compute prev and next pages.
	var curr_page_num = parseInt(this_page_num);
	var next_page_num = parseInt(this_page_num) + 1;
	var prev_page_num = parseInt(this_page_num) - 1;
	var pic1_num = (curr_page_num * 2) - 1;
	var pic2_num = curr_page_num * 2;

//	document.write ("Previous page:  " + prev_page_num + "     Next page:  " + next_page_num);
	
	var prev_page_name;
	if (curr_page_num == 1)
		prev_page_name = "index.html"
	else
		prev_page_name = "pic" + prev_page_num + ".html";

	var next_page_name = "pic" + next_page_num + ".html";
	var pic1_name = "images/pic" + pic1_num + ".jpg";
	var pic2_name = "images/pic" + pic2_num + ".jpg";
//	document.write ("Previous page name:  " + prev_page_name + "  Next page name:  " + next_page_name);
//	document.write ("Left picture name:   " + pic1_name + "       Right pic name:  " + pic2_name);
	
	function get_left_pic() {
		window.write ( '<img src="' + pic1_name + '">' ); 
	} 
