var id_current = 0;
var playDirection = 1;
var pause = 0;
var initial = 0;

function PlaySlideshow ()
{
	if (initial == 1) {
		if (pause == 0) {
	
			if (playDirection == 1) {
				id_current++;
			}
			else {
				id_current--;
			}
			changeImage();
		}
	}
	else initial = 1;
	
	
	window.setTimeout("PlaySlideshow()",8000);
}

function changeImage() {
	var img = $('theImage');
	var caption = $('theCaption');

  	if (id_current > (t_img.length-1)) {
		id_current = 0;
   	}
   	if (id_current < 0) {
		id_current = t_img.length-1;
   	}

 	Element.hide('theImage');
	img.src = '';
	img.src = t_img[id_current];
	caption.innerHTML = t_caption[id_current];
	new Effect.Appear('theImage');

}
// Effect.Appear Effect.Fade Effect.Puff Effect.BlindDown Effect.BlindUp
// Effect.SwitchOff Effect.SlideDown Effect.SlideUp Effect.DropOut
// Effect.Shake Effect.Pulsate Effect.Squish Effect.Fold Effect.Grow demo
// Effect.Shrink Effect.Highlight Effect.toggle (blind)

function RewindSlideshow() {
	playDirection = 0;
	if (pause == 1) {
		id_current--;
		changeImage();
	}
}
function ForwardSlideshow() {
	playDirection = 1;
	if (pause == 1) {
		id_current++;
		changeImage();
	}
}
function PauseSlideshow() {
	pause = 1;
}
function RestartSlideshow() {
	pause = 0;
}


