

//id:nombre del div
//maxx: ancho del bitmap
//maxy: alto del bitmap
//tim: velocidad (milisegundos entre pasos)
function animFondo(id,maxx,maxy,tim){
	this.id=document.getElementById(id);
	this.maxx=maxx;
	this.maxy=maxy;
	this.x=0;
	this.y=0;

	var ref = this; 

	function animFondoStep(){
		ref.id.style.backgroundPosition=" " + ref.x + "px " + ref.y + "px";
		ref.x=ref.x+1;
		ref.y=ref.y+1;
		if (ref.x==ref.maxx) ref.x=0;
		if (ref.y==ref.maxy) ref.y=0;
	}

	window.setInterval(animFondoStep,tim);

}

function animFondoBody(maxx,maxy,tim){
	this.id=document.body;
	this.maxx=maxx;
	this.maxy=maxy;
	this.x=0;
	this.y=0;

	var ref = this; 

	function animFondoStep(){
		ref.id.style.backgroundPosition=" " + ref.x + "px " + ref.y + "px";
		ref.x=ref.x+1;
		ref.y=ref.y+1;
		if (ref.x==ref.maxx) ref.x=0;
		if (ref.y==ref.maxy) ref.y=0;
	}

	window.setInterval(animFondoStep,tim);
}