Cobalt and magnesium ferrite nanoparticles: preparation using liquid foams as templates and their magnetic characteristics.