var count = 0;
var numberOfDocuments = 16; // change this number to the number of documents
 
function next() {
   populateCount();

   if (count++ == numberOfDocuments) {
      document.location("index.html");
      return true;
   }

   go();
}


function previous() {
   populateCount();
   
   if (count-- == 1) {
      document.location("index.html");
      return true;
   }
   
   go();
}

function populateCount() {
   var re = /([0-9]+)\.html/;
   var pageName = re.exec(document.location);
   count = pageName[1];
}

function go() {
   document.location = count + ".html";
}