  During the epoch of reionization a large number of photons were produced with
frequencies below the hydrogen Lyman limit. After redshifting into the closest
resonance, these photons underwent multiple scatterings with atoms. We examine
the effect of these scatterings on the temperature of the neutral intergalactic
medium (IGM). Continuum photons, emitted between the Ly_alpha and Ly_gamma
frequencies, heat the gas after being redshifted into the H Ly_alpha or D
Ly_beta resonance. By contrast, photons emitted between the Ly_gamma and
Ly-limit frequencies, produce effective cooling of the gas. Prior to
reionization, the equilibrium temperature of ~100 K for hydrogen and helium
atoms is set by these two competing processes. At the same time, Ly_beta
resonance photons thermally decouple deuterium from other species, raising its
temperature as high as 10^4 K. Our results have important consequences for the
cosmic 21-cm background and the entropy floor of the early IGM which can affect
star formation and reionization.
