/********************************0***********/
/*   using: Handcode Toolkit v1.0           */
/*   Copyright 2004 Incus Web Works         */
/********************************************/

var image = new Array();
var pictureCount = 0;

function _imageStart(){
 _swap(0);
}

function _addImage(image_name_element, caption){
 image[image.length] = new Image(500, 500);
 image[image.length-1].src = image_name_element;
 image[image.length-1].caption = caption;
}

function _back(){
 --pictureCount;
 if (pictureCount<0) pictureCount = image.length-1;
 _swap(pictureCount);
}

function _forward(){
 ++pictureCount;
 if (pictureCount>=image.length) pictureCount = 0; 
 _swap(pictureCount);
}

function _swap(input){
 pictureCount = input;
 document.getElementById("image").src = image[pictureCount].src;
 document.getElementById("caption").innerHTML = image[pictureCount].caption;
 _menu_check();
}

//preload images
function preloadImages() {
  var d=document; if(d.images){ if(!d.pre) d.pre=new Array();
    var i,j=d.pre.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.pre[j]=new Image; d.pre[j++].src=a[i];}}
}


// stie specific functions for paulweir.com 5/16/2008

function _menu_check(){
 switch (pictureCount){
  case (0) :
  case (4) :
   _menu_reset()
   document.getElementById("image_menu_1").style.color = "#BF0000";
  break;
  case (5) :
  case (7) :
   _menu_reset()
   document.getElementById("image_menu_2").style.color = "#BF0000";
  break;
  case (8) :
  case (14) :
   _menu_reset()
   document.getElementById("image_menu_3").style.color = "#BF0000";
  break;
  case (15) :
  case (22) :
   _menu_reset()
   document.getElementById("image_menu_4").style.color = "#BF0000";
  break;
  case (22) :
  case (26) :
   _menu_reset()
   document.getElementById("image_menu_5").style.color = "#BF0000";
  break;
  case (27) :
  case (31) :
   _menu_reset()
   document.getElementById("image_menu_6").style.color = "#BF0000";
  break;
  case (32) :
  case (39) :
   _menu_reset()
   document.getElementById("image_menu_7").style.color = "#BF0000";
  break;
 }
}

function _menu_reset(){
 document.getElementById("image_menu_1").style.color = "#000000";
 document.getElementById("image_menu_2").style.color = "#000000";
 document.getElementById("image_menu_3").style.color = "#000000";
 document.getElementById("image_menu_4").style.color = "#000000";
 document.getElementById("image_menu_5").style.color = "#000000";
 document.getElementById("image_menu_6").style.color = "#000000";
 document.getElementById("image_menu_7").style.color = "#000000";
}