// JavaScript Document
var scrollSpeed = 50;       // Speed in milliseconds
var step = 1;               // How many pixels to move per step
var current = 0;            // The current pixel row
var imageWidth = 780;     // Background image height
var headerWidth = 1600;     // How tall the header is.

//The pixel row where to start a new loop
var restartPosition = -(imageWidth - headerWidth);

function scrollBg(){
   var scrollTop = $(window).scrollTop();
//alert(scrollTop);

if((scrollTop < 955) && (scrollTop > 550)) {
    //Go to next pixel row.
    current += step;
//	alert(current);
   
    //If at the end of the image, then go to the top.
	
    if (current > (headerWidth)){

        current = 0;
    }
   
    //Set the CSS of the header.
    $('#midblimp').css("background-position",current+"px"+" 0");
   
   
}
}
//Calls the scrolling function repeatedly
var init = setInterval("scrollBg()", scrollSpeed);
