var timeDisplayed = 5000;
var timeTransition = 1000;

function slideSwitch() {
    var $active = $('#fotoHolder #fotos img.active');

    if ( $active.length == 0 ) $active = $('#fotoHolder #fotos img:last');

    var $next =  $active.next().length ? $active.next()
        : $('#fotoHolder #fotos img:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, timeTransition, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", timeDisplayed );
});
