// Script fuer die Animation auf der Startseite
// (C) 2006 Jonas Vondran
// Alle Recht vorbehalten.

var SourceImage = new Array();

SourceImage[0] = "animation/01.jpg";
SourceImage[1] = "animation/02.jpg";
SourceImage[2] = "animation/03.jpg";
SourceImage[3] = "animation/04.jpg";
SourceImage[4] = "animation/05.jpg";

var ft = 40; // Fade-Zeit
var t = 5000; // Zeit, die das Bild bleibt

var x = 1;
var g = SourceImage.length;
var fader = 0;

var LoadImage = new Array()
for (i = 0; i < g; i++){
   LoadImage[i] = new Image();
   LoadImage[i].src = SourceImage[i];
}

function fade(InOut) {
  if(InOut==0)
  {
    for(z=1; z <= 20; z++) {
      window.setTimeout("changeOpac(" + z*5 + ", 'showimage');", ft*z);
    }
    window.setTimeout("fade(1)", t+ft*20);
  }
  if(InOut==1)
  {
    for(z=1; z <= 20; z++) {
      window.setTimeout("changeOpac(" + (100-z*5) + ", 'showimage');", ft*z);
    }
    window.setTimeout("change()", ft*20);
    window.setTimeout("fade(0)", ft*20);
  }

}

function change() {
  document.getElementById("showimage").src = LoadImage[x].src;
  x++;
  if(x > (g-1)) x=0;
}

function changeOpac(opacity, id) {
  var object = document.getElementById(id).style;
  object.opacity = (opacity / 100);
  object.MozOpacity = (opacity / 100);
  object.KhtmlOpacity = (opacity / 100);
  object.filter = "alpha(opacity=" + opacity + ")";
}