function Scroll2Pos(cID)
{
var obj = document.getElementById(cID);
var curtop = 0;
if (obj.offsetParent)
{
do
{
curtop += obj.offsetTop;
}
while (obj = obj.offsetParent);
window.scrollTo(0, curtop);
}
}
It is based on this.
JavaScript - Find position