/* Fader - Javascript by Philipp Heckelt

   (C) 2009, H&E Internetagentur Münsingen UG (haftungsbeschränkt)
   http://www.ia-msg.de
*/

window.setTimeout(function () { FadeIn(1); }, 1000);
window.setTimeout(function () { FadeIn(2); }, 20000);
window.setTimeout(function () { FadeIn(3); }, 25000);
window.setTimeout(function () { FadeIn(4); }, 10000);
window.setTimeout(function () { FadeIn(5); }, 15000);
window.setTimeout(function () { FadeIn(6); }, 30000);
window.setTimeout(function () { FadeIn(7); }, 5000);

function FadeIn(pic, step)
{
   step = step || 0;
   pic = pic || 1;

   document.getElementById("FadePicture" + pic).style.opacity = step/100;
   document.getElementById("FadePicture" + pic).style.filter = "alpha(opacity=" + step + ")"; // IE?

   step = step + 2;

   if (step < 100)
      window.setTimeout(function () { FadeIn(pic, step); }, 10);
   else
      window.setTimeout(function () { FadeOut(pic); }, 10000);
}

function FadeOut(pic, step)
{
   step = step || 98;
   pic = pic || 1;

   document.getElementById("FadePicture" + pic).style.opacity = step/100;
   document.getElementById("FadePicture" + pic).style.filter = "alpha(opacity=" + step + ")"; // IE?

   step = step - 2;

   if (step > 0)
      window.setTimeout(function () { FadeOut(pic, step); }, 10);
   else
      window.setTimeout(function () { FadeIn(pic); }, 10000);
}
