function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function initCabezon() {
	pos=findPos(document.getElementById('contenedor'));
	cabeza.style.top=topInicial+'px';
	if(navigator.userAgent.indexOf('MSIE')>'0') {
		cabeza.style.left=(pos[0]+21)+'px';
	} else {
		cabeza.style.left=(pos[0]+13)+'px';
	}
}

function mover(futura) {
	intervalMethod = function() { desplaza(futura); }
	window.clearInterval(zInterval);
	zInterval = window.setInterval(intervalMethod,10);
}

function desplaza(futura) {
	step=2;
	actual=parseInt(cabeza.style.top);
	if ((actual+step)<futura) {
		cabeza.style.top=(actual+step)+'px';
	} else if ((actual-step)>futura) {
		cabeza.style.top=(actual-step)+'px';
	} else {
		cabeza.style.top = futura + "px";
		window.clearInterval(zInterval);
		zInterval = null;
	}	
}

function restaurar() {
	intervalMethod = function() { desplaza(topInicial); }
	window.clearInterval(zInterval);
	zInterval = window.setInterval(intervalMethod,10);
}