Temperature and spatial dependence of the magnetization near a surface of a ferromagnet