function getElementObject (elementId) {
	if (document.all)
		return document.all[elementId];
	else if (document.getElementById)
		return document.getElementById(elementId);
	else
		return null;
};

function getPageCoords (element) {
	var coords = { x: 0, y: 0};
	var element = getElementObject(element)
	
	while (element) {
		coords.x += element.offsetLeft;
		coords.y += element.offsetTop;
		element = element.offsetParent;
	}
	
	return coords;
};

function slide(id, direction, distance) {
	var coords = getPageCoords(id);
	
	distance -= 5;
	
	switch(direction) {
		case 'down':
			getElementObject(id).style.top = coords.y + 5;
			break;
			
		case 'up':
			getElementObject(id).style.top = coords.y - 5;
			break;
	}
	
	if(distance > 0) {
		window.setTimeout( function() { slide(id, direction, distance); },25);
	}
};