Infrared Emission from Interstellar Dust. I. Stochastic Heating of Small Grains