Hamilton-Jacobi equations and weak KAM theory