thisImg = 0
imgCt = captionTxt.length


var secs 
var timerID = null 
var timerRunning = false 
var delay = 1000 

function InitializeTimer() 
{ 
	//from Paul McFedries's website http://www.mcfedries.com/ 
	// Set the length of the timer, in seconds 
	secs = 10 
	StopTheClock() 
	StartTheTimer() 
} 

function StopTheClock() 
{ 
	//from Paul McFedries's website http://www.mcfedries.com/ 
	if(timerRunning) 
		clearTimeout(timerID) 
	timerRunning = false 
} 

function StartTheTimer() 
{ 
	//from Paul McFedries's website http://www.mcfedries.com/ 
	if (secs==0) 
	{ StopTheClock() 
	newSlide(+1)
	}
 else 
	{ self.status = secs 
	secs = secs - 1 
	timerRunning = true 
	timerID = self.setTimeout("StartTheTimer()", delay) 
	} 
} 


function addNode() 
{
	if (document.getElementById && document.createElement)
	{
		    var node = document.getElementById('myCaption');
		node.removeChild(node.lastChild);

		    var node2 = document.getElementById('mySlideCount');
		node2.removeChild(node2.lastChild);
		
		var x = document.createTextNode(' '+ captionTxt[thisImg]);
		var y = document.createTextNode('You are currently on slide '+ (thisImg+1) + ' of ' + imgCt); 
		
		document.getElementById('myCaption').appendChild(x);
		
		document.getElementById('mySlideCount').appendChild(y);
	}
	else alert('Your browser doesn\'t support the Level 1 DOM');
}




function newSlide(direction) {
	if (document.images) {
		thisImg = thisImg + direction
	if (thisImg < 0) {
		thisImg = imgCt-1
	}
	if (thisImg == imgCt) {
		thisImg = 0
	}
	document.slideshow.src = imageName[thisImg]
	document.slideshow.alt = imageAlt[thisImg]
	}
	{
	addNode()
	}
	{
	InitializeTimer()
	}
}




