//thumbnail script
current_image=0
max=17
count=0

var delay = 3000;
var lock = false;
var run;

images= new Array()
images[0] =  "../images/gallery1/baptised.jpg"
images[1] =  "../images/gallery1/bastingbird.jpg"
images[2] =  "../images/gallery1/blackbirdstorm.jpg"
images[3] =  "../images/gallery1/boxofrain.jpg"
images[4] =  "../images/gallery1/boysinhoodboulder.jpg"
images[5] =  "../images/gallery1/dyeingeggs.jpg"
images[6] =  "../images/gallery1/eightseconds.jpg"
images[7] =  "../images/gallery1/fairythreadlight.jpg"
images[8] =  "../images/gallery1/golfclubs.jpg"
images[9] =  "../images/gallery1/hidingrabbitorganpipe.jpg"
images[10] = "../images/gallery1/howdyhomefrontrange.jpg"
images[11] = "../images/gallery1/hulapalms.jpg"
images[12] = "../images/gallery1/ignatius.jpg"
images[13] = "../images/gallery1/kuaiiwindow.jpg"
images[14] = "../images/gallery1/meadowlark.jpg"
images[15] = "../images/gallery1/offseelizzard.jpg"
images[16] = "../images/gallery1/piratecolor.jpg"
images[17] = "../images/gallery1/takingphoto.jpg"

imageName = new Array()
imageName[0] = "Baptised"
imageName[1] = "Basting the Bird"
imageName[2] = "Blackbird on the Edge of a Prairie Storm"
imageName[3] = "Box of Rain"
imageName[4] = "Boys in the Hood"
imageName[5] = "Dyeing Eggs"
imageName[6] = "8-Second Eternity"
imageName[7] = "Fairy with a Thread of Light"
imageName[8] = "Golf Clubs"
imageName[9] = "Hiding Rabbit Organ Pipe National Park"
imageName[10] = "Howdy, Home on the Front Range"
imageName[11] = "Hula Palms"
imageName[12] = "Ignatious J. Reilly"
imageName[13] = "Kuaii Window"
imageName[14] = "Meadowlark"
imageName[15] = "Off to See the Lizard"
imageName[16] = "Pirates"
imageName[17] = "Taking a Photo"

imageDescrip = new Array()
imageDescrip[0] = "Grandma Nanny bathed us with an old pan"
imageDescrip[1] = "Thanksgiving in Casper Wyoming"
imageDescrip[2] = "Wetlands dot the Dakota countryside"
imageDescrip[3] = "Limousine to a show that required umbrellas"
imageDescrip[4] = "Skateboarding in the neighborhood"
imageDescrip[5] = "Spring ritual"
imageDescrip[6] = "The wildest of western themes, rodeo bull riding"
imageDescrip[7] = "Magic of a daydream"
imageDescrip[8] = "Waiting for the boys to play in Key West"
imageDescrip[9] = "Springtime in the desert"
imageDescrip[10] = "Friendly western charm timeless"
imageDescrip[11] = "Swaying palms bask against the setting sun on Mauii"
imageDescrip[12] = "Webmaster's favorite book, \"A Confederacy Of Dunces\""
imageDescrip[13] = "Jalousie windows cast interesting shadows on the walls"
imageDescrip[14] = "A song of home"
imageDescrip[15] = "Perils that accompany the freedom of speech"
imageDescrip[16] = "A vision by our friendly webmaster"
imageDescrip[17] = "Self-portrait overlooking a imagined view of the front range"

// 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 18");
    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 18");
    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 = 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 = 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 = 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) +")";
}
