// JavaScript Document
var fileNameArr = new Array("","index.cfm","introduction.cfm","ic_index.cfm","ic_case1.cfm","ic_case1_discuss.cfm","ic_case2.cfm","ic_case2_discuss.cfm","ic_case3.cfm","ic_case3_discuss.cfm","ic_case3_principles.cfm","dpr_index.cfm","dpr_case4.cfm","dpr_case4_discuss.cfm","dpr_case4_principles.cfm","ds_index.cfm","ds_case5.cfm","ds_case5_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);  
}
