Variational Formulation of Charged Curves Confined to a Sphere