var _altezza;
var _pos;
var concept_open = false;
$(document).ready(function(){
	
	   $('#menufooter').hide();
    $('#blocco_news').css('opacity','0');
    //$('#blocco_identity').hide();
    $('#blocco_step').hide();
    $('#blocco_step_testo .text_container div').css('margin-top','170px');
    $('#blocco_latest').css('width','0')
    $('#blocco_latest_testo').css('width','12px');
 
   // $('#blocco_player').hide();
    $('#blocco_webdesign').hide();
    $('#blocco_cases').css('width','0');
    //$('#blocco_sound').hide();
    //$('#blocco_software').hide();
    $('#blocco_concept').css('height','0');
    $('#blocco_credits').hide();
    $('#blocco_concept_testo').css('height','8px');
   
  
    $('#blocco_sound').css('width','0');
    $('#blocco_player').css('opacity','0');
    $('#blocco_player .jp-controls').hide();
    $('#blocco_player .jp-stop').hide();
    $('#blocco_player .jp-next').hide();
    $('#blocco_player .jp-previous').hide();
    $('#blocco_software').css('width','0px');
    $('#blocco_software').css('margin-left','185px');
    $('#blocco_step .bt_step').css('opacity','0');
    $('.fondo_big').css('opacity','0');
    $('.fondo_small').css('opacity','0');
    $('.fondo_long').css('opacity','0');
    
});

$(window).load(function(){
	
	if(window.location.href.search("news") != -1){
		$('body,html').stop(false,false).animate({scrollTop:185}, 1200, 'easeInOutExpo');  

	}
	
	// sound //
	
	new jPlayerPlaylist({
		jPlayer: "#jquery_jplayer_1",
		cssSelectorAncestor: "#jp_container_1"
	}, [
		{
			title:track_1,
			mp3:"/audio/mp3/campanina.mp3",
			oga:"/audio/ogg/campanina.ogg"
		
		},
		{
			title:track_2,
			mp3:"/audio/mp3/communicate.mp3",
			oga:"/audio/ogg/communicate.ogg"
		},
		{
			title:track_3,
			mp3:"/audio/mp3/de_riso.mp3",
			oga:"/audio/ogg/de_riso.ogg"
		},
		{
			title:track_4,
			mp3:"/audio/mp3/ex_capri.mp3",
			oga:"/audio/ogg/ex_capri.ogg"
		}
	], {
		
		  playlistOptions: {
		    autoPlay: true
		   
		  },
		swfPath: "script/default",
		solution:"html, flash",
		supplied: "oga, mp3"
		
		
	});
	
	
	var track_1  = "track01_La Campanina Capri"
	var track_2 =  "track02_Communicate"
	var track_3 =  "track03_Sal De Riso"
	var track_4 =  "track04_Exclusive Capri"
		
	$('#track_name p').text(track_1);
	
	
	
	$('.jp-volume-bar-custom').mouseup(function(){
		$(document).unbind('mousemove',move_volume);
	    }).mousedown(function(){
	    	$(document).bind('mousemove',move_volume);
	    });

	$('.jp-volume-bar-custom').css('transform','rotate(315deg)')
	$("#jquery_jplayer_1").jPlayer("volume", 0.75);
	$("#jquery_jplayer_1").bind($.jPlayer.event.ended + ".track_change", function(event) {
if(current_home_track < total_home_track){
			
			current_home_track++;
			$('#track_name').animate({
		        marginTop: 0
		    }, 400, 'easeOutExpo',function(){$('#track_name p').text(eval("track_"+current_home_track))}).animate({
		        marginTop: -30
		    }, 400, 'easeOutExpo')
			
		}
	});
	
	// giro completo del controllo volume tondo, cambiare il nome di default del controllo volume in jp-volume-bar-custom-custom
	
	/* var current_home_track = 1;
	var total_home_track = 4;
	var able = true;
	var able_right = false;
	var able_left = true;
	var vvalue = 0; 
	var value = 0;
	
	function move_volume(e){
	
		if(e.pageX > $('.jp-volume-bar-custom-custom').offset().left+($('.jp-volume-bar-custom-custom').width()/2) && able_right == true) {
			if(e.pageY > $('.jp-volume-bar-custom-custom').offset().top && e.pageY < $('.jp-volume-bar-custom-custom').offset().top+$('.jp-volume-bar-custom-custom').height()+10) {
				value = 180/($('.jp-volume-bar-custom-custom').height())*(e.pageY - $('.jp-volume-bar-custom-custom').offset().top)
			} else if( e.pageY > $('.jp-volume-bar-custom-custom').offset().top+$('.jp-volume-bar-custom-custom').height()+10){
				
				value = 180;
				
			} else if(e.pageY < $('.jp-volume-bar-custom-custom').offset().top){
				value = 0;
				
			}
		} 
		if(e.pageX < $('.jp-volume-bar-custom-custom').offset().left+($('.jp-volume-bar-custom-custom').width()/2) && able_left == true) {
			if(e.pageY > $('.jp-volume-bar-custom-custom').offset().top && e.pageY < $('.jp-volume-bar-custom-custom').offset().top+$('.jp-volume-bar-custom-custom').height()+10) {
				value = 360-(180/($('.jp-volume-bar-custom-custom').height())*(e.pageY - $('.jp-volume-bar-custom-custom').offset().top))
				able = true;
			} else if( e.pageY > $('.jp-volume-bar-custom-custom').offset().top+$('.jp-volume-bar-custom-custom').height()+10){
				
				value = 180;
				
			}  else if(e.pageY < $('.jp-volume-bar-custom-custom').offset().top){
				value = 340;
				able = false;
				
			}
			
		}
		
		
		if(value > 120 && value < 300) {
			able_left = true;
			able_right = true
			
		} else if(value > 300) {
			able_left = true;
			able_right = false
			
		} else if (value < 120) {
			able_left = false;
			able_right = true
			
		}

		if(value<340 && able == true){
		
			$('.jp-volume-bar-custom-custom').stop().animate({
			 rotate:value+'deg'
			  
		 }, 200,'easeOutCubic');
		
		$("#jquery_jplayer_1").jPlayer("volume", value/340);
	
		}	
	}

	*/
	var current_home_track = 1;
	var total_home_track = 4;
	var value = 180;
	function move_volume(e){
	
	
			if(e.pageY > $('.jp-volume-bar-custom').offset().top && e.pageY < $('.jp-volume-bar-custom').offset().top+$('.jp-volume-bar-custom').height()) {
				value = (180/$('.jp-volume-bar-custom').height())*(e.pageY - $('.jp-volume-bar-custom').offset().top)
			} else if(e.pageY < $('.jp-volume-bar-custom').offset().top){
				
				value = 360;
				$("#jquery_jplayer_1").jPlayer("volume", 1);
				$('.jp-volume-bar-custom').stop().animate({
					rotate:360+'deg'
				  
				}, 200,'easeOutCubic');
				
			} else if(e.pageY > $('.jp-volume-bar-custom').offset().top+$('.jp-volume-bar-custom').height()){
				
				value = 180;
				$("#jquery_jplayer_1").jPlayer("volume", 0);
				$('.jp-volume-bar-custom').stop().animate({
					rotate:180+'deg'
				  
				}, 200,'easeOutCubic');
			}
			
			if(value < 360){
				$('.jp-volume-bar-custom').stop().animate({
					rotate:360-value+'deg'
				  
				}, 200,'easeOutCubic');
			
				$("#jquery_jplayer_1").jPlayer("volume", (180-value)/180);
			
			}
			
	}
	
	
	$('.jp-next').click(function(){
		
		if(current_home_track < total_home_track){
			
			current_home_track++;
			$('#track_name').animate({
		        marginTop: 0
		    }, 400, 'easeOutExpo',function(){$('#track_name p').text(eval("track_"+current_home_track))}).animate({
		        marginTop: -30
		    }, 400, 'easeOutExpo')
			
		}
		
	});
	$('.jp-previous').click(function(){
		if(current_home_track > 1){
			current_home_track--;
			$('#track_name').animate({
		        marginTop: 0
		    }, 400, 'easeOutExpo',function(){$('#track_name p').text(eval("track_"+current_home_track))}).animate({
		        marginTop: -30
		    }, 400, 'easeOutExpo')
			
		}	
		
	});
	
	 $('#blocco_webdesign .nome_sez').delay(1400-time_delay).animate({
	        marginTop: -30
	    }, 400, 'easeOutExpo');
	
	
	//
	
	Cufon.replace('.nome_sez p',{ fontFamily: 'Helvetica67' ,  hover: false });
	
	$('#blocco_step .bt_step:first').css('margin-left','18px');

   // $('#dope').delay(1500-time_delay).fadeTo(600,1,'easeOutQuart');

    
    $('#blocco_webdesign').delay(1300-time_delay).fadeIn(600, 'easeOutQuart',function(){
    		$('#blocco_webdesign').mouseenter(function(){
	  // listener webdesign
    	
    	$('#blocco_webdesign div.fondo_big').animate({
          opacity:0.3
  	     
      }, 300, 'easeOutQuart');
    	 
     });
    
$('#blocco_webdesign').mouseleave(function(){
	  $('#blocco_webdesign div.fondo_big').stop().animate({
        opacity:0
	     
    }, 300, 'easeOutQuart');
  	 
   });
$('#blocco_webdesign').click(function(){
	  destinazione = "web";
	  rimuovi_blocchi_index();
	  $('body,html').stop(false,false).animate({scrollTop:0}, 1200, 'easeInOutExpo');  
})

    }); // fine listener webdesign - function dentro fadeIn
    
    $('.nome_sez').css('margin-top','0');
    
    $('#blocco_webdesign .nome_sez').delay(1400-time_delay).animate({
        marginTop: -30
    }, 400, 'easeOutExpo');
    
   
   $('#blocco_news').delay(1300-time_delay).animate({
        opacity: 1
   
   }, 800, 'easeOutQuart',function(){$(window).bind('scroll',gestione_scroll)});
   
   $('#blocco_news div.titolo_news').delay(1500-time_delay).animate({
       width: 170
    }, 1000, 'easeInOutExpo');
   
   $('#blocco_news div.testo_news').delay(1600-time_delay).animate({
       width: 170
    }, 1000, 'easeInOutExpo');
   
   $('#blocco_news div.puls').delay(2000-time_delay).fadeIn(600, 'easeOutQuart');
    
    $('#blocco_identity').delay(1400-time_delay).animate({
        height: 370
    }, 1900, 'easeInOutExpo', function (){
    	// listener identity
    	$('#blocco_identity').mouseenter(function(){
    		  $('#blocco_identity div.fondo_long').animate({
    	    opacity:0.3
    		     
    	}, 300, 'easeOutQuart');
    		 
    	});
    	
    	$('#blocco_identity').mouseleave(function(){
    		  $('#blocco_identity div.fondo_long').stop().animate({
    	  opacity:0
    		     
    	}, 300, 'easeOutQuart');
    	
    	});
    	
    	 $('#blocco_identity').click(function(){
    		  destinazione = "print";
    		  $('body,html').stop(false,false).animate({scrollTop:0}, 1200, 'easeInOutExpo');  
    	  	rimuovi_blocchi_index();
    	  })
    	
    }); // fine listener identity dentro animate
    
    $('#blocco_identity .nome_sez').css('margin-top','-30px');
    
    $('#blocco_sound').css('width','0');
    
    $('#blocco_sound').delay(1700-time_delay).animate({
       width: 185
    }, 1200, 'easeInOutExpo', function (){
    
    // listener sound
    $('#blocco_sound').mouseenter(function(){
  	  $('#blocco_sound div.fondo_small').animate({
          opacity:0.3
  	     
      }, 300, 'easeOutQuart');
    	 
     });
  $('#blocco_sound').mouseleave(function(){
  	  $('#blocco_sound div.fondo_small').stop().animate({
        opacity:0
  	     
    }, 300, 'easeOutQuart');
  	 
   });

  $('#blocco_sound').click(function(){
	  destinazione = "sound";
  	rimuovi_blocchi_index();
  	$('body,html').stop(false,false).animate({scrollTop:0}, 1200, 'easeInOutExpo');  
  })
    
    
    
    }); // fine listener sound, dentro animate
    
    $('#blocco_sound .nome_sez').delay(2400-time_delay).animate({
        marginTop: -30
    }, 400, 'easeOutExpo');
    
    
    
    $('#blocco_software').delay(1800-time_delay).animate({
        marginLeft:0,
        width:185
    }, 1200, 'easeInOutExpo',function (){
    	// listener software
    	$('#blocco_software').mouseenter(function(){
    		  $('#blocco_software div.fondo_small').animate({
    	      opacity:0.3
    		     
    	  }, 300, 'easeOutQuart');
    		 
    	 });
    	$('#blocco_software').mouseleave(function(){
    		  $('#blocco_software div.fondo_small').stop().animate({
    	    opacity:0
    		     
    	}, 300, 'easeOutQuart');
    		 
    	});
    	
    	 $('#blocco_software').click(function(){
   		  destinazione = "software";
   	  	rimuovi_blocchi_index();
   	 $('body,html').stop(false,false).animate({scrollTop:0}, 1200, 'easeInOutExpo');  
   	  })
    	
    });  // fine listner software dentro animate	
    	
    	
   
    
    $('#blocco_software .nome_sez').delay(2500-time_delay).animate({
        marginTop: -30
    }, 400, 'easeOutExpo');
    
    $('#blocco_player').delay(2400-time_delay).animate({
        opacity: 1
     }, 800, 'easeOutQuart');
    
    $('#blocco_player .jp-controls').delay(2450-time_delay).fadeIn(600,'easeOutQuart');
    $('#blocco_player .jp-stop').delay(2500-time_delay).fadeIn(600,'easeOutQuart');
    $('#blocco_player .jp-previous').delay(2550-time_delay).fadeIn(600,'easeOutQuart');
    $('#blocco_player .jp-next').delay(2600-time_delay).fadeIn(600,'easeOutQuart');
  
    
    $('#track_name').delay(2500-time_delay).animate({
        marginTop: -30
    }, 400, 'easeOutExpo');
    
    $('#artwork').delay(2600-time_delay).fadeIn(600, 'easeOutQuart',function(){ $('#artwork').css('z-index','-1');});
   
    
    
    $('#blocco_step div.bt_step').bind('mouseenter',seleziona_bt_verde);
    	
    
    function seleziona_bt_verde(){
   	 $(this).find('img').stop().animate({
         marginTop: -37
     }, 300, 'easeOutExpo');
   	
   	
   }
    
    $('#blocco_step div.bt_step').bind('mouseleave',deseleziona_bt_verde);
    		
    function deseleziona_bt_verde(){
    	 $(this).find('img').animate({
             marginTop: 0
         }, 600, 'easeInOutExpo');
    	
    	
    }
    
    $('#blocco_step div.bt_step').bind('click',mostra_testo_lavoriamo);
    
    
    function mostra_testo_lavoriamo(){
    	_altezza = $('#blocco_step_testo .text_container div p.elastic:nth-child('+eval($(this).index()+1)+')').height();
    
   	 	$(document).unbind('mousemove',muovi_testo); 
    	 $('#blocco_step div.bt_step').unbind('mouseleave',deseleziona_bt_verde);
    	 $('#blocco_step div.bt_step').unbind('mouseenter',seleziona_bt_verde);
    	 $('#blocco_step div.bt_step').unbind('click',mostra_testo_lavoriamo);
    	 $(this).siblings().bind('mouseleave',deseleziona_bt_verde);
    	 $(this).siblings().bind('mouseenter',seleziona_bt_verde);
    	 $(this).siblings().bind('click',mostra_testo_lavoriamo);
    	 $(this).siblings().find('img').animate({
             marginTop: 0
         }, 600, 'easeInOutExpo');
    	
    	 switch($(this).index()) {
    	 case 0:
    	_pos = -18; 
    	 
    	 break;
    	 case 1:
    	 _pos = -340;
    	
    	 break;
    	 case 2:
    		 _pos = -600;
    		
    		 break;
    	
    	 case 3:
    		_pos=-938;
    		 break;
    	 }
    
    	 $('body,html').stop(false,false).animate({scrollTop:$('#blocco_step').offset().top}, 1000, 'easeInOutExpo',function(){ });	 
    	 
    	 $('#blocco_step_testo .text_container div').animate({
    		 marginTop:_pos
         }, 1000, 'easeInOutExpo');
    	 
    	  if( $('#blocco_step_testo .text_container div p.elastic:nth-child('+eval($(this).index()+1)+')').height() > 170){
    		  $(document).bind('mousemove',muovi_testo);
    		  
    	    }

    	  
    }
    
  
   
    $('#blocco_step div.bt_step').css('cursor','pointer');
    

    // condizioni per far visualizzare i blocchi, il primo numero prima di cof_altezza è l'offset 
    // dell'oggetto, scritto direttamente perche non assume subito la sua posizione, cof_altezza
    // è il valore di altezza dopo il quale deve comparire
    
    if($(window).height()>740+cof_altezza || $(window).height()+$(window).scrollTop()>740+cof_altezza) { 	
    	anima_blocco_step(0);
    }
    
    if($(window).height()>555+cof_altezza || $(window).height()+$(window).scrollTop()>555+cof_altezza) { 	
    	srotola_concept(0);
    }
    if($(window).height()>925+cof_altezza || $(window).height()+$(window).scrollTop()>925+cof_altezza) { 	
    	srotola_cases(0);
    }
    if($(window).height()>555+cof_altezza || $(window).height()+$(window).scrollTop()>555+cof_altezza_2) { 	
    	anima_latest(0);
    }
    if($(window).height()>1110+cof_altezza || $(window).height()+$(window).scrollTop()>1110+cof_altezza) { 	
    	mostra_contatti(0);
    }
 
    
    
    
    
     
     
     // ROLL OVER
    // testo_concept
    

 $('#blocco_concept').mouseenter(function(){
    	    	
	$('#blocco_concept .c_selected').stop().fadeTo(400, 1, 'easeOutQuart');
   })
    	    
 $('#blocco_concept').mouseleave(function(){
    	    	
    $('#blocco_concept .c_selected').stop().fadeTo(400,0, 'easeOutQuart');
    })
    	    
    $('#blocco_concept').toggle(function(){
    	concept_open = true;
 $('#blocco_concept .c_selected img').attr('src','../../style/img/sf_concept_m_selected.png')
  $('#blocco_concept .c_normal img').attr('src','../../style/img/sf_concept_m.png')
     $('body,html').stop(false,false).animate({scrollTop:$('#blocco_concept').offset().top}, 1000, 'easeInOutExpo',function(){ });	 
  $('#blocco_concept_testo').stop().animate({
    	   height: 305,		     
     }, 800, 'easeInOutExpo');
 
 
    	    
  }, function(){
		concept_open = false;
    	 $('#blocco_concept .c_selected img').attr('src','../../style/img/sf_concept_over.png')
    	$('#blocco_concept .c_normal img').attr('src','../../style/img/sf_concept.png')
    		$('#blocco_concept_testo').stop().animate({
    		        height: 8,
    		     
    		    }, 800, 'easeInOutExpo')}
  );
   
     
 
     // pulsante news //
     $('#blocco_news div.puls').mouseenter(function(){
     	
     	$('#blocco_news div.puls img').animate({
             marginLeft: -37,
     	     
         }, 300, 'easeOutExpo');
     	
     });

     $('#blocco_news div.puls').mouseleave(function(){
     	$('#blocco_news div.puls img').animate({
             marginLeft: 0,
     	     
         }, 600, 'easeInOutExpo');
     	
     });
     
     // cases history

     $('#blocco_cases').mouseenter(function(){
     	
     	$('#blocco_cases  .cas_selected').stop().fadeTo(400, 1,'easeOutQuart');
     })

     $('#blocco_cases').mouseleave(function(){
     	
     	$('#blocco_cases  .cas_selected').stop().fadeTo(400,0, 'easeOutQuart');
     })
     
        $('#blocco_cases').click(function(){
    	  
    	 $('body,html').stop(false,false).animate({scrollTop:0}, 1200, 'easeInOutExpo',function(){ });	  
    	  
   
    	  destinazione = "cases-history"
  			identifica_corrente();
      })
     
});
 
  
    
	// gestione scrolling
    
    
    
    function gestione_scroll(){
    	if($(window).height()+$(window).scrollTop()>740+cof_altezza){
    		
    		 anima_blocco_step(2800);
    	}
    	if($(window).height()+$(window).scrollTop()>555+cof_altezza){
    		
   		 srotola_concept(2200);
    	}
    	if($(window).height()+$(window).scrollTop()>925+cof_altezza){
    		
      		 srotola_cases(3400);
       	}
    	if($(window).height()+$(window).scrollTop()>555+cof_altezza_2){
    		
      		 anima_latest(2400);
      	}
    	if($(window).height()+$(window).scrollTop()>1110+cof_altezza){
    		
     		 mostra_contatti(3800);
      	}
    	
    	
    }
      



// animazioni singole

function anima_blocco_step(earlier){
	
	$('#blocco_step').delay(2800-time_delay-earlier).fadeIn(600, 'easeOutQuart');

	$('#blocco_step div.bt_step').each(function(i){

	  $('#blocco_step div.bt_step:nth-child('+(i+1)+')').delay(2900-time_delay-earlier+(30*i)).animate({
          opacity: 1
      }, 600, 'easeOutQuart');
	  
	  $('#blocco_step .come_lav').delay(3200-time_delay-earlier).fadeIn(600, 'easeOutQuart');
	
	});
}

function srotola_concept(earlier){
	
	$('#blocco_concept').delay(2200-time_delay-earlier).animate({
	       height: 185
	    }, 800, 'easeInOutExpo');
}

function srotola_cases(earlier){
	
	$('#blocco_cases').delay(3400-time_delay-earlier).animate({
	       width: 185
	    }, 800, 'easeInOutExpo');
}

function anima_latest(earlier){
	  $('#blocco_latest').delay(2400-time_delay-earlier).animate({
	        
	        width:370
	    }, 1000, 'easeInOutExpo');
	    

	   $('#blocco_latest_testo').delay(2850-time_delay-earlier).animate({
	        width: 170,
	     
	    }, 800, 'easeInOutExpo');	
	
}

function mostra_contatti(earlier){
	 $('#blocco_credits').delay(3800-time_delay-earlier).fadeIn(600, 'easeOutQuart');
	 $('#menufooter').delay(3810-time_delay-earlier).fadeTo(600,1,'easeOutQuart');
}

// rimozione blocchi //

function rimuovi_blocchi_index(){
if(portfolio_open == true){
		
		togli_menu_portfolio();
		
	}
$('#menufooter').stop().clearQueue().fadeTo(600,0,'easeOutQuart');
if(concept_open){
	 $('#blocco_concept .c_selected img').attr('src','../../style/img/sf_concept_over.png')
 	$('#blocco_concept .c_normal img').attr('src','../../style/img/sf_concept.png')
 		$('#blocco_concept_testo').stop().animate({
 		        height: 8,
 		     
 		    }, 300, 'easeOutQuart')}


$('#menu_1 video').animate({
    opacity: 0,
  }, 200, 'easeOutQuart');
	
	$('#artwork').css('z-index','4');
	$('#artwork .art_2').delay(0).fadeIn(600, 'easeOutQuart');

	$(window).unbind('scroll',gestione_scroll);

	$('#blocco_step').stop().clearQueue();

	$('#blocco_latest').stop().clearQueue();
	$('#blocco_latest_testo').stop().clearQueue();

	$('#blocco_concept').stop().clearQueue();

	$('#blocco_cases').stop().clearQueue();
	$('#blocco_credits').stop().clearQueue();
	

	
	
	
    $('#blocco_software .nome_sez').animate({
        marginTop: 0
    }, 400, 'easeOutExpo');
    
    $('#blocco_identity .nome_sez').delay(50).animate({
        marginTop: 0
    }, 400, 'easeOutExpo');
    
    $('#blocco_webdesign .nome_sez').delay(100).animate({
        marginTop: 0
    }, 400, 'easeOutExpo');
    $('#blocco_sound .nome_sez').delay(150).animate({
        marginTop: 0
    }, 400, 'easeOutExpo');
    $('#track_name').delay(200).animate({
        marginTop: 0
    }, 400, 'easeOutExpo');
    

	$('#blocco_concept').delay(100).animate({
	       height: 0
	    }, 400, 'easeOutExpo');
    
    $('#blocco_identity').delay(100).animate({
        height: 0
    }, 1000, 'easeInOutExpo',function(){window.location = "/"+destinazione});
   
    
    $('#blocco_software').delay(100).animate({
        marginLeft:185,
        width:0
    }, 600, 'easeInOutExpo');
    
    
   
  
   $('#blocco_news').delay(200).animate({
       opacity: 0,
  
  }, 400, 'easeOutQuart');
   
   $('#blocco_sound').delay(200).animate({
       width: 0
    }, 800, 'easeInOutExpo');
   
  
		
		$('#blocco_step').fadeOut(600, 'easeOutQuart');

		
		$('#blocco_latest').stop().animate({ 
	        width:0
	    }, 1000, 'easeInOutExpo');
	    

	   $('#blocco_latest_testo').stop().animate({
	        width: 11
	     
	    }, 800, 'easeInOutExpo');	
		
		$('#blocco_concept').animate({
		       height: 0
		    }, 800, 'easeInOutExpo');
	

	
		
		$('#blocco_cases').animate({
		       width: 0
		    }, 800, 'easeInOutExpo');
	


		  
		
	


		 $('#blocco_credits').fadeOut(600, 'easeOutQuart');
	
   
  
   
   $('#blocco_player .jp-controls').delay(200).fadeOut(400,'easeOutQuart');
   $('#blocco_player .jp-stop').delay(150).fadeOut(400,'easeOutQuart');
   $('#blocco_player .jp-previous').delay(100).fadeOut(400,'easeOutQuart');
   $('#blocco_player .jp-next').delay(50).fadeOut(400,'easeOutQuart');
   $('#blocco_player').delay(250).fadeOut(400,'easeOutQuart');
   $('#dope').delay(50).fadeOut(400,'easeOutQuart');
   $('#blocco_webdesign').delay(900).fadeOut(400,'easeOutQuart');
   

   
   $('#blocco_sound').unbind('mouseenter');
   $('#blocco_sound').unbind('mouseleave');
   $('#blocco_software').unbind('mouseenter');
   $('#blocco_software').unbind('mouseleave');
   $('#blocco_webdesign').unbind('mouseenter');
   $('#blocco_webdesign').unbind('mouseleave');
   $('#blocco_identity').unbind('mouseenter');
   $('#blocco_identity').unbind('mouseleave');
   $('#main .fondo_small').fadeTo(300,0,'easeOutQuart');
   $('.fondo_big').fadeTo(300,0,'easeOutQuart');
   $('.fondo_long').fadeTo(300,0,'easeOutQuart');
  	
}

function muovi_testo(e){
	mouse_x = e.pageX;
	mouse_y = e.pageY;
	
	if(mouse_y>$('#blocco_step_testo .text_container').offset().top && mouse_y<$('#blocco_step_testo .text_container').offset().top+$('#blocco_step_testo .text_container').height() && mouse_x>$('#blocco_step_testo .text_container').offset().left && mouse_x<$('#blocco_step_testo .text_container').offset().left+$('#blocco_step_testo').width()){
	
		
	
		$('#blocco_step_testo .text_container div').stop().animate({
        
        marginTop:_pos-((_altezza-164)/164)*(mouse_y-1-$('#blocco_step_testo .text_container').offset().top)
    }, 800, 'easeOutQuart');
		
	} else if(mouse_y>$('#blocco_step_testo .text_container').offset().top+$('#blocco_step_testo .text_container').height() && mouse_x>$('#blocco_step_testo .text_container').offset().left && mouse_x<$('#blocco_step_testo .text_container').offset().left+$('#blocco_step_testo').width()){
		$('#blocco_step_testo .text_container div').stop().animate({
	        
	        marginTop:_pos-_altezza+164
	    }, 800, 'easeOutQuart');
	}else if(mouse_y<$('#blocco_step_testo .text_container').offset().top && mouse_x>$('#blocco_step_testo .text_container').offset().left && mouse_x<$('#blocco_step_testo .text_container').offset().left+$('#blocco_step_testo').width()){
	
		$('#blocco_step_testo .text_container div ').stop().animate({
	        
	        marginTop:_pos
	    }, 800, 'easeOutQuart');
	} else if(mouse_x<$('#blocco_step_testo .text_container').offset().left || mouse_x>$('#blocco_step_testo .text_container').offset().left+$('#blocco_step_testo').width()){
		$('#blocco_step_testo .text_container div').stop().animate({
	        
	        marginTop:_pos
	    }, 800, 'easeOutQuart');
	}
}

