// Gallery 360 display code!!
// 2007-11-26

var pictures= new Array()
var pictures360= 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, comp) {
   pictures[count]=str
   pictures360[count]=comp
   count++
}

function viewpic (str) {
   var taghtml=""

   current = (str=="initial")? 0 : parseInt(str)
   //taghtml = '<img src="' + pictures[current] + '" width=300 align=right border=1>'
   taghtml = '<APPLET code=ptviewer.class height=240 name=ptviewer width=480 archive="jar/ptviewer.jar"><PARAM name=tilt value="-10.75"><PARAM name=pan value="-129"><PARAM name=fov	value="100"><PARAM name=fovmax  value="130"><PARAM name=fovmin  value="50"><PARAM name=auto  value="0.15"><param name=bar_height value="10"><param name=barcolor value="76AA87">'
   taghtml += '<PARAM NAME="file" VALUE="/gallery/pans/'+pictures360[current]+'"></APPLET>'

   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++) {
      taghtml= '<a href="javascript:viewpic(' +i+ ')"><img src="'+pictures[i]+'" width=90 height=60 border=0  hspace=2 vspace=2 /></a>'
      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)
}