// JavaScript Document
var cloudsscrollSpeed = 35;       // Speed in milliseconds
var cloudsstep = 1;               // How many pixels to move per step
var cloudscurrent = 0;            // The current pixel row
var cloudsimageWidth = 800;     // Background image height
var cloudsheaderWidth = 1700;     // How tall the header is.

//The pixel row where to start a new loop


function cloudsscrollBg(){
var scrollTop = $(window).scrollTop();
//alert(scrollTop);

if((scrollTop < 2347) && (scrollTop > 955)) {
	var cloudsrestartPosition = -(cloudsimageWidth - cloudsheaderWidth);   
    //Go to next pixel row.
    cloudscurrent += cloudsstep;
//	alert(current);
   
    //If at the end of the image, then go to the top.
	
    if (cloudscurrent > (cloudsheaderWidth)){

        cloudscurrent = 0-cloudsimageWidth;
    }
   
    //Set the CSS of the header.
    $(elementId).css("background-position",cloudscurrent+"px" + " 0");
   
   
}
}
//Calls the scrolling function repeatedly
var cloudsinit = setInterval("cloudsscrollBg(elementId = '#cloudshome', cloudsstep = 1, cloudscrollSpeed = 35, cloudsiamgeWidth=800, cloudsheaderWidth=1700)", cloudsscrollSpeed);


