//var x is the length of the images array minus 1
//var a comes from the id of the image that calls the function
//var b is the name of the image that the function calls
//var c is a second array of the height of the images
//var d is the name of a third array of strings -comments that appear below the images
//var direction is usually set to 1 or -1 to move the slide show formard and back, 
// and set to -i to bring back to the start and used to be +i to go to the end,
// but  you cannot put '+i' for the argument to fast foreward, rather you need to 
// put the same number as is in the x variable, but you can't USE the x variable there.
var i = 0;
var ImgNum = 0;
var counter = 0


function chgImg(direction,x,b,c,d) {
this.direction = direction;
this.x = x;
this.b = b;
this.c = c;
this.d = d;
if (document.images) {
blackOut();

	}
}
//var crazy = d;
//alert(crazy[4]);

function blackOut() {
	if (document.images) {
var a = document.getElementById( 'slideshow' );
a.src = p + "black.gif";
var a = document.getElementById( 'slideshow' );
var blahBlah = document.getElementById( 'imgComments' );
var contents = d;
i = x;
var ImgLength = b.length - 1;
ImgNum = ImgNum + direction;
counter = i
if (ImgNum > ImgLength) {
ImgNum = i;
}
if (ImgNum < 0) {
ImgNum = 0;
}

setTimeout( 'tweedledee() ', 300);
   }
if( navigator.appName == 'Opera' ) {
blahBlah.setAttribute( 'style', 'font-size: 1.3em; width: 700px; text-align: center' );
//blahBlah.style.font-size = '2em':
//alert(blahBlah)
	}
}
//the argument 'd' is the image comments from the imgDescript array on the xccalling page


function tweedledee() {
var a = document.getElementById( 'slideshow' );
var contents = d;
a.src = p + b[ImgNum];
a.height = c[ImgNum];
document.getElementById( 'imgComments' ).innerHTML = contents[ImgNum];
//alert(document.getElementById( 'imgComments' ).innerHTML);
}

function clear() {
  /*
   * Description: Method of buttonSet object. Used to reset any global
   *              variables on which any buttons in the buttonSet rely
   *              on for their condition statements.
   * Arguments: None.
   */
   gIsRunning=false;
}

var gTimer = 0;


function startAuto(start,delay) {
this.delay = delay
  /*
   * Description: Start a "slideshow".
   * Arguments: None.
   */
   if ((start == 1) && (counter > ImgNum)) {
   		setTimeout("chgImg(1,x,b,c,d)",5);
  		 gTimer = setTimeout("startAuto(1)",5000);
  	//	 alert(counter);
  	//	 alert(ImgNum);
	}
	}
	
	
function eliminateVoodoo(stop)  { 
	if (stop == 1){
		window.clearTimeout(gTimer);
	}
}
	