   

function Fader(id) {

            this.id = id;
            this.images = document.getElementById(id).getElementsByTagName("span");
            this.counter = 0;

var bericht;


this.images[0].style.opacity = "100"; 
this.images[0].style.filter = "alpha(opacity=100)"; 
this.images[0].style.display = "block";


            this.fade = function (step) {
                var fader = this;

                step = step || 0;

                this.images[this.counter].style.display = "block";
                this.images[this.counter].style.opacity = step/100;
                this.images[this.counter].style.filter = "alpha(opacity=" + step + ")"; // IE?

                step = step + 2;

                if (step <= 100) {
                    window.setTimeout(function () { fader.fade(step); }, 1);
                } else {
                    window.setTimeout(function () { fader.next(); }, 3000); 
                }


                //if (this.counter == this.images.length) { fader.next(); }


            };

            this.next = function () {
                this.counter++; 

if( !(this.counter < this.images.length) )
{


if( (this.images.length-2) > 0 )
{
 this.images[this.images.length-2].style.opacity = "0"; 
 this.images[this.images.length-2].style.filter = "alpha(opacity=0)"; 
 this.images[this.images.length-2].style.display = "none";
}
if( (this.images.length-1) > 0 )
{
 this.images[this.images.length-1].style.opacity = "0"; 
 this.images[this.images.length-1].style.filter = "alpha(opacity=0)"; 
 this.images[this.images.length-1].style.display = "none";
}

 this.counter = 0;                 
 this.fade();
}
else if (this.counter < this.images.length) 
{

if( this.counter > 1 )
{
 if( (this.counter+2) > 0 )
 {
  this.images[this.counter-2].style.opacity = "0"; 
  this.images[this.counter-2].style.filter = "alpha(opacity=0)"; 
  this.images[this.counter-2].style.display = "none";
 }

} 

                    this.fade();
                }

            };
        
}

