(function($) {  
$(document).ready(function() {            
    slideShow('#slideshow',3000);
    slideShow('#slideshow1',4000);
    slideShow('#slideshow2',5000);
    slideShow('#slideshow3',6000);
});
})(jQuery)
function slideShow(elem,sp) {
    $(elem + ' img').css({opacity: 0.0});
    $(elem + ' img:first').css({opacity: 1.0});
    $(elem + ' .caption').css({opacity: 0.5});
    $(elem + ' .caption').css({width: $(elem + ' img').css('width')});
    $(elem + ' .content1').html($(elem + ' img:first').attr('title'))
    .animate({opacity: 1}, 400);
    setInterval(
        function gallery() {
            var current = ($(elem + ' img.show')?  $(elem + ' img.show') : $(elem + ' img:first'));
            var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $(elem + ' img:first') :current.next()) : $(elem + ' img:first'));    
            var caption = next.attr('title');    
            next.css({opacity: 0.0})
            .addClass('show')
            .animate({opacity: 1.0}, 1000);

            current.animate({opacity: 0.0}, 1000)
            .removeClass('show');
            
            $(elem + ' .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });    
            $(elem + ' .caption').animate({opacity: 0.5},100 ).animate({height: '35px'},500 );
            $(elem + ' .content1').html(caption);  
        }
    ,sp);  
}
