// JavaScript Document


//All you have to do is to add files to this list below:

//First get your list of files in the order you want them:

database=new Array("e61.html","e60.html","e59.html","e58.html","e57.html","e55.html","e53.html","e52.html","e51.html","e50.html","e49.html","e48.html","e47.html","e46.html","e45.html","e44.html","e43.html","e41.html","e40.html","e39.html","e38.html","e37.html","e36.html","e35.html","e34.html","e33.html","e32.html","e31.html","e30.html","e29.html","e28.html","e27.html","e26.html","e25.html","e24.html","e23.html","e22.html","e21.html","e20.html","e19.html","e18.html","e17.html","e16.html","e15.html","e14.html","e13.html","e12.html","e11.html","e10.html","e09.html","e08.html","e07.html","e06.html","e05.html","e04.html","e03.html","e02.html","e01.html");

//The above is all you need to change!

//We want to automatically discover the number of files

NumberOfFiles=database.length;

//Next find out which page, this one is//

//We use the location.href property and extract the filename

//from this string using lastIndexOf:

StringA=location.href;

LengthA=StringA.length

A=StringA.lastIndexOf("/")+1;

ThisFilename=StringA.substring(A,LengthA);

 

//Now we find the current page nunmber (in the list)

//Remember that Arrays start at 0 and end at number of

//elements less one. So the last element is:

n=NumberOfFiles-1;

//Now we look through to list to find our file, and

//therefore, its number in the list:

for (var i = 0; i <= n; i++)

{

if (database[i]==ThisFilename)

{

ThisPageNumber=i;

}

}

//determine the numbers of the previous and the next pages//

function goBack(){

 

if (ThisPageNumber-1<0)

//We don't want to go into negative numbers or numbers

//bigger than the number of files! So if the file number less

//one is less than zero, there is nowhere left to go!

{

alert("These are the first earrings")

}

//Otherwise we just take one of the current file number

//and get the number for the previous file:

else

{top.location=database[ThisPageNumber-1]}}

function goForward(){

 

if (ThisPageNumber+1>n){

alert("These are the last earrings")

//If the user is clicking on the last file, he or she

//cannot go forward. Otherwise, the next file is the current

//file number plus one:

}

else

{top.location=database[ThisPageNumber+1]}}

 

//and so that's our code. All we have to do is to change files

//in the Array database! Nice and lazy!
