// JavaScript Document

var fileNameArr = new Array("","index.cfm","laser_b.cfm","laser_c.cfm","laser_d.cfm","laser_e.cfm","laser_f.cfm","incisional.cfm","incisional_b.cfm","incisional_c.cfm","intrastromal.cfm","intrastromal_a.cfm","intrastromal_b.cfm","phakic.cfm","phakic_b.cfm","phakic_c.cfm","phakic_d.cfm","phakic_e.cfm","refractive.cfm","bioptics.cfm","mixed.cfm","references.cfm","../v1m2/index.cfm");

var thePath, thePathForward, thePathBack;

function findIndex() {
	var theFile = document.URL
	thePath = theFile.substring(0,theFile.lastIndexOf('/')+1);
	theFile = theFile.substring(theFile.lastIndexOf('/')+1);
	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);  
}

