// Gallery display code!!
// 2007-11-21

var pictures= new Array()
var current=0
var count=0

//var load=new Array()
//for (i=0; i<pictures.length; i++) {
//   load[i]= new Image()
//   load[i].src=pictures[i]
//}

function addpic (str) {
   pictures[count]=str
   count++
}

function viewpic (str) {
   var taghtml=""

   current = (str=="initial")? 0 : parseInt(str)
   taghtml = '<img src="' + pictures[current] + '" width=400 align=right>'
    
   if (current == "initial") {
      document.write ('<div>' + taghtml + '</div>')
   }
   else {
      document.getElementById("piccontainer").innerHTML=taghtml
      //thumbnails()
   }

}

function thumbnails () {
   var taghtml=""

   document.getElementById("thumbnailcontainer").innerHTML=taghtml
   for (i=0; i<pictures.length; i++) {
      //if (i == current) {
      //   taghtml= '<a href="javascript:viewpic(' +i+ ')"><img src="'+pictures[i]+'" width=90 border=3 hspace=2 vspace=2 /></a>'
      //}
      //else {
         taghtml= '<a href="javascript:viewpic(' +i+ ')"><img src="'+pictures[i]+'" width=90 border=0 hspace=2 vspace=2 /></a>'
      //} 
      //document.write (taghtml)
      document.getElementById("thumbnailcontainer").innerHTML+=taghtml
   }

}


function nextpic () {
   if (current < pictures.length-1) {
      current++ 
   }
   else {
      current=0
   }
   viewpic(current)
}

function prevpic () {
   if (current > 0) {
      current-- 
   }
   else {
      current=pictures.length-1
   }
   viewpic(current)
}
