var timer = null;
var bilder = null;
var start = 1;
var time = null;
var anzahl = 0;

function setBilder(bilderSet){
	bilder = bilderSet;	
}

function setStart(starte){
	start = starte;
}

function setAnzahl(anz){
	anzahl = anz;
}
function showImage(id)
{
	$.ajax({
	  url: 'ajxloader.php',
	  type: 'POST',
	  data: "do=showImage&id="+id,
	  success: function( neueDaten ) {
		  $(".startImages:first").hide('slow',function(){
			  $(".startImages:first").remove();
			  $("#startContainer").append(neueDaten);	
			  $(".startImages:last").show('slow');
			  startShow(time);		  
		  });
	  }
	});		
}

function startShow(timeTo){
	time = timeTo;
	timer = setTimeout(nextPic,time);
}

function nextPic(){
	start++;
	if (start>anzahl){
		start = 1;
	}
	showImage(start);
	clearTimeout(timer);
}
