           launchDfd.reject o, err, message
 
       launchDfd.promise()
+
+  NMIS.launchLeaflet = do ->
+    launchDfd = $.Deferred()
+
+    scriptsStarted = false
+    scriptsFinished = false
+    mapElem = undefined
+    opts = undefined
+    context = {}
+    loadingMessageElement = false
+    defaultOpts =
+      elem: "#map"
+      centroid:
+        lat: 0.000068698255561324
+        lng: 0.000083908685869343
+
+      llImgPath: "/static/leaflet/images/"
+      tileUrl: "http://b.tiles.mapbox.com/modilabs/"
+      layers: [["Nigeria", "nigeria_base"]]
+      overlays: []
+      defaultLayer: "google"
+      layerSwitcher: true
+      loadingElem: false
+      loadingMessage: "Please be patient while this map loads..."
+      zoom: 6
+      maxExtent: [-20037500, -20037500, 20037500, 20037500]
+      restrictedExtent: [-4783.9396188051, 463514.13943762, 1707405.4936624, 1625356.9691642]
+
+    scriptsAreLoaded = ->
+      ifDefined = (str) ->
+        if str is "" or str is `undefined`
+          `undefined`
+        else
+          str
+      loadingMessageElement.hide()  unless not loadingMessageElement
+      OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3
+      OpenLayers.ImgPath = opts.olImgPath
+      ob = opts.maxExtent
+      re = opts.restrictedExtent
+      options =
+        projection: new OpenLayers.Projection("EPSG:900913")
+        displayProjection: new OpenLayers.Projection("EPSG:4326")
+        units: "m"
+        maxResolution: 156543.0339
+        restrictedExtent: new OpenLayers.Bounds(re[0], re[1], re[2], re[3])
+        maxExtent: new OpenLayers.Bounds(ob[0], ob[1], ob[2], ob[3])
+
+      mapId = mapElem.get(0).id
+      mapserver = opts.tileUrl
+      mapLayerArray = []
+      context.mapLayers = {}
+      $.each opts.overlays, (k, ldata) ->
+        ml = new OpenLayers.Layer.TMS(ldata[0], [mapserver],
+          layername: ldata[1]
+          type: "png"
+          transparent: "true"
+          isBaseLayer: false
+        )
+        mapLayerArray.push ml
+        context.mapLayers[ldata[1]] = ml
+
+      $.each opts.layers, (k, ldata) ->
+        ml = new OpenLayers.Layer.TMS(ldata[0], [mapserver],
+          layername: ldata[1]
+          type: "png"
+        )
+        mapLayerArray.push ml
+        context.mapLayers[ldata[1]] = ml
+
+      context.waxLayerDict = {}
+      context.activeWax
+      mapId = mapElem.get(0).id = "-openlayers-map-elem"  unless mapId
+      context.map = new OpenLayers.Map(mapId, options)
+      window.__map = context.map
+      googleSat = new OpenLayers.Layer.Google("Google",
+        type: "satellite"
+      )
+      googleMap = new OpenLayers.Layer.Google("Roads",
+        type: "roadmap"
+      )
+      mapLayerArray.push googleSat, googleMap
+      context.map.addLayers mapLayerArray
+      context.map.setBaseLayer googleSat  if opts.defaultLayer is "google"
+      context.map.addControl new OpenLayers.Control.LayerSwitcher()  if opts.layerSwitcher
+      scriptsFinished = true
+
+    # the launch function is returned
+    launch = (_opts) ->
+      opts = $.extend({}, defaultOpts, _opts)  if opts is `undefined`
+      mapElem = $(opts.elem)  if mapElem is `undefined`
+      loadingMessageElement = $(opts.loadingElem).text(opts.loadingMessage).show()  if !!opts.loadingElem and !!opts.loadingMessage
+      unless scriptsStarted
+        scriptsStarted = true
+        gmLoad = NMIS.loadGoogleMaps()
+        gmLoad.done (gmaps)->
+          olLoad = NMIS.loadOpenLayers()
+          olLoad.done (ol)->
+            scriptsAreLoaded()
+            launchDfd.resolve()
+
+          olLoad.fail (o, err, message)->
+            launchDfd.reject o, err, message
+
+        gmLoad.fail (o, err, message)->
+          launchDfd.reject o, err, message
+
+      launchDfd.promise()
+
 # begin c_variables.coffee
 do ->
   variablesById = {}

      $elem = $(eselector).css width: 680, height: 476, position: 'absolute'
      launcher = NMIS.loadOpenLayers()
      launcher.done ()->
        OpenLayers._getScriptLocation = ()-> NMIS.settings.openLayersRoot        
        $(".map-loading-message").hide()
        elem = $elem.get(0)
        mapId = "nmis-ol-country-map"

    all: all
    validate: validate
    clear: clear

# begin c_launch_open_layers.coffee
do ->
  NMIS.loadGoogleMaps = do ->
