Just curious, but this is not doing it for you under expressions?
" double DynamicParent (object parent1, object parent2, object child, double position, double damping )
Return Value: 1.0 for success, 0.0 for failure
Causes child to act as though it is parented to one of it’s two parents. If the position is 0.0 then the child behaves as though it is parented to parent1. If the position is 1.0 then it behaves as though it is parented to parent2. If the value is anywhere in between then it behaves as though it is parented to both; the parent with the position closes to it exerts the greater influence. This function controls both translation and orientation, it does not control scale.
Note: For more information about DynamicParent see the tutorials section."
And there is something called multiparent that you can use with up to 4 parents. If you use with a slider, it becomes very easy to turn it on and off.
k
