database=new Array("main.htm","part_1.htm","part_2.htm","part_3.htm","part_4a.htm","part_4b.htm","part_4c.htm","part_5.htm","part_6.htm","part_7.htm", "bibli.htm");

NumberOfFiles=database.length;

function upDatePageInfo()
{
	StringA=parent.frames[2].location.href;
	LengthA=StringA.length
	A=StringA.lastIndexOf("/")+1;
	B=StringA.lastIndexOf("#");
	if (B==-1) 	//no target (bookmark) in link
		ThisFilename=StringA.substring(A,LengthA);
	else
		ThisFilename=StringA.substring(A,B);
	
	n=NumberOfFiles-1; //Find the page number

	for (var i = 0; i <= n; i++)
	{
		if (database[i]==ThisFilename)
			ThisPageNumber=i;
	}
}

function goBack()
{
	upDatePageInfo()
	//alert(ThisFilename + " Page number " + ThisPageNumber);

	if (ThisPageNumber-1<0)
	{
		//alert("You are at the beginning of the series")
	}
	else
	{
		parent.frames[2].location=database[ThisPageNumber-1];
		//alert("New location " + database[ThisPageNumber-1]);
	}
}

function goForward()
{
	upDatePageInfo();
	//alert(ThisFilename + " Page number " + ThisPageNumber);

	if (ThisPageNumber+1>n)
	{
		//answer = confirm("You are at the end of the series. Press OK to go to the start, or cancel to remain where you are");
		if (answer !=0)
		{
			parent.frames[2].location = "main.htm";
		}
	}
	else
	{
		parent.frames[2].location=database[ThisPageNumber+1];
		//alert("New location " + parent.frames[2].location);
	}
}


function goHome()
{
	parent.frames[2].location = "main.htm"
}




