Liapunov-Razumikhin functions and an invariance principle for functional differential equations