Fixed ajax-reloading of maps.
Improved layer control code.