// JavaScript Document
var fileNameArr = new Array("","index.cfm","introduction.cfm","r_index.cfm","r_case1.cfm","r_discuss.cfm","r_principles.cfm","t_index.cfm","t_case1.cfm","t_case2.cfm","t_discuss.cfm","c_index.cfm","c_case1.cfm","c_discuss.cfm","test.cfm");

var thePath, thePathForward, thePathBack;

function findIndex() {
	var theFile = document.URL
	thePath = theFile.substring(0,theFile.lastIndexOf('/')+1);
	theFile = theFile.substring(theFile.lastIndexOf('/')+1);
	//alert("the filename="  + theFile);
	for (i=0; i < fileNameArr.length; ++i) {
		if (fileNameArr[i] == theFile) {
			return i;
		}
	}
	return "noMatch";
}

function goPage(theDirection) {
	var theIndex = findIndex();
	if (theIndex == "noMatch") {
		alert("No matching item in array. Check filename.");
		
	} else {
		if (theDirection == "forward") {
			theIndex = parseInt(theIndex) + 1	
		} else {	//go backwards
			theIndex = parseInt(theIndex) - 1			
		}
	}
	thePath = fileNameArr[theIndex];
	setTimeout("window.location = thePath;", 100);  
}
