$(document).ready(function() {

//$('a.thickbox').each(function(index) {
//$(this).attr('href', $(this).find('img').attr('src'));
//});

// initialize gallery
setInterval(performSlideshow, 5000);

// scroll to top
$('a[href=#top]').click(function(event) {
event.preventDefault();
$('html, body').animate({scrollTop: 0}, 'fast');
return false;
});



});

function performSlideshow() {
if ($('#slideshow img').length > 0) {
var active = $('#slideshow img.active');
    if (active.length == 0) active = $('#slideshow img:last');
    var next = active.next().length ? active.next() : $('#slideshow img:first');
    active.addClass('last-active');
    next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            active.removeClass('active last-active');
        });
}
}

