It's not smart to use different elements for different slides. You should use two elements for a fading slideshow. This is a code I wrote some time ago:
el = function(q) {return document.getElementById(q)};
var slides=["logo.jpg","avond.jpg","bar.jpg","buitencloseup.jpg","servet.jpg","spelcomputers.jpg","tafelaanbar.jpg","tafelsbuiten.jpg"],
Math.floor(Math.random()*slides.length),
highimg=el("highimg"),
lowimg=el("lowimg"),
fade,
changeslide=function() {
    lowimg.style.backgroundImage=highimg.style.backgroundImage
    highimg.style.backgroundImage="url(img/slideshow/"+(slides[++_src]||slides[_src=0])+")"
    var time=highimg.style.opacity=0;
    highimg.style.filter="alpha(opacity=0)"
    if (fade)
    clearInterval(fade)
    fade=setInterval(function(){
        if(highimg.style.opacity<1)
        highimg.style.filter="alpha(opacity="+(highimg.style.opacity=time+=1/40)*100+")"
        else
        {
            highimg.style.filter="alpha(opacity=100)";
            highimg.style.opacity=1
            clearInterval(fade);
        }
    },25)
}
interval=setInterval(changeslide,10000)
highimg.onclick = changeslide
changeslide()