$(document).ready(function() {     
     
    //Execute the slideShow
    slideShow();
 
});
 
function slideShow() {
 
    $('#gallery a').css({opacity: 0.0});
    $('#gallery a:first').css({opacity: 1.0});
    $('#gallery .caption').css({opacity: 0.7});
    $('#gallery .caption').css({width: $('#gallery .caption').find('img').css('width')});
	$('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
    .animate({opacity: 0.8}, 400);
    setInterval('gallery()',6000);
     
}

function gallery() {
     
    var current = ($('#gallery a.show')?  $('#gallery a.show') : $('#gallery a:first'));
    var caption = next.find('img').attr('rel');
    next.css({opacity: 0.0})
    .addClass('show')
    .animate({opacity: 1.0}, 4000);
    current.animate({opacity: 0.0}, 1000)
    .removeClass('show');
    $('#gallery .caption').animate({opacity: 0.8}, { queue:false, duration:1000 }).animate({height: '50px'}, { queue:true, duration:300 });
    $('#gallery .caption').animate({opacity: 0.7},100 ).animate({height: '50px'},700 );
    $('#gallery .content').html(caption);
         
}
