// photo_gallery.js - javascript for presentation of photos- all one type

var ntmax = 4;
var nmax = 79;
var more = true;
var nblock = 1;

// this routine displays a sequence of thumbnail pics on the LHS
// the first pic displayed is pointed at by nstart
// ntmax is the maximum number of spaces available
// nmax is the maximum number of thumbnails of this type
// n pics are displayed followed by blanks if there are not enough to fill the available spaces

function showThumbs ()
   {
   var n, ii;
   if (!more) nblock = 0;
//alert('nblock='+nblock);
   var nn = nblock + 1;
   var nstart = ((nn-1) * ntmax) + 1;
   if (nstart > nmax)
      {
      n = 0;
      document.gpmsg.src = "images/gallery/pg_msg1.gif";
      more = false;
      }
   else
      {
      n = nmax - nstart + 1;
      if (n > ntmax) { n = ntmax; }
      document.gpmsg.src = "images/gallery/pg_msg0.gif";
      more = true;
      }
   nblock++;
   for (var i=1; i<=ntmax; i++)
      {
      if (i <= n)
         {
         ii = nstart + i - 1;
         eval ('document.gt' + i + '.src = "images/gallery/pgt_pic' + ii + '.jpg"');
         }
      else { eval ('document.gt' + i + '.src = "images/gallery/pgt_pic00.gif"'); }
      }
   return false;
   }

// this routine displays the large picture on the RHS
// it relies on the current type (encoded in typechar) and is passed the id

function showPic (id)
   {
   var n = (nblock-1) * ntmax + Math.abs(id);

   if (n > 0 && n <= nmax)
      {
      var s = 'images/gallery/pg_pic' + n + '.jpg';
      document.bigpic.src = s;
      var t = 'images/gallery/pg_pic' + n + '.gif';
      document.gpmsg.src = t;
      }
   return false;
   }

