

	function ImageLoader()
	{
		img0 = new Image();  img0.src = "gfx/WWW_01.jpg";
		img1 = new Image();  img1.src = "gfx/WWW_02.jpg";
		img2 = new Image();  img2.src = "gfx/WWW_03.jpg";
		img3 = new Image();  img3.src = "gfx/WWW_04.jpg";
		img4 = new Image();  img4.src = "gfx/WWW_05.jpg";
		img5 = new Image();  img5.src = "gfx/WWW_06.jpg";

		window.myFader = new Fader('theFader'); 
		
		window.setTimeout(function () { myFader.next() }, 5000);
	}
	
	
    function Fader(id) {
        this.id = id;
		
		this.images = new Array(
			document.getElementById("fade00"), 
			document.getElementById("fade01"), 
			document.getElementById("fade02"),
			document.getElementById("fade03"), 
			document.getElementById("fade04"), 
			document.getElementById("fade05"));

        this.counter = 0;

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

            step = step || 0;


			this.oldCounter = this.counter - 1;
			
			if (this.oldCounter < 0)
			{
				this.oldCounter = this.oldCounter + this.images.length;
			}				

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

            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(); }, 5000);
            }
        };

        this.next = function () {

			this.oldCounter = this.counter - 1;
			
			if (this.oldCounter < 0)
			{
				this.oldCounter = this.oldCounter + this.images.length;
			}
			
			this.images[this.oldCounter].style.opacity = 0.0;
			
            this.counter++;

			this.counter = this.counter % this.images.length;

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

                this.fade();
            }
        };
    }

