$(document).ready(function()
{

    slideShow();

});

function slideShow()
{

    $('#slider-screen a').css({opacity: 0.0});
    $('#slider-screen a:first').css({opacity: 1.0});  
    $('#slider-screen .caption').css({opacity: 1.0});  
    $('#slider-screen .caption').css({width: $('#slider-screen a').find('img').css('width')});  
    $('#slider-screen .content').html($('#slider-screen a:first').find('img').attr('rel'))  
    .animate({opacity: 1.0}, 400);  

    setInterval('gallery()',6000);  
      
}  

function gallery()
{

    var current = ($('#slider-screen a.firstScreen')?  $('#slider-screen a.firstScreen') : $('#slider-screen a:first'));
    var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#slider-screen a:first') :current.next()) : $('#slider-screen a:first'));
    var caption = next.find('img').attr('rel');

    next.css({opacity: 0.0}).addClass('firstScreen').animate({opacity: 1.0}, 1000);
    current.animate({opacity: 0.0}, 1000).removeClass('firstScreen');

    $('#slider-screen .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });
    $('#slider-screen .caption').animate({opacity: 1.0},100 ).animate({height: '50px'},500 );
    $('#slider-screen .content').html(caption);

}
