*FindtheXpositionofanobject,relativetotheviewport
*Codecopiedfromquirksmode.org
*@paramobjObjecttofindxpositionfor
*/
functionfindPosX(obj)
{
varcurleft=0;
if(obj.offsetParent)
{
while(obj.offsetParent)
{
curleft+=obj.offsetLeft
obj=obj.offsetParent;
}
}
elseif(obj.x)
curleft+=obj.x;
returncurleft;
}
/**
*FindtheYpositionofanobject,relativetotheviewport
*Codecopiedfromquirksmode.org
*@paramobjObjecttofindypositionfor
*/
functionfindPosY(obj)
{
varcurtop=0;
if(obj.offsetParent)
{
while(obj.offsetParent)
{
curtop+=obj.offsetTop
obj=obj.offsetParent;
}
}
elseif(obj.y)
curtop+=obj.y;
returncurtop;
}