(a) In all cases of voluntary separation of husband and wife, the circuit court has power, on the motion of either party, 20 days' notice thereof being given to the other, to permit either the father or mother to have the custody and control of the children and to superintend and direct their education, having regard to the prudence, ability, and fitness of the parents, and the age and sex of the children.
(b) Upon the hearing of the motion, witnesses may be examined orally or testimony may be taken as in other civil actions. While the application is pending, the court may direct an injunction or make any order that the safety and well-being of the wife or children may require.