Invariant manifold theory for impulsive functional differential equations with applications