 
 eob_controllers = angular.module 'eob.controllers', []
 
-DROP_DELAY = 0
 BERLIN_POS = new google.maps.LatLng 52.5170423, 13.4018519
 MOBILE_BP = 760
 MENU_BP = 600

    mc = null
    markers = []

    addMarkersFrom = (index) ->
        index = 0 if index is null

        if index >= 0 and index < $scope.places.length
            place = $scope.places[index]
            eob_imgCache.load(_.pick(MARKER_ICONS, place.foodtype)).then ->
                image =
                    url: MARKER_ICONS[place.foodtype].url
                    size: new google.maps.Size(70, 85)
                    scaledSize: new google.maps.Size(70, 85)

                marker = new google.maps.Marker
                    position: new google.maps.LatLng place.lat, place.lng
                    map: map
                    title: place.name
                    icon: image
                    animation: google.maps.Animation.DROP

                markers.push marker
                google.maps.event.addListener marker, "click", ->
                    $scope.openPlace place.slug
                    return

                setTimeout _.partial(addMarkersFrom, index + 1), DROP_DELAY
                return
        else if index is $scope.places.length
            $scope.findMe false
            mc = new MarkerClusterer(map, markers, mcOptions)
            mc.setCalculator (markers, styles) ->


    # do something only the first time the map is loaded
    google.maps.event.addListenerOnce map, 'tilesloaded', ->
        eob_data.placesPromise.then addMarkersToMap

    return

