//Written by Matthew White
//wizardlore.com

//works in IE

bgXs=0;
bgYs=0;
bgWIDTH=40;
bgHEIGHT=40;

function scrollBGX(dist) {
	//bgX=window.document.body.style.backgroundPosition;
	//bgX=bgX.substring(0,bgX.indexOf("p")); 
	
	bgXs=bgXs+dist;
	
	if (dist>0){
	if (bgXs>=bgWIDTH-dist){
		bgXs=bgXs-bgWIDTH;
	}
	}else{
	if (bgXs<=-bgWIDTH+dist){
		bgXs=bgXs+bgWIDTH;
		
	}
	}
	
	
	window.document.body.style.backgroundPosition=bgXs+"px "+bgYs+"px";
	//alert(window.document.body.style.backgroundPosition);
	//self.status=""+ bgX;
	
}
function scrollBGY(dist) {
	//bgY=window.document.body.style.backgroundPosition; 
	//bgY=bgY.substring(bgY.indexOf("px ")+3, bgY.length - 2); 
	
	bgYs=bgYs+dist;
	
	if (dist>0){
	if (bgYs>=bgHEIGHT-dist){
		bgYs=bgYs-bgHEIGHT;
	}
	}else{
	if (bgYs<=-bgHEIGHT+dist){
		bgYs=bgYs+bgHEIGHT;
	}
	}
	
	
	window.document.body.style.backgroundPosition=bgXs+"px "+bgYs+"px";

	//self.status=""+ bgY;
	
}

function scrollBg(distX, distY, IGwidth, IGheight) {
	//if (navigator.appName.indexOf("Internet Explorer")>-1){
		bgWIDTH=IGwidth;
		bgHEIGHT=IGheight;
		scrollBGX(distX);
		scrollBGY(distY); 
		//self.status=""+document.body.style.backgroundPosition+", "+bgWIDTH+", "+bgHEIGHT;
		setTimeout("scrollBg("+distX+","+distY+","+IGwidth+","+IGheight+")",50);
	//}
	
}



//javascript:scrollBg(1,1,10,15);


