var t = null;
var v = 1;

function paraCima()
{
	var margem = document.getElementById('margem');
	var texto = document.getElementById('texto');
	
	var mHeight = (margem.offsetHeight) ? margem.offsetHeight : margem.style.pixelHeight;
	var tHeight = (texto.offsetHeight) ? texto.offsetHeight : texto.style.pixelHeight;
	var tTop = 0;
	
	if (texto.style.pixelTop) tTop = texto.style.pixelTop;
	else {
		tTop = texto.style.top.replace(/px,*\)*/g,"");
		if (!tTop) tTop = 0;
	}
	
	if((parseInt(tTop) + tHeight) > mHeight)
	{
		if (texto.style.pixelTop) texto.style.pixelTop -= 2;
		else texto.style.top = (parseInt(tTop) - 2) + 'px';
		t = setTimeout("paraCima();", v);
	}
}

function paraBaixo()
{
	var texto = document.getElementById('texto');
	var tTop;
	
	if (texto.style.pixelTop) tTop = texto.style.pixelTop;
	else tTop = texto.style.top.replace(/px,*\)*/g,"");
	
	if(parseInt(tTop) < 0)
	{
		if (texto.style.pixelTop) texto.style.pixelTop += 2;
		else texto.style.top = (parseInt(tTop) + 2) + 'px';
		t = setTimeout("paraBaixo();", v);
	}
}

function pausa()
{
	clearTimeout(t);
}
