Ermakov Hamiltonian systems in nonlinear optics of elliptic Gaussian beams