  We discuss the behavior of solitary wave solutions of the nonlinear
Schr{\"o}dinger equation (NLSE) as they interact with complex potentials, using
a four parameter variational approximation based on a dissipation functional
formulation of the dynamics. We concentrate on spatially periodic potentials
with the periods of the real and imaginary part being either the same or
different. Our results for the time evolution of the collective coordinates of
our variational ansatz are in good agreement with direct numerical simulation
of the NLSE. We compare our method with a collective coordinate approach of
Kominis and give examples where the two methods give qualitatively different
answers. In our variational approach, we are able to give analytic results for
the small oscillation frequency of the solitary wave oscillating parameters
which agree with the numerical solution of the collective coordinate equations.
We also verify that instabilities set in when the slope of $dp(t)/dv(t)$
becomes negative when plotted parametrically as a function of time, where
$p(t)$ is the momentum of the solitary wave and $v(t)$ the velocity.
