function getPositionTop(node) { var top = node.offsetTop; var parent = node.offsetParent; while(parent != null) { top += parent.offsetTop; parent = parent.offsetParent; } return top; };