imageList=new Array();
function wechselbild()

  {
  if (imageList.length != 0)
    { 
  	var z = Math.random();
  	z = (imageList.length-1)*z;
  	var i = Math.round(z);
  	fadeOut(imageList[i],100);
  	}
  }

function imageAdd(pfad,datei)
  
  {
  imageList.push(pfad + '/' + datei);
  }

function wechselStart(interval)
  {
  wechselbild();
  setInterval("wechselbild();",interval);
  }
  	
function fadeIn(datei,step) 
  {
  var img = document.getElementById("wechselbild");

  step = step || 0;
  img.style.backgroundImage="url(" + datei + ")";
  img.style.opacity = step/100;
  img.style.filter = "alpha(opacity=" + step + ")"; // IE
  step = step + 1;

  if (step <= 100) 
    {
      window.setTimeout(function () { fadeIn(datei,step); }, 5);
    }
  }
  
function fadeOut(datei,step) 
  {
  var img = document.getElementById("wechselbild");

  step = step || 100;

  img.style.opacity = step/100;
  img.style.filter = "alpha(opacity=" + step + ")"; // IE

  step = step -1;

  if (step > 0) 
    {
    window.setTimeout(function () { fadeOut(datei,step); }, 5);
    }
  else
    {
    fadeIn(datei,0)
    }
  }

