Variational approach to the Jahn-Teller problem in cobaltocene