// JavaScript Document

 $(document).ready( function () {
	
	
	$("#navigation").scrollFollow( {
    speed: 1000,
    offset: 540,
   });
	
	$("#news_menu").scrollFollow( {
    speed: 1000,
    offset: 540,
   });	
	
   $("#piumino_alfa").scrollFollow( {
    speed: 8000,
    offset: 200,
   });
   $("#piumino_beta").scrollFollow( {
    speed: 7000,
    offset: 600,
   });
   $("#piumino_teta").scrollFollow( {
    speed: 6500,
    offset: 100,
   });
   $("#piumino_gamma").scrollFollow( {
    speed: 4500,
    offset: 500,
   });   

	$("#counter").css("opacity","0.2");
	$(".nome_hover").css("opacity","0.8");
	
	$(".chisiamo_nome", this).hover(function(){
		$(".nome_hover", this).css("display","block");
	}, function() {
		$(".nome_hover", this).css("display","none");
	});
	
	$("#orto_link_hid").fadeOut();
	$("#orto").stop().hover(function() {
		$("#orto_link_hid").delay(500).fadeIn();
		$("#orto_link_vis").fadeOut();
	}, function() {
		$("#orto_link_hid").fadeOut();
		$("#orto_link_vis").delay(800).fadeIn();
	});   
   
    $("#news_box", this).hover(function(){
		$("#news_content", this).stop().animate({left:"0px"},{queue:false,duration:400});
	}, function() {
		$("#news_content", this).stop().animate({left:"-268px"},{queue:false,duration:400});
	});
   
   $(".vertical", this).hover(function(){
		$(".events_img", this).stop().animate({top:"-110px"},{queue:false,duration:400});
	}, function() {
		$(".events_img", this).stop().animate({top:"0px"},{queue:false,duration:400});
	});
   
   $("#cosa").hover(function(){
		$("#cosa").stop().animate({backgroundPosition:"(0 0)"},{queue:false,duration:200});
	}, function() {
		$("#cosa").stop().animate({backgroundPosition:"(-107px 0)"},{queue:false,duration:200});
	});

   $("#entra").hover(function(){
		$("#entra").stop().animate({backgroundPosition:"(0 0)"},{queue:false,duration:200});
	}, function() {
		$("#entra").stop().animate({backgroundPosition:"(-174px 0)"},{queue:false,duration:200});
	});

   $("#chi").hover(function(){
		$("#chi").stop().animate({backgroundPosition:"(0 0)"},{queue:false,duration:200});
	}, function() {
		$("#chi").stop().animate({backgroundPosition:"(-98px 0)"},{queue:false,duration:200});
	});

   $("#news").hover(function(){
		$("#news").stop().animate({backgroundPosition:"(0 0)"},{queue:false,duration:200});
	}, function() {
		$("#news").stop().animate({backgroundPosition:"(-67px 0)"},{queue:false,duration:200});
	});
   
    $("#about a").click(function(){
		$("#about").stop().animate({backgroundPosition:"(0 0)", height:"128px"},{queue:false,duration:400});
		$("#how").stop().animate({backgroundPosition:"(-141px 0)", height:"123px"},{queue:false,duration:400});
		$("#what").stop().animate({backgroundPosition:"(-147px 0)", height:"60px"},{queue:false,duration:400});
		$("#where").stop().animate({backgroundPosition:"(-147px 0)", height:"60px"},{queue:false,duration:400});
	});

    $("#how a").click(function(){
		$("#how").stop().animate({backgroundPosition:"(0 0)", height:"161px"},{queue:false,duration:400});
		$("#about").stop().animate({backgroundPosition:"(-147px 0)", height:"128px"},{queue:false,duration:400});
		$("#what").stop().animate({backgroundPosition:"(-147px 0)", height:"60px"},{queue:false,duration:400});
		$("#where").stop().animate({backgroundPosition:"(-147px 0)", height:"60px"},{queue:false,duration:400});
	});
	
	$("#what a").click(function(){
		$("#what").stop().animate({backgroundPosition:"(0 0)", height:"128px"},{queue:false,duration:400});
		$("#about").stop().animate({backgroundPosition:"(-147px 0)", height:"128px"},{queue:false,duration:400});
		$("#how").stop().animate({backgroundPosition:"(-141px 0)", height:"123px"},{queue:false,duration:400});
		$("#where").stop().animate({backgroundPosition:"(-147px 0)", height:"60px"},{queue:false,duration:400});
	});
   
    $("#where a").click(function(){
		$("#where").stop().animate({backgroundPosition:"(0 0)", height:"128px"},{queue:false,duration:400});
		$("#about").stop().animate({backgroundPosition:"(-147px 0)", height:"128px"},{queue:false,duration:400});
		$("#how").stop().animate({backgroundPosition:"(-141px 0)", height:"123px"},{queue:false,duration:400});
		$("#what").stop().animate({backgroundPosition:"(-147px 0)", height:"60px"},{queue:false,duration:400});
	});
	
		
	$("#navigation_rcd").toggle(function(){
		$("#submenu").css("display","block");
	}, function() {
		$("#submenu").css("display","none");
	});
	
});
