$(document).ready(function() {

var images=new Array('images/slide1.jpg','images/slide2.jpg','images/slide3.jpg');
var nextimage=0;

doSlideshow();

function doSlideshow()
{
    if($('.slideshowimage').length!=0)
    {
        $('.slideshowimage').fadeOut(800,function(){slideshowFadeIn();$(this).remove()});
    }
    else
    {
        slideshowFadeIn();
    }
}
function slideshowFadeIn()
{
    $('.slideshow').prepend($('<img class="slideshowimage" src="'+images[nextimage++]+'" style="display:none">').fadeIn(1800,function(){setTimeout(doSlideshow,4500);}));
    if(nextimage>=images.length)
        nextimage=0;
}

});
