var playTimer;

function play() {
	if (myShow.getCurrIndex() == (myShow.getNumImages() - 1)) {
		myShow.recycle();
	} else {
		myShow.next();
	}
	playTimer = window.setTimeout(play, 4000);
}

function stop() {
	window.clearTimeout(playTimer);
}

function showPlayButton() {
	document.getElementById('playB').style.display = 'inline';
	document.getElementById('pauseB').style.display= 'none';
}

function showPauseButton() {
	document.getElementById('playB').style.display = 'none';
	document.getElementById('pauseB').style.display= 'inline';
}

function backClick() {
	stop();
	myShow.back();
	showPlayButton();
}

function playClick() {
	play();
	showPauseButton();
}

function pauseClick() {
	stop();
	showPlayButton();
}

function nextClick() {
	stop();
	myShow.next();
	showPlayButton();
}

function recycleClick() {
	stop();
	myShow.recycle();
	showPlayButton();
}

function overBack(obj) {
	obj.src = "buttons/back_light.gif";
	obj.style.cursor = "pointer";
}

function overPlay(obj) {
	obj.src = "buttons/play_light.gif";
	obj.style.cursor = "pointer";
}

function overPause(obj) {
	obj.src = "buttons/pause_light.gif";
	obj.style.cursor = "pointer";
}

function overNext(obj) {
	obj.src = "buttons/next_light.gif";
	obj.style.cursor = "pointer";
}

function overRecycle(obj) {
	obj.src = "buttons/recycle_light.gif";
	obj.style.cursor = "pointer";
}

function outBack(obj) {
	obj.src = "buttons/back_dark.gif";
}

function outPlay(obj) {
	obj.src = "buttons/play_dark.gif";
}

function outPause(obj) {
	obj.src = "buttons/pause_dark.gif";
}

function outNext(obj) {
	obj.src = "buttons/next_dark.gif";
}

function outRecycle(obj) {
	obj.src = "buttons/recycle_dark.gif";
}

