// FILENAME:	ep_navigation.js
//
// DATE:		2005/10/06
//
// PROGRAMMER:	Jervis Thompson (http://www.epvisual.com)
//
// DESCRIPTION:	Javascript array based html navigation.
//
//
//
//

///////////////////////////////////////// GLOBAL VARIABLES ///////////////////////////////////////
//

gNavNamesArray = new Array("g_01.cfm", "g_02.cfm","g_02b.cfm", "g_03.cfm", "g_04.cfm", "g_05.cfm", "g_06.cfm", "g_07.cfm", "g_08.cfm", "a_01.cfm", "a_02.cfm", "a_03.cfm", "a_04.cfm", "a_05.cfm", "a_06.cfm", "a_07.cfm", "a_08.cfm", "a_09.cfm", "a_09b.cfm", "a_10.cfm", "b_01.cfm", "b_02.cfm", "b_03.cfm", "b_04.cfm", "b_05.cfm", "b_06.cfm", "b_06b.cfm", "b_07.cfm", "b_09.cfm", "b_10.cfm", "b_11.cfm", "b_11b.cfm", "b_12.cfm", "b_13.cfm", "c_01.cfm", "c_01a.cfm", "c_01b.cfm", "c_01c.cfm", "c_01d.cfm", "c_01e.cfm", "c_02.cfm", "c_03.cfm", "c_04.cfm", "c_05.cfm", "c_05b.cfm", "c_06.cfm", "c_07.cfm", "c_08.cfm", "c_09.cfm", "c_10.cfm", "c_10b.cfm", "c_11.cfm", "c_12.cfm", "c_13.cfm", "c_14.cfm", "c_15.cfm", "c_16.cfm", "c_17.cfm");
					  

//////////////////////////////////////////// FUNCTIONS ///////////////////////////////////////////
//

function epFindIndexof(tmpArray, tmpValue)
{
	for (var lp = 0; lp <= tmpArray.length; lp ++) {
		if (tmpArray[lp] == tmpValue) {
			return lp;
		}
	}
	return -1;
}


function epAdvNextPage(token)
{
	// Extract filename from broswer window location
	//
	vCurrFname = window.location.pathname.substring(window.location.pathname.lastIndexOf("/")+1, window.location.pathname.length);	
	
	// Compute current postion in array
	//
	xCurrArrayPostion = epFindIndexof(gNavNamesArray, vCurrFname);
	
	if (xCurrArrayPostion == -1) {
		alert("The current file name is not in the nav array.. " + vCurrFname);
	} else if (xCurrArrayPostion == (gNavNamesArray.length-1)) {
		alert("You are on the last screen.");
	} else {
		vNextFname = gNavNamesArray[(xCurrArrayPostion+1)];
		window.location = vNextFname + '?' + token;
	}
}


function epAdvPrevPage(token)
{
	// Extract filename from broswer window location
	//
	vCurrFname = window.location.pathname.substring(window.location.pathname.lastIndexOf("/")+1, window.location.pathname.length);	
	
	// Compute current postion in array
	//
	xCurrArrayPostion = epFindIndexof(gNavNamesArray, vCurrFname);
	
	if (xCurrArrayPostion == -1) {
		alert("The current file name is not in the nav array.. " + vCurrFname);
	} else if (xCurrArrayPostion == 0) {
		alert("You are on the first screen.");
	} else {
		vNextFname = gNavNamesArray[(xCurrArrayPostion-1)];
		window.location = vNextFname + '?' + token;
	}
}
