check if overlays exist before executing javascript on them

this prevents javascript errors
use overlay_size on some more controller actions