A Variational Formulation for Love Waves in a Layered Anelastic Solid