/* SLIDESHOW Control ---------------------------------------------------------- */
// Vars
countOfSlides = 1;
showImgId = 1;
playit = false;
stopit = false;
restartit = false;
dfolder = '';
timoutstarted = false;
timeSpeed = 3000; // Zeitabstand in Milisekunden
// Set Count Of
function setCountOfSlides (pInt) {
	countOfSlides = pInt;
}// setCountOfSlides
// Set Default Folder
function setDefaultFolder (pFolder) {
	dfolder = pFolder;
}// setDefaultFolder
// Show First Image
function firstImg () {
	stop ();
	Effect.Fade ( // Fade
		'slide'+showImgId+'', 
		{
			duration:0,
			fps:50
		}
	);
	Effect.Appear (
		'slide1', 
		{
			duration:0,
			fps:50
		}
	);
	showImgId = 1;
	if (!timoutstarted) setTimeout ('restart (); play ();', timeSpeed);
	timoutstarted = true;
}
function startNext () {
	stop ();
	nextImgHard ();
}
function startPrev () {
	stop ();
	preImgHard ();
}
// Show Next Image
function nextImg () {
	idToShow = showImgId+1;
	idToHide = showImgId;
	if (showImgId == countOfSlides) idToShow = 1;
	Effect.Appear (
		'slide'+idToShow+'', 
		{
			duration:0.8,
			fps:50
		}
	);
	Effect.Fade ( // Fade
		'slide'+idToHide+'', 
		{
			duration:0.8,
			fps:50
		}
	);
	showImgId++;
	if (showImgId > countOfSlides) showImgId = 1;	
}// nextImg
// Show Next Image Hard
function nextImgHard () {
	idToShow = showImgId+1;
	idToHide = showImgId;
	if (showImgId == countOfSlides) idToShow = 1;
	document.getElementById('slide'+idToShow).style.display = 'block';
	document.getElementById('slide'+idToHide).style.display = 'none';
	showImgId++;
	if (showImgId > countOfSlides) showImgId = 1;
}// Show Next Image Hard
// Show Previous Image Hard
function preImgHard () {
	idToShow = showImgId-1;
	idToHide = showImgId;
	if (showImgId == 1) idToShow = countOfSlides;
	document.getElementById('slide'+idToShow).style.display = 'block';
	document.getElementById('slide'+idToHide).style.display = 'none';
	showImgId--;
	if (showImgId < 1) showImgId = countOfSlides;
}// Show Prev Image Hard
// Show Previous Image
function preImg (pShow, pHide) {
	if (pShow) idToShow = pShow;
	else idToShow = showImgId-1;
	if (pHide) idToHide = pHide;
	else idToHide = showImgId;
	if (showImgId == 1) idToShow = countOfSlides;
	Effect.Appear (
		'slide'+idToShow+'', 
		{
			duration:0.8,
			fps:50
		}
	);
	Effect.Fade ( // Fade
		'slide'+idToHide+'', 
		{
			duration:0.8,
			fps:50
		}
	);
	showImgId--;
	if (showImgId < 1) showImgId = countOfSlides;
}// preImg
// Play Slideshow
function play () {
	if (!stopit || restartit) {
		timoutstarted = false;
		nextImg ();
		setTimeout ('play();', timeSpeed);
	}
}// play
// Play Slideshow Hard
function playHard () {
	document.getElementById('slide').src = dfolder+'/bild'+showImgId+'.jpg';
	showImgId++;
	if (showImgId > countOfSlides) showImgId = 1;
	setTimeout ('playHard();', 1000);
}// play
// Stop Slideshow
function stop () {
	stopit = true;
	restartit = false;
	playit = false;
}
// Restart Slideshow
function restart () {
	restartit = true;
}
