$(document).ready(function(){var $window=$(window);var $firstBG=$('#header');var $thirdBG=$('#chi_siamo');var $contact=$('#contact');var visual=$("#test");var $fourthBG=$('#fourth');var think=$("#fourth .bg");var $fifthBG=$('#fifth');var build=$("#fifth .bg");var $sixhBG=$('#six');var $sevenhBG=$('#seven');var trainers=$("#six .bg");var windowHeight=$window.height();$('#header,#third, #fourth, #fifth, #six, #seven').bind('inview',function(event,visible){if(visible==true){$(this).addClass("inview");}else{$(this).removeClass("inview");}});function RepositionNav(){var windowHeight=$window.height();var navHeight=$('#nav').height()/2;var windowCenter=(windowHeight/2);var newtop=windowCenter-navHeight;$('#nav').css({"top":newtop});}
function newPos(x,windowHeight,pos,adjuster,inertia){return x+"% "+(-((windowHeight+pos)-adjuster)*inertia)+"px";}
function Move(){var pos=$window.scrollTop();if($firstBG.hasClass("inview")){$contact.css({'bottom':'-550px'});}
if($thirdBG.hasClass("inview")){$contact.css({'bottom':'-500px'});}
if($fourthBG.hasClass("inview")){$contact.css({'bottom':'0px'});$fourthBG.css({'backgroundPosition':newPos(50,windowHeight,pos,2500,0.6)});think.css({'backgroundPosition':newPos(60,windowHeight,pos,2900,0.9)});}
if($fifthBG.hasClass("inview")){$contact.css({'bottom':'0px'});$fifthBG.css({'backgroundPosition':newPos(50,windowHeight,pos,6450,0.6)});build.css({'backgroundPosition':newPos(60,windowHeight,pos,6450,0.9)});}
if($sixhBG.hasClass("inview")){$contact.css({'bottom':'0px'});$sixhBG.css({'backgroundPosition':newPos(50,windowHeight,pos,9100,0.6)});trainers.css({'backgroundPosition':newPos(60,windowHeight,pos,9500,0.9)});}
if($sevenhBG.hasClass("inview")){$contact.css({'bottom':'85px'});}
$('#pixels').html(pos);}
RepositionNav();$window.resize(function(){Move();RepositionNav();});$window.bind('scroll',function(){Move();});});
