var images = new Array(new Image(), new Image());
images[0].src = 'pictures/slide_1.jpg';
images[1].src = 'pictures/slide_2.jpg';
images[1].onload = function() { setTimeout('var timer = setInterval("fade();", 10);', 3000); }

var opacity = 100;
var appear = false;

function fade()
{
    var image = document.getElementById('slideshow');

    if (opacity < 100 && appear)
        opacity++;
    else if (opacity > 0 && !appear)
        opacity--;
    
    if (opacity >= 100) {
        appear = false;
        pause(3);
    } else if (opacity <= 0) {
        appear = true;
        
        if (image.src == images[0].src)
            image.src = images[1].src;
        else
            image.src = images[0].src;
    }
    
    image.style.opacity = opacity / 100;
    image.style.filter = 'alpha(opacity = ' + opacity + ')';
}

function pause(delay)
{
    clearInterval(timer);
    setTimeout('timer = setInterval("fade();", 10);', delay * 1000);
}
