// JavaScript Document
var sharksscrollSpeed = 13;       // Speed in milliseconds
var sharksstep = 1;               // How many pixels to move per step
var sharkscurrent = 0;            // The current pixel row
var sharksimageWidth = 203;     // Background image height
var sharksheaderWidth = 2000;     // How tall the header is.

//The pixel row where to start a new loop 


function sharksscrollBg(){
var scrollTop = $(window).scrollTop();
//alert(scrollTop);

if((scrollTop < 2347) && (scrollTop > 955)) {
	var sharksrestartPosition = -(sharksimageWidth - sharksheaderWidth);   
    //Go to next pixel row.
    sharkscurrent += sharksstep;
//	alert(current);
   
    //If at the end of the image, then go to the top.
	
    if (sharkscurrent > (sharksheaderWidth)){

        sharkscurrent = 0-sharksimageWidth;
    }
   
    //Set the CSS of the header.
    $(elementId).css("background-position",sharkscurrent+"px" + " 0");
   
   
}
}
//Calls the scrolling function repeatedly
var sharksinit = setInterval("sharksscrollBg(elementId = '#sharkhome', sharksstep = 1, sharkscrollSpeed = 13, sharksiamgeWidth=203, sharksheaderWidth=2000 )", sharksscrollSpeed);


