$(document).ready(function(){

// Menu Deslizante
	$('#info').animate({left:'50px'},300);
	
	$('#nav a').click(function(){
		a=parseInt($('#nav a').index(this))+1;
		if($('#contenido').children('div').index($('#contenido').children('div:visible'))!=a){
			$('#contenido').children('div:visible').animate({left:'380px'},500,function(){
				$(this).hide();
				$('#contenido').children('div').eq(a).show().animate({left:'50px'},500);
			});
		}
		return false;
	});

// Scroll de la sección Barco
$("#bajar").hover(function(){ 
	c=$(".scrolling").parents("div").height();
	m=0-($(".scrolling").height())+c-0;
	a=($(".scrolling").height()/c)*3000;			
	if(c<$(".scrolling").height())$(".scrolling").animate({top: m+'px'},a);
},function(){$(".scrolling").stop();});

$("#subir").hover(function(){ 
	c=$(".scrolling").parents("div").height();
	a=($(".scrolling").height()/c)*3000;			
	if(c<$(".scrolling").height())$(".scrolling").animate({top: '0px'},a);
},function(){$(".scrolling").stop();});

$(".scrollbutton>img").hover(function(){$(this).attr("src", "images/circulo2.png");},function(){$(this).attr("src", "images/circulo.png");});	

$("#bajar").click(function(){ 
	c=$(".scrolling").parents("div").height();
	m=0-($(".scrolling").height())+c-0;
	if(c<$(".scrolling").height())$(".scrolling").stop().animate({top: m+'px'}, 300);
});		

$("#subir").click(function(){if(c<$(".scrolling").height()){$(".scrolling").stop().animate({top: '0px'}, 300);}});


// Scroll de la sección EQUIPO
$("#bajar2").hover(function(){ 
	c=$(".scrolling2").parents("div").height();
	m=0-($(".scrolling2").height())+c-0;
	a=($(".scrolling2").height()/c)*3000;			
	if(c<$(".scrolling2").height())$(".scrolling2").animate({top: m+'px'},a);
},function(){$(".scrolling2").stop();});

$("#subir2").hover(function(){ 
	c=$(".scrolling2").parents("div").height();
	a=($(".scrolling2").height()/c)*3000;			
	if(c<$(".scrolling2").height())$(".scrolling2").animate({top: '0px'},a);
},function(){$(".scrolling2").stop();});

$(".scrollbutton2>img").hover(function(){$(this).attr("src", "images/circulo2.png");},function(){$(this).attr("src", "images/circulo.png");});	

$("#bajar2").click(function(){ 
	c=$(".scrolling2").parents("div").height();
	m=0-($(".scrolling2").height())+c-0;
	if(c<$(".scrolling2").height())$(".scrolling2").stop().animate({top: m+'px'}, 300);
});		

$("#subir2").click(function(){if(c<$(".scrolling2").height()){$(".scrolling2").stop().animate({top: '0px'}, 300);}});

// Scroll de la sección CALENDARIO
$("#bajar3").hover(function(){ 
	c=$(".scrolling3").parents("div").height();
	m=0-($(".scrolling3").height())+c-0;
	a=($(".scrolling3").height()/c)*3000;			
	if(c<$(".scrolling3").height())$(".scrolling3").animate({top: m+'px'},a);
},function(){$(".scrolling3").stop();});

$("#subir3").hover(function(){ 
	c=$(".scrolling3").parents("div").height();
	a=($(".scrolling3").height()/c)*3000;			
	if(c<$(".scrolling3").height())$(".scrolling3").animate({top: '0px'},a);
},function(){$(".scrolling3").stop();});

$(".scrollbutton3>img").hover(function(){$(this).attr("src", "images/circulo2.png");},function(){$(this).attr("src", "images/circulo.png");});	

$("#bajar3").click(function(){ 
	c=$(".scrolling3").parents("div").height();
	m=0-($(".scrolling3").height())+c-0;
	if(c<$(".scrolling3").height())$(".scrolling3").stop().animate({top: m+'px'}, 300);
});		

$("#subir3").click(function(){if(c<$(".scrolling3").height()){$(".scrolling3").stop().animate({top: '0px'}, 300);}});

// Scroll de la sección ENLACES
$("#bajar4").hover(function(){ 
	c=$(".scrolling4").parents("div").height();
	m=0-($(".scrolling4").height())+c-0;
	a=($(".scrolling4").height()/c)*3000;			
	if(c<$(".scrolling4").height())$(".scrolling4").animate({top: m+'px'},a);
},function(){$(".scrolling4").stop();});

$("#subir4").hover(function(){ 
	c=$(".scrolling4").parents("div").height();
	a=($(".scrolling4").height()/c)*3000;			
	if(c<$(".scrolling4").height())$(".scrolling4").animate({top: '0px'},a);
},function(){$(".scrolling4").stop();});

$(".scrollbutton4>img").hover(function(){$(this).attr("src", "images/circulo2.png");},function(){$(this).attr("src", "images/circulo.png");});	

$("#bajar4").click(function(){ 
	c=$(".scrolling4").parents("div").height();
	m=0-($(".scrolling4").height())+c-0;
	if(c<$(".scrolling4").height())$(".scrolling4").stop().animate({top: m+'px'}, 300);
});		

$("#subir4").click(function(){if(c<$(".scrolling4").height()){$(".scrolling4").stop().animate({top: '0px'}, 300);}});

// Lightbox
	$(function() {
        $('#gallery a').lightBox();
    });

});