current = 0;

function previous()
{
   select((current + images - 1) % images);
}

function next()
{
   select((current + 1) % images);
}

function select(index)
{
   document.getElementById("scrapbook").src = imageSource(index);
   document.getElementById("image" + current).style.borderColor = "";
   document.getElementById("image" + index).style.borderColor = "#ffd700";
   current = index;
}

function imageSource(index)
{
   return baseDir + "image (" + index + ").jpg";
}

function display ()
{
   window.open(imageSource(current), '', 'scrollbars=yes,menubar=no,height=480,width=640,resizable=yes,toolbar=no,location=no,status=no');
}

function draw_thumbs ()
{
   for (current = 0; current < images; current++)
   {
      clkcmd = "select(" + current + ")";
      document.write("<img id=\"image" + current + "\" class=\"thumbnail\" src=\"" + imageSource(current) + "\" onclick=\"" + clkcmd + "\"/> ");
   }
   current = 0;
   select(0);
}
