var interval;
var delay;
var imageArray;
var imageCount ;
var current ;

function init() {
    interval = 5;
    delay = 3;
    imageArray = document.getElementsByTagName("img");
    imgCount = imageArray.length;
    current = 0;

    wait();
}

function wait() {
    setTimeout( slide, interval * 1000);
}

function slide() {
    imageArray[current].className = 'out';
    current = (current+1) % imgCount;
    imageArray[current].className = 'in';
    
    setTimeout(wait, delay * 1000);
}