A variational principle for a fluid with a free surface