//<!--
var speed=5

function movedown(capa,contenedor){
	capa = $(capa);
	altura = (capa.offsetHeight - $(contenedor).offsetHeight) * -1
	
	if(parseInt(capa.style.top) > altura)
		capa.style.top=parseInt(capa.style.top)-speed+"px"
	else
		capa.style.top=altura+"px"
	destino = "movedown('"+capa.id+"','"+contenedor+"')";
	movedownvar=setTimeout(destino,20);
}

function moveup(capa){
	capa = $(capa);
	if(parseInt(capa.style.top) < 0 )
		capa.style.top=parseInt(capa.style.top)+speed+"px"
	else
		capa.style.top="0px";
	destino = "moveup('"+capa.id+"')";
	moveupvar=setTimeout(destino,20)
}

function moveleft(capa){
	capa = $(capa);
	if(parseInt(capa.style.left) < 0 )
		capa.style.left=parseInt(capa.style.left)+speed+"px"
	else
		capa.style.left="0px";
	destino = "moveleft('"+capa.id+"')";
	moveleftvar=setTimeout(destino,20)
}

function moveright(capa,contenedor){
	capa = $(capa);
	anchura = (capa.offsetWidth - $(contenedor).offsetWidth) * -1
	
	if(parseInt(capa.style.left) > anchura)
		capa.style.left=parseInt(capa.style.left)-speed+"px"
	else
		capa.style.left=anchura+"px"
	destino = "moveright('"+capa.id+"','"+contenedor+"')";
	moverightvar=setTimeout(destino,20);
}
//-->
