//thumbnail script
current_image=0;
max=10;
count=0;

var delay = 3000;
var lock = false;
var run;

images= new Array()
images[0] =  "../images/big/amoeba.JPG"
images[1] =  "../images/big/forfire.JPG"
images[2] =  "../images/big/mistcity.JPG"
images[3] =  "../images/big/morefish.JPG"
images[4] =  "../images/big/nightdance.JPG"
images[5] =  "../images/big/powcity.JPG"
images[6] =  "../images/big/reachsky.JPG"
images[7] =  "../images/big/spaced_out.JPG"
images[8] =  "../images/big/splange.JPG"
images[9] =  "../images/big/starkness.JPG"
images[10] = "../images/big/sundancers.JPG"


imageName = new Array()
imageName[0] = "Amoeba Dreams"
imageName[1] = "Forest Fire"
imageName[2] = "Misty City"
imageName[3] = "More Fishes"
imageName[4] = "Night Dancer"
imageName[5] = "Power of the City"
imageName[6] = "Reach for the Sky Pard!"
imageName[7] = "Spaced Out"
imageName[8] = "Splange"
imageName[9] = "Starkness"
imageName[10] = "Sundancers"



imageDescrip = new Array()
imageDescrip[0] = "falling dreams"
imageDescrip[1] = "mr burns, i presume"
imageDescrip[2] = "have you seen gunga din lately"
imageDescrip[3] = "always room for more fishes"
imageDescrip[4] = "glides through the night"
imageDescrip[5] = "big lights, bigger city"
imageDescrip[6] = "Just a Thought"
imageDescrip[7] = "from within"
imageDescrip[8] = "the splangenator returns"
imageDescrip[9] = "Naked Mountainousness"
imageDescrip[10] = "Exuberantic Antics"



// not using this array or the mymenu function which is just a simple test
// intended for multiple gallery pulldown menu
menuitems = new Array()
menuitems[0] = "2006 pics"
menuitems[1] = "butterflys and mosquitos"
menuitems[2] = "2005 pics"
menuitems[3] = "turtles and frogs"

function mymenu() {
  alert("ToDo you selected " + menuitems[document.mytoolbar.picgroups.selectedIndex]);
}

function auto() {
  if (lock == true) {
    lock = false;
    clearInterval(run);
    document.mytoolbar.automatic.value="Auto";
  }
  else if (lock == false) {
    lock = true;
    run = setInterval("nextimage()", delay);
    document.mytoolbar.automatic.value="Stop";
  }
}

function select_image(picnum)
{
  if (!document.mytoolbar.picnum.value.match(/^\d+$/)) {
    document.mytoolbar.picnum.value="";
    alert("invalid value - enter an number from 1 to 11");
    return; 
  }
  if ((document.mytoolbar.picnum.value<1) || (document.mytoolbar.picnum.value>(max+1))){
    document.mytoolbar.picnum.value="";
    alert("invalid value - enter an number from 1 to 11");
    return;
  }
  current_image=parseFloat(picnum.value)-1;
  selected_image= current_image + 1;
  document.images['large'].src=images[current_image];
  document.getElementById('bozo').innerHTML = imageName[current_image];
  document.getElementById('bozo2').innerHTML = (selected_image) + " of " + (max + 1);
  document.getElementById('descrip').innerHTML = "\<br \/>" + imageDescrip[current_image];
  document.mytoolbar.picnum.value="";
}


function nextimage()
{
  if (current_image<max) {
    current_image=current_image+1
  } 
  else {
    current_image=0
  }
  document.images['large'].src=images[current_image];
  document.getElementById('bozo').innerHTML = imageName[current_image];
  document.getElementById('bozo2').innerHTML = (current_image+1) + " of " + (max + 1);
  document.getElementById('descrip').innerHTML = "\<br \/>" + imageDescrip[current_image];
}

function previousimage()
{
  if (current_image>0) {
    current_image=current_image-1
  } 
  else {
    current_image=max
  }
  document.images['large'].src=images[current_image];
  document.getElementById('bozo').innerHTML = imageName[current_image];
  document.getElementById('bozo2').innerHTML = (current_image+1) + " of " + (max + 1);
  document.getElementById('descrip').innerHTML = "\<br \/>" + imageDescrip[current_image];
}

// This is intended for a page with thumbnails - not using in slideshow so may be busted - remove parens
// This defines what to do when an image is clicked on
function image_click(clicks)
{
  current_image=clicks
  document.images['large'].src=images[clicks];
  document.getElementById('bozo').innerHTML = imageName[clicks] + " (" + (clicks +1) + " of " + (max + 1) +")";
}