Omnidirectional bandgaps and selective transmission in layered photonic crystals