Antireflective coatings with adjustable refractive index and porosity synthesized by micelle-templated deposition of MgF2 sol particles.