function slideSwitch() 
{
    var first = $('#slideshow div:first');
    var count = $('#slideshow div').length;
    var next;
  
    first.addClass('active');
    if (count <= 1) return true;
    
    setInterval(function(){
        var current = $('#slideshow div.active');
        var index = current.index();
        
        if( index + 1 == count )
        {
            next = first;
            
        }
        else
        {
            next = current.next();     
        }

        next.css({opacity:1});
        
        current.animate({
            opacity: 0
        }, 750, function() {
            current.removeClass('active');
            next.addClass('active');
        });

    }, 10000);    
}
$(function() {
    
    slideSwitch();
    
    //setInterval( "slideSwitch()", 3000 );
    $(".fotogal a[rel^='lightbox[gallery]']").prettyPhoto({
        animationSpeed:'slow',
        theme:'light_rounded'
    });  
    
    $("#fotogal a[rel^='lightbox[gallery]']").prettyPhoto({
        animationSpeed:'slow',
        theme:'light_rounded'
    });    
});
