i have a problem with this code when working in IE
it gives me 0,0 coords when i use iframe tag but gives correct coords when using firefox

Code:
function GetRealOffset(id)
{
	
	var elem = document.getElementById(id);
	var leftOffset = elem.offsetLeft;
	var topOffset = elem.offsetTop;
	var parent = elem.offsetParent;
	
        while(parent != document.body) 
	{
             leftOffset += parent.offsetLeft;
	     topOffset += parent.offsetTop;
            parent = parent.offsetParent;
	}
        var Offsets = new Object();
	Offsets.top = topOffset;
	Offsets.left = leftOffset;
	
        alert(Offsets.top + " " +Offsets.left)
	return Offsets;
}
i use the iframe tag to display advertisements in them and need the coords of iframe tag for IE
im new to javascript and dont know much bout this
plz help me with this
thx in advance