﻿/*slideshow imgs home*/
function slideSwitch() {
    var $active = $('#slideshow IMG.active');
    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
    // use this to pull the images in the order they appear in the markup
    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');
        });
}

$(document).ready(function(){

/*click 3 bots home ------------------ */ 

		$('#bot1').click(
			function(){
			if ($('#slideshow').css("opacity") != 0){$('#slideshow').stop('true').animate({opacity: 0.0}, 500);}
			$('#apdo1').stop('true').animate({opacity: 1.0}, 500);
			if ($('#apdo2').css("opacity") != 0){$('#apdo2').stop('true').animate({opacity: 0.0}, 500);}
			if ($('#apdo3').css("opacity") != 0){$('#apdo3').stop('true').animate({opacity: 0.0}, 500);}
			}
		);
		$('#bot2').click(
			function(){
			if ($('#slideshow').css("opacity") != 0){$('#slideshow').stop('true').animate({opacity: 0.0}, 500);}
			$('#apdo2').stop('true').animate({opacity: 1.0}, 500);
			if ($('#apdo1').css("opacity") != 0){$('#apdo1').stop('true').animate({opacity: 0.0}, 500);}
			if ($('#apdo3').css("opacity") != 0){$('#apdo3').stop('true').animate({opacity: 0.0}, 500);}
			}
		);
		$('#bot3').click(
			function(){
			if ($('#slideshow').css("opacity") != 0){$('#slideshow').stop('true').animate({opacity: 0.0}, 500);}
			$('#apdo3').stop('true').animate({opacity: 1.0}, 500);
			if ($('#apdo1').css("opacity") != 0){$('#apdo1').stop('true').animate({opacity: 0.0}, 500);}
			if ($('#apdo2').css("opacity") != 0){$('#apdo2').stop('true').animate({opacity: 0.0}, 500);}
			}
		);

		setInterval( "slideSwitch()", 5000 );
/*todo fin*/
});

