$(window).ready(function() {
  	$("#top-logo").animate({"top": '425'}, 900, "swing");  
  	$("#top-birds_foreground").animate({"top": '290'}, 1500, "swing");
  	$('#menu ul li a.nav').mouseenter(function() {
   	 	$(this).parent().find('div.roll').fadeIn(400);
 	 	}).mouseout(function(){
    	$(this).parent().find('div.roll').fadeOut(100);
  	});
  	if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
		
		$('#content-container').css('top', 850);
	}
});


$(window).scroll(function() {

if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
		$('#content-container').css('top', 850);
}else{

		$("#top-logo").stop();
 	 	$("#top-birds_foreground").stop();
 	 	var bgTargY =  $(window).scrollTop()*0.5;
  		if ($(window).scrollTop() < 800){
 			$('#top-container').css('top', -bgTargY);
  			//$("#top-container").stop();
  			//$("#top-container").animate({"top": -bgTargY}, "fast",  "linear");
  	
 			$('#top-jpg').css('background-position', '50% '+ bgTargY+ 'px'); 
 			//$("#top-jpg").stop();
  			//$("#top-jpg").animate({"background-position":  '50% '+  bgTargY + 'px'}, "fast",  "linear"); 	
  		
 	 		$('#contact-top').css('top', 180 + bgTargY);
 	 
 	 		var logoTargY =  $(window).scrollTop()/0.95;  
  			$('#top-logo').css('top', 425 - logoTargY);
  			//$("#top-logo").stop();
  			//$("#top-logo").animate({"top": "425" - logoTargY}, 500,  "swing");
  
 	 		var birdTargY =  $(window).scrollTop()/2;  
  			$('#top-birds_foreground').css('top', 290 - birdTargY);
  			//$("#top-birds_foreground").stop();
  			//$("#top-birds_foreground").animate({"top": "290" - birdTargY}, 700, "swing");
  		}else{
  			$('#top-logo').css('top', -300);
  			$('#top-birds_foreground').css('top', -300);
  			$('#top-container').css('top', -800);  	
 			$('#top-jpg').css('background-position', 'center -700px');
 			$('#contact-top').css('top', 800);
  		}
  		$('#content-container').css('background-position', '50% '+ (300-bgTargY)/3+ 'px'); 
  		$('#roster-content-container').css('background-position', '50% '+ (bgTargY)/0.8+ 'px');
  		$('#rocket').css('background-position', '0% '+ (800-bgTargY)/2+ 'px');


  
  }
  
  if ( ($(window).scrollTop() >= 0) && ($(window).scrollTop() < 500)){
  	$("a#link1").addClass("active");
  	$("a#link2").removeClass("active");
  	$("a#link3").removeClass("active");
  }else if ( ($(window).scrollTop() > 500) && ($(window).scrollTop() < ($(document).height()- $(window).height()-500))){
  	$("a#link1").removeClass("active");
  	$("a#link2").addClass("active");
  	$("a#link3").removeClass("active");
  }else{
  	$("a#link1").removeClass("active");
  	$("a#link2").removeClass("active");
  	$("a#link3").addClass("active");
  }
});




