function fade(step) {
    var imgs = document.getElementById("myfader").getElementsByTagName("img");

    step = step || 0;

    if(counter < imgs.length){
        imgs[counter].style.opacity = step/100;
        imgs[counter].style.filter = "alpha(opacity=" + step + ")"; // 
    }else{
	imgs[1].style.opacity = 0;
        imgs[1].style.filter = "alpha(opacity=" + 0 + ")";
        imgs[2].style.opacity = 0;
        imgs[2].style.filter = "alpha(opacity=" + 0 + ")";
        imgs[3].style.opacity = 1 - (step/100);
        imgs[3].style.filter = "alpha(opacity=" + (100-step) + ")";
    }

    step = step + 2;

    if (step <= 100) {
        window.setTimeout(function () { fade(step); }, 3);
    } else {
	if(counter >= imgs.length){
		counter = 0;
	}
        window.setTimeout(next, 3000);
    }
}

function next() {
    var imgs = document.getElementById("myfader").getElementsByTagName("img");

    if (typeof(counter) != "number") {
        counter = 0;
    }

    counter++;

    fade();
}


