The spinorial energy functional on surfaces