//thumbnail script
current_image=0;
max=22;
count=0;

var delay = 3000;
var lock = false;
var run;

images= new Array()
images[0] =  "../images/big3/blueangel.jpg"
images[1] =  "../images/big3/deserteve.jpg"
images[2] =  "../images/big3/energized.jpg"
images[3] =  "../images/big3/fantastic.jpg"
images[4] =  "../images/big3/fishes.jpg"
images[5] =  "../images/big3/flowers.jpg"
images[6] =  "../images/big3/inthemist.jpg"
images[7] =  "../images/big3/itest.jpg"
images[8] =  "../images/big3/justcolors.jpg"
images[9] =  "../images/big3/lizard.jpg"
images[10] = "../images/big3/loveyou.jpg"
images[11] = "../images/big3/morninglight.jpg"
images[12] = "../images/big3/mytrip.jpg"
images[13] = "../images/big3/perservere.jpg"
images[14] = "../images/big3/rainyday.jpg"
images[15] = "../images/big3/rambo.jpg"
images[16] = "../images/big3/redux.jpg"
images[17] = "../images/big3/returnrebo.jpg"
images[18] = "../images/big3/snapshots.jpg"
images[19] = "../images/big3/sonsquank.jpg"
images[20] = "../images/big3/squank.jpg"
images[21] = "../images/big3/sunsetblaze.jpg"
images[22] = "../images/big3/tunnel.jpg"

imageName = new Array()
imageName[0] = "blue angel"
imageName[1] = "desert eve"
imageName[2] = "energized"
imageName[3] = "fantastically"
imageName[4] = "fishes for ella"
imageName[5] = "flowerz"
imageName[6] = "in the mist"
imageName[7] = "itest"
imageName[8] = "just colors"
imageName[9] = "lizard dreaming"
imageName[10] = "i love you this much"
imageName[11] = "morning light"
imageName[12] = "my trip to andromeda"
imageName[13] = "perserverance"
imageName[14] = "rainy day"
imageName[15] = "rambo's nephew"
imageName[16] = "redux"
imageName[17] = "the return of robo boy"
imageName[18] = "snapshots"
imageName[19] = "son of squank"
imageName[20] = "squank"
imageName[21] = "sunset blaze"
imageName[22] = "the tunnel at the end of the light"

// 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 23");
    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 23");
    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.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);
}

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);
}

// 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) +")";
}