$(document).ready(function(){
    //slideshow
    $('.slideshow').each(function(){
        var ul = $(this).children('ul');
        var li = ul.children('li');

        if(li.length > 1)
        {
            li.each(function(){
                if($(this).prev('li').length)
                    $(this).hide();
                else
                    $(this).addClass('active');
            });
        }
    });
    setInterval(showSlideshow,5000);
});
function showSlideshow()
{
    var ul = $('.slideshow').children('ul');
    var li = ul.children('li');
    var current = ul.children('li.active');

    if(current.length)
    {
        var next = current.next('li');
        var first = ul.children('li:first');
        if(next.length)
        {
            current.fadeOut('slow', function(){
                $(this).removeClass('active');
                next.fadeIn('slow').addClass('active');
            });
        }
        else if(first.length)
        {
            current.fadeOut('slow', function(){
                $(this).removeClass('active');
                first.fadeIn('slow').addClass('active');
            });
        }
    }
}