$(document).ready(function(){

	setInterval(function(){

		// Selecting only the visible layers:
		var versions = $('.textVersion:visible');
		
		if(versions.length<2){
			// If only one layer is visible, show the other
			$('.textVersion').fadeIn(800);
		}
		else{
			// Hide the upper layer
			versions.eq(0).fadeOut(800);
		}
	},1000);

});


function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');
    $active.animate ({ "top": "-=0px"}, 2400);
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')       
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });       
}

$(function() {
    setInterval( "slideSwitch()", 7000 );
});



