var maxScroll = 1100;

window.onscroll = function(){
	var vp = vpHeight();
	var sp = scrollPos();
	
	var lo = vp + sp;
	//alert(lo);
	if(lo >= maxScroll && document.body.style.backgroundAttachment != 'fixed'){
		document.body.style.backgroundPosition = '0px ' + (vp-maxScroll) + 'px';
		document.body.style.backgroundAttachment = 'fixed';
	} else if(lo < maxScroll && document.body.style.backgroundAttachment == 'fixed') {
		document.body.style.backgroundPosition = '0px 0px';
		document.body.style.backgroundAttachment = 'scroll';
	}
}

function scrollPos(){
  return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
}

function vpHeight(){
  return window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
}
