Wannier functions analysis of the nonlinear Schroedingerequation with a periodic potential