jQuery(document).ready(function($) {
	a=parseFloat(200);// valor inccial para el background 1
	b=parseFloat(0);// valor inccial para el background 1
	c=parseFloat(300);// valor inccial para el background 2
	d=parseFloat(0);// valor inccial para el background 2
	e=parseFloat(300);// valor inccial para el background 3
	f=parseFloat(0);// valor inccial para el background 3
	g=parseFloat(0);// valor inccial para el background 4
	h=parseFloat(0);// valor inccial para el background 5
	k=parseFloat(0);// valor inccial para el background 6
	i=parseFloat(400);// valor inccial para el background 7
	j=parseFloat(0);// valor inccial para el background 7
	l=parseFloat(200);// valor inccial para el background 7
	m=parseFloat(200);// valor inccial para el background 7
	var scrollTop = $(window).scrollTop();			
	var scroll_actually= new Array();// identifica los valoares del background X y  Y
		
	$(window).scroll(function(){//this is not the cleanest way to do this, I'm just keeping it short.
		if(scrollTop>$(this).scrollTop()) // desplazamiento hacia arriba
		{
			if (getScrollTop()<=1600 && getScrollTop()>=0)// identyifica cuando la posicion del background_1 esta en scroll
			{
					a=a-10;// posicion del background1 decrementa en 35 pixeles
					//b=b+10;// posicion de background1 decrementa en 15 pizeles 
					$('.img_1').css('backgroundPosition', '55% '+a+'px');
					$('.bk_0').css('backgroundPosition', '0 '+b+'px');		
			}
			if (getScrollTop()>=1600 && getScrollTop()<=3200)
			{
					c=c+5;// posicion del background2 decrementa en 35 pixeles
					l=l-5;
					//d=d+10;// posicion del background2 decrementa en 35 pixeles
					$('.img_11').css('backgroundPosition', '55% '+l+'px');
					$('.img_2').css('backgroundPosition', '90% '+c+'px');
					$('.bk_1').css('backgroundPosition', '0 '+d+'px');							
			}
			if (getScrollTop()>=3200 && getScrollTop()<=4800)
			{
					e=e+10;// posicion del background2 decrementa en 35 pixeles
					m=m-10;
					//f=f+10;// posicion del background2 decrementa en 35 pixeles
					$('.img_22').css('backgroundPosition', '55% '+m+'px');
					$('.img_3').css('backgroundPosition', '90% '+e+'px');
					$('.bk_2').css('backgroundPosition', '0 '+f+'px');							
			}
			if (getScrollTop()>=4800 && getScrollTop()<=6400)
			{
					g=g+0;// posicion del background2 decrementa en 35 pixeles
					$('.bk_3').css('backgroundPosition', '0 '+g+'px');							
			}
			if (getScrollTop()>=6400 && getScrollTop()<=8000)
			{
					h=h+0;// posicion del background2 decrementa en 35 pixeles
					$('.bk_4').css('backgroundPosition', '0 '+h+'px');							
			}
			if (getScrollTop()>=8000 && getScrollTop()<=9600)
			{
					k=k+0;// posicion del background2 decrementa en 35 pixeles
					$('.bk_5').css('backgroundPosition', '0 '+k+'px');							
			}
			if (getScrollTop()>=9600 && getScrollTop()<=11200)
			{
					i=i+10;// posicion del background2 decrementa en 35 pixeles
					//j=j+10;// posicion del background2 decrementa en 35 pixeles
					$('.img_7').css('backgroundPosition', '50% '+i+'px');
					$('.bk_6').css('backgroundPosition', '0 '+j+'px');							
			}
		}
		else
		{// desplazamiento hacia  abajo
			if (getScrollTop()>=0 && getScrollTop()<=1600)			
			{
				  a=a+10;// posicion del background1 incrementa en 35 pixeles	  
				  //b=b-10;// posicion del background1 incrementa en 35 pixeles
				  $('.img_1').css('backgroundPosition', '55% '+a+'px');
				  $('.bk_0').css('backgroundPosition', '0 '+b+'px');				
		    }
			if (getScrollTop()>=1600 && getScrollTop()<=3200)			
			{
				  c=c-5;// posicion del background1 incrementa en 35 pixeles
				  l=l+5;
				  //d=d-10;// posicion del background1 incrementa en 35 pixeles
				  $('.img_11').css('backgroundPosition', '55% '+l+'px');
				  $('.img_2').css('backgroundPosition', '90% '+c+'px');
				  $('.bk_1').css('backgroundPosition', '0 '+d+'px');		  				
		    }
			if (getScrollTop()>=3200 && getScrollTop()<=4800)			
			{
				  e=e-10;// posicion del background1 incrementa en 35 pixeles
				  m=m+10;
				  //f=f-10;// posicion del background1 incrementa en 35 pixeles
				  $('.img_22').css('backgroundPosition', '55% '+m+'px');
				  $('.img_3').css('backgroundPosition', '90% '+e+'px');
				  $('.bk_2').css('backgroundPosition', '0 '+f+'px');		  				
		    }
			if (getScrollTop()>=4800 && getScrollTop()<=6400)			
			{
				  g=g-0;// posicion del background1 incrementa en 35 pixeles
				  $('.bk_3').css('backgroundPosition', '0 '+g+'px');		  				
		    }
			if (getScrollTop()>=6400 && getScrollTop()<=8000)			
			{
				  h=h-0;// posicion del background1 incrementa en 35 pixeles
				  $('.bk_4').css('backgroundPosition', '0 '+h+'px');		  				
		    }
			if (getScrollTop()>=8000 && getScrollTop()<=9600)			
			{
				  k=k-0;// posicion del background1 incrementa en 35 pixeles
				  $('.bk_5').css('backgroundPosition', '0 '+k+'px');		  				
		    }
			if (getScrollTop()>=9600 && getScrollTop()<=11200)			
			{
				  i=i-10;// posicion del background1 incrementa en 35 pixeles
				  //j=j-10;// posicion del background1 incrementa en 35 pixeles
				  $('.img_7').css('backgroundPosition', '50% '+i+'px');
				  $('.bk_6').css('backgroundPosition', '0 '+j+'px');		  				
		    }
	 	}
		if (getScrollTop()==0)// ajusta la posiciones y las reseatea en cero cuando hace scroll havciaa arriba
		{
			a=parseFloat(200);
			b=parseFloat(0);
			c=parseFloat(300);
			d=parseFloat(0);
			e=parseFloat(300);
			f=parseFloat(0);
			g=parseFloat(0);
			h=parseFloat(0);
			k=parseFloat(0);
			i=parseFloat(400);
			j=parseFloat(0);
			l=parseFloat(200);
			m=parseFloat(200);
			$('.bk_0').css('backgroundPosition', '0 0');	
			$('.bk_1').css('backgroundPosition', '0 0');
			$('.bk_2').css('backgroundPosition', '0 0');
			$('.bk_3').css('backgroundPosition', '0 0');
			$('.bk_4').css('backgroundPosition', '0 0');
			$('.bk_5').css('backgroundPosition', '0 0');
			$('.bk_6').css('backgroundPosition', '0 0');
			$('.img_11').css('backgroundPosition', '55% '+200+'px');
			$('.img_22').css('backgroundPosition', '55% '+200+'px');
			$('.img_7').css('backgroundPosition', '50% '+400+'px');
			$('.img_3').css('backgroundPosition', '90% '+300+'px');	
   		    $('.img_2').css('backgroundPosition', '90% '+300+'px');			
   		    $('.img_1').css('backgroundPosition', '55% '+200+'px');						
		}
	  scrollTop = $(this).scrollTop();		
	});
});
function getScrollTop(){ ///  verifica el calculo total en pixeles de toda la pagina

    if(typeof pageYOffset!= 'undefined'){
        //most browsers
        return pageYOffset;
    }
    else{
        var B= document.body; //IE 'quirks'
        var D= document.documentElement; //IE with doctype
        D= (D.clientHeight)? D: B;
        return D.scrollTop;
    }
}

