 		log "setupMap()"
 		if map?
 			log "map already initialized"
+			limitToBounds()
 		else if not L?
 			log "javascript not yet loaded"
 		else

			window.map = L.mapbox.map('OpenStreetMap', 'nlthijs48.4153ad9d', {center: [52.249822176849, 6.8396973609924], zoom: 13, zoomControl:false, updateWhenIdle:false, detectRetina:true})
			layer = L.mapbox.tileLayer('nlthijs48.4153ad9d', {reuseTiles: true})
			log "Initialized MapBox map"

# Setup map bounds
limitToBounds = ->

			if bounds? and loc1? and loc2?
				map._layersMinZoom = map.getBoundsZoom(bounds.pad(0.05))
				map.setMaxBounds(bounds.pad(0.05))
				limit = () -> 
					map._layersMinZoom = map.getBoundsZoom(bounds.pad(0.05))
					map.setMaxBounds(bounds.pad(0.05))
				window.setTimeout(limit, 100)
				#map.fitBounds(bounds); # Causes problems, because it zooms to max all the time
			else
				log "Bounds not existing"
