                 success: =>
                     @details_view.render()
             if opts.draw_marker
+                opts.select_unit = true
                 unit_list = new models.UnitList [unit]
                 @parent.draw_units unit_list, opts
 

            $target = $(ev.currentTarget)
            @parent.show_search_result @model
            @collection_view.hide()

    class SearchResultsView extends SMCollectionView
        tagName: 'ul'

                @map_markers().addLayer marker
                marker.unit = unit
                unit.marker = marker
                @listenTo marker, 'click', @select_marker
                marker.on 'mouseover', (event) ->
                    event.target.openPopup()

        select_marker: (event) ->
            marker = event.target
            @service_sidebar.show_details marker.unit
            @highlight_selected_marker marker

        highlight_selected_marker: (marker) ->
            @details_marker?.closePopup()
            popup = marker.getPopup()
            popup.setLatLng marker.getLatLng()
            popup.addTo @get_map()
            $(@details_marker?._popup._wrapper).removeClass 'selected'
            @details_marker = marker
            $(@details_marker?._popup._wrapper).addClass 'selected'

        draw_units: (unit_list, opts) ->
            unit_list.each (unit) =>
                @draw_unit unit
            if opts?
                if opts.zoom
                    @refit_bounds()
                if opts.select_unit
                    console.log unit_list.first()
                    @highlight_selected_marker unit_list.first().marker

        refit_bounds: ->
            map = @get_map()
