Cohomologies of the Lie algebra of formal vector fields with coefficients in its adjoint space and variations of characteristic classes of foliations