Was Margaret romantically interested in Ted?
Early in the film he gets the impression that she encouraged Joanna to leave. Maybe he was just so upset that he started reading into everything, I dunno.
Later on though, they're sitting in the park (just before Billy falls) and I believe they're discussing her relationship situation. I almost get the impression by that point in Ted's transformation from father to daddy that she'd love to have someone like him. Maybe not him specifically but if the opportunity presented itself I doubt she'd turn it down.
Ultimately it ends up seeming like she takes his side in the custody hearing, as opposed to staying neutral. She looks humiliated that private conversations she'd had with Joanna about old Ted behind his back are now being brought up publicly to make him look bad.
I dunno why but I've always been curious what sorta unspoken feelings they might have toward one another. Are they just opposites who got caught up in similar situations and have grown to respect each other, or are they just trying to make the best if a something difficult.