A Generalization of the Hopf Invariant