
var pici=0;
var picn=piclist.length-1;
function slideshowfirst() {
   pici=0;
   showslide();
}
function slideshowlast() {
   pici=picn;
   showslide();
}
function slideshownext() {
   pici=pici+1;
   if (pici > picn) {
      pici=picn;
   }
   showslide();
}
function slideshowprev() {
   pici=pici-1;
   if (pici < 0) {
      pici=0;
   }
   showslide();
}
function slideshowvalue() {
   var v;
   if (pici==0) {
      return 'intro';
   }
   else {
      return pici+" of "+picn;
   }
}
function showslide() {
   var id=piclist[pici];
   var image=picDB[id].image;
   var artistname=picDB[id].artist;
   var artist=artistDB[artistname];
   var thumbimage=artistDB[artistname].thumbimage;
   document.getElementById("slidewindow").src=image.src;
   document.getElementById("slidewindow").alt=id;
   document.getElementById("slidewindow").title=id;
   if (!image.complete) {
      setTimeout(waitawhile,1);
   }
   var marl="50px";
   if (image.height > image.width) { 
      marl="90px";
   }
   document.getElementById("slide").style.marginLeft=marl;
   if (artistname!='-') {
      document.getElementById("artist").style.display='inline';
      document.getElementById("artist_name").innerHTML=artistname;
      if (artist.thumb!='-') {
         document.getElementById("artist_thumb").style.display='inline';
         document.getElementById("artist_thumb").src=thumbimage.src;
         if (!thumbimage.complete) {
            setTimeout(waitawhile,1);
         }
      }
      else {
         document.getElementById("artist_thumb").style.display='none';
      }
      document.getElementById("artist_age").innerHTML=artist.age;
      document.getElementById("artist_school").innerHTML=artist.school;
   }
   else {
      document.getElementById("artist").style.display='none';
   }
   document.getElementById("slidepos").innerHTML=slideshowvalue();
   function waitawhile() {
   }
}
function gcontrolup(ctl) {
   document.getElementById("g"+ctl).src="images/gallery"+ctl+".gif";
}
function gcontroldown(ctl) {
   document.getElementById("g"+ctl).src="images/gallery"+ctl+"down.gif";
}
   
