A better way to get the topleft of the Virtual Earth Control

johnWeeGo.jpgFor some reason the built in gettop and getleft methods from Virtual earth don’t work consistantly across all interfaces. Try this more generic function instead.


function SetMapOffsets(obj) {
	if (obj.offsetParent) {
		mapleft = obj.offsetLeft
		maptop = obj.offsetTop
		while (obj = obj.offsetParent) {
			mapleft += obj.offsetLeft
			maptop += obj.offsetTop
		}
	}
}