document.addEvent('domready', function() {

  var slides = new Array();
	var childs = $('start_container').childNodes;
	
	for (var i=0; i<childs.length; i++){ // alle DIVS in "start_container" außer "start_link" werden in die Rotation gesetzt
		if(childs[i].nodeName == 'DIV' && childs[i].getAttribute('id') != 'start_link') {
			slides.push(childs[i].getAttribute('id'));
		}
	}
  
  
  
  var duration  = 5000;
  var slideTime = 850; 

  $each (slides, function(elementId) {
  //  $(elementId).setStyle('display', 'none');
  });

  counter = 0;  


  var rotate = function() {
    if (!slides[counter])
      counter = 0;
      
    if (counter == 0)
      var last = slides.length - 1;
    else
      var last = counter -1; 

    new Fx.Tween(slides[last], {
      
      duration: slideTime,
      
      onComplete: function() {
      
        $(slides[last]).setStyle('display', 'none');
        $(slides[counter]).setStyle('opacity', 0);
        
        new Fx.Tween(slides[counter], {
        
          duration: slideTime, 
        
					onStart: function() {
		        $(slides[counter]).setStyle('display', 'block');
		      },
		      
		      onComplete: function() {
		        counter++;
		        rotate.delay(duration);
		      }
        
        }).start('opacity', 1);
        
      }
      
    }).start('opacity', 0);
   
  }
  
  rotate();
  
});