function calcParallax(tileheight, speedratio, scrollposition) {
  //    by Brett Taylor http://inner.geek.nz/
  //    originally published at http://inner.geek.nz/javascript/parallax/
  //    usable under terms of CC-BY 3.0 licence
  //    http://creativecommons.org/licenses/by/3.0/
  return ((tileheight) - (Math.floor(scrollposition / speedratio) % (tileheight+1)));
}

window.onload = function() {

  window.onscroll = function() {
    var posX = (document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : window.pageXOffset;
    var posY = (document.documentElement.scrollTop) ? document.documentElement.scrollTop : window.pageYOffset;
	
    var landschap = document.getElementById('landschap');
    var landschapparallax = calcParallax(180, 12, posY);
    landschap.style.backgroundPosition = "0 " + landschapparallax + "px"; 
	
    var boom1 = document.getElementById('boom1');
    var boom1parallax = calcParallax(810, 2.5, posY);
    boom1.style.backgroundPosition = "0 " + boom1parallax + "px"; 
	
    var boom2 = document.getElementById('boom2');
    var boom2parallax = calcParallax(750, 2.7, posY);
    boom2.style.backgroundPosition = "0 " + boom2parallax + "px"; 

    var wolken1 = document.getElementById('wolken1');
    var wolken1parallax = calcParallax(1316, 30, posY);
    wolken1.style.backgroundPosition = "0 " + wolken1parallax + "px"; 
	
    var wolken2 = document.getElementById('wolken2');
    var wolken2parallax = calcParallax(992, 12, posY);
    wolken2.style.backgroundPosition = "0 " + wolken2parallax + "px";
	
    var iwit = document.getElementById('iwit');
    var iwitparallax = calcParallax(800, 6, posY);
    iwit.style.backgroundPosition = "0 " + iwitparallax + "px";
  }
}