Possible Duplicate:
How to call fromLatLngToDivPixel in Google Maps API V3?
aPoint=map.fromLatLngToDivPixel(labelA.getPoint());
bPoint=map.fromLatLngToDivPixel(labelB.getPoint()); 
I've tried the Overlay approach, but failed, as I need to get the variables back to the function:
function LabelLatLongSort(a,b)
{
    labelA = eval("label_"+a.deviceId);
    labelB = eval("label_"+b.deviceId);
    longOffset = eval("offsetOverlapWith_"+a.customId);
    overlay = new google.maps.OverlayView();
    overlay.draw = function() {};
    overlay.setMap(map);
    google.maps.event.addListenerOnce(map, 'idle', function() {
     aPoint=overlay.getProjection().fromLatLngToDivPixel(labelA.getPoint()); 
     bPoint=overlay.getProjection().fromLatLngToDivPixel(labelB.getPoint());
    });             
     diffLat = bPoint.y-aPoint.y;
     diffLong = aPoint.x-bPoint.x; 
    if (Math.abs(diffLong)>longOffset) return diffLong;
    if (diffLat==0)
    {
        return b.deviceId-a.deviceId;
    }
    return diffLat;
}
 
     
     
     
    