Statistical thermodynamics of polymer layers