Theory of radiative shocks in optically thick media