The supernova-regulated ISM - II. The mean magnetic field