
var background_width = 2560;
var scrollback=false;
var offset = 0;


function scrollBackground() {

   if(offset<-(background_width-$(document).width())) { // prototype: document.viewport.getWidth()
      scrollback=true;
     
   }
   
   if(offset>=0) {
      scrollback=false;
   }
   
   offset=(scrollback) ? offset+7 : offset-7;
   
   document.getElementById("bg_overlay").style.backgroundPosition=offset + 'px 50%';

}

var bgInterval=setInterval(function() {
   scrollBackground();
   }, 200
);

