$(document).ready(function() {



	
// SMOOTH SCROLLING
  $('a[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
    && location.hostname == this.hostname) {
      var $target = $(this.hash);
      $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
      if ($target.length) {
        var targetOffset = $target.offset().top;
        $('html,body').animate({scrollTop: targetOffset}, 2000);
        return false;
      }
    }
  });
	
//ADJUST SLIDE HEIGHT TO WINDOW HEIGHT
  // var windowHeight = $(window).height();
  // if(windowHeight < 600) {
  //   $("#wrapper section.slide").css('min-height', "600px");
  // }  else {
  //  $("#wrapper section.slide").css('min-height',((windowHeight - 150) + "px"));  
  // };
	
	$(window).scroll(function() {
		var offset = window.pageYOffset;

 // INTRO 
  	$('#first header').css({
  		"top" : (0+(offset/20))+"%"
  	});
  	
  	$('#firstImg').css({
  		"top" : 0 + (offset/1.5)
  	});
  	





  	

  	
	$('#secondImg').css({
  		"top" : -700 + (offset/1.5)
  	});

  	$('#cube11').css({
  	  "top" : 5 + (offset/8.1)
  	});
  	$('#cube124').css({
    	  "top" : -107 + (offset/4.7)
    	});
  	$('#cube137').css({
    	  "top" : -232 + (offset/3.30)
    	});
  	
  	$('#cube168').css({
  	  "top" : -379 + (offset/2.61)
  	});
  	
  	$('#cube19').css({
    	  "top" : -543 + (offset/2.15)
    	});
  	
  	$('#cube2mid').css({
  	  "top" : -660 + (offset/1.18)
  	});
  	
  	$('#cube2mid2').css({
    	  "top" : -784 + (offset/1.3),
    	  "left" : 0 + (offset*0.5)
    	});
  	
  	$('#cube2mid7').css({
  	  "top" : -928 + (offset/1),
  	  "right" : 0 + (offset*1.3)
  	});
  	
	$('#cube23').css({
	  	  "top" : -1070 + (offset/1)
	  	});
  	
	$('#cube29').css({
	  	  "top" : -1229 + (offset*1.9)
	  	});
	
	$('#cube31').css({
	  	  "top" : -1412 + (offset*1.4)
	  	});
	$('#cube32').css({
	  	  "top" : -1619 + (offset*1.8),
	  	  "left": 0 + (offset*2)
	  	  
	  	});
	
	$('#cube39').css({
	  	  "top" : -1841 + (offset*3)
	  
	  	  
	  	});
	
	
	$('#ipad').css({
		 "top" : -980 + (offset/1.9)
	  
	  	  
	  	});
	
	
	$('#iphone').css({
		 "top" : -1620 + (offset/1.3)
	  
	  	  
	  	});
	
	$('#rayrice').css({
		 "top" : -1760 + (offset/1.5)
	  
	  	  
	  	});
	

	
	
	
	
  	






  	$('#third section').css({
  		"top" : (-82+(offset/25))+"%"
  	});

  	$('#thirdImg').css({
  		"top" : -1400 + (offset/1.5)
  	});
  	
  	$('#fb_bird').css({
  		"left" : -1100 + (offset/1.3),
  		"top" : -1600 + (offset/1.2)
  		

  	});
  	$('#twitbird').css({
  		"left" : -1100 + (offset/1.4),
  		"top" : -1700 + (offset/1.2)
  	});
  	$('#bluequote').css({
  		"top" : -2100 + (offset/1.28)
  		
  	});






	});
	
	$("a.hkarmy").click(function () {
		
		$(".hkarmyimg").animate({height: "1842px"},2000);
	
	});
	
	$("a.sunrise").click(function () {
		
		$(".sunriseimg").animate({height: "1161px"},2000);
	
	});
	
	$("a.keymob").click(function () {
		
		$(".keyesimg").animate({height: "895px"},2000);
	
	});
	

	$("a.sunroad").click(function () {
		
		$(".sunroadimg").animate({height: "1600px"},2000);
	
	});
	
	$("a.perf").click(function () {
	
		$(".perfimg").animate({height: "881px"},2000);
	
	});
	
	$("a.skemp").click(function () {

		$(".skempimg").animate({height: "556px"},2000);
	
	});
	
	$("a.pbf").click(function () {

		$(".pbfimg").animate({height: "971px"},2000);
	
	});
	
	$("a.rr").click(function () {

		$(".rrimg").animate({height: "1577px"},2000);
	
	});
	
	$("a.maz").click(function () {

		$(".mazimg").animate({height: "928px"},2000);
	
	});
	
	$("a.rl").click(function () {

		$(".rlimg").animate({height: "1245px"},2000);
	
	});
	
	$("a.mck").click(function () {

		$(".mckimg").animate({height: "733px"},2000);
	
	});
	
	$("a.sage").click(function () {

		$(".sageimg").animate({height: "903px"},2000);
	
	});
	
	$("a.fersf").click(function () {

		$(".fersfimg").animate({height: "697px"},2000);
	
	});
	
	$("a.lp").click(function () {

		$(".lpimg").animate({height: "973px"},2000);
	
	});
	
	$("a.annullo").click(function () {

		$(".annulloimg").animate({height: "1617px"},2000);
	
	});
	$("img.open").click(function () {
		$(this).parent().animate({height: "0px"},200);
	});
		

	

	
	  
});





