function FlyingImages() {
  var dur = 1700; // Dauer einer einzelnen Spalte, Standard: 1700
  var del = 80;   // Verzögerung zwischen einzelnen Spalten, Standard: 80
  var pause = 3000; // Pause bis zur nächsten ersten Spalte, Standard: 3000
  var zidx = 0;
  var current_row = 0;
  var images = [];

  var retreive_images = function() {
    idx = 0;
    images = [];
    while($("#panel_1").children()[idx]) {
      row = [];
      for(p=0;p<5;p=p+1) {
        row[p] = $($("#panel_" + (p+1)).children()[idx]);
      }
      images[idx] = row;
      idx = idx + 1;
    }
  };

  var next_row = function() {
    current_row = current_row + 1;
    if(!images[current_row]) {current_row = 0;}
    setTimeout(animate_row, pause);
  };
  
  var animate_row = function() {
    $.each(images[current_row], function(col, image){
      zidx = zidx + 1;
      image.css("z-index", zidx);
      image.css("opacity", 0);
      image.css("margin-top", "400px");
      if(col + 1 < row.length) {
        image.delay(col * del).animate(
          {marginTop:0, opacity:1},
          {
            duration: dur,
            easing: "easeInOutExpo"
          }
        );
      }else{
        image.delay(col * del).animate(
          {marginTop:0, opacity:1},
          {
            duration: dur,
            easing: "easeInOutExpo",
            complete: function() {next_row(current_row)}
          }
        );
      }
    });
  }
  
  retreive_images();
  animate_row();
}

$(window).load(function(){new FlyingImages();})


