the HTML code:

Code:
<ul id="ul1"> <li>1111</li> <li>2222</li> </ul> <div id="div1"></div>
the javascript code:
Code:
var oDiv=document.getElementById('div1');
oDiv.style.left=getPos(this).left+this.offsetWidth+'px';
oDiv.style.top=getPos(this).top+'px';
function getPos(obj){
var aPos={left: null, top: null};

while(obj)
{
aPos.left+=obj.offsetLeft;
aPos.top+=obj.offsetTop;
obj=obj.offsetParent;
}

return aPos;
}
what getPos function do? why it write the while loop,and what's effection of the while loop

the above code does a tooptip function