var centerLatlng = new L.LatLng(center.lat, center.lng);
var map;
var defaultZoom = 8;
function initialize() {
    map = new L.Map('map_canvas');
    // todo: change cloudmade api key i.e. /398a...81/ to a modilabs one
    var cloudmadeTileLayer = new L.TileLayer('http://{s}.tile.cloudmade.com/398a8a41acd34d688dde441c60edfd81/997/256/{z}/{x}/{y}.png', {
        attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>',
        maxZoom: 18
    });
    map.setView(centerLatlng, defaultZoom).addLayer(cloudmadeTileLayer);
    var latLngArray = new Array();
    for (var i=0; i<points.length; i=i+1) {
        // use a self executing function to create a new scope in each
        // iteration of the loop.
        latLngArray.push((function(){
            // create a marker on the map for this point
            var point = new L.LatLng(points[i].lat, points[i].lng);
            var marker = new L.Marker(point);
            var instance = points[i].instance;

            // todo: remove hard coded url
            var url = "/odk_viewer/survey/" + instance.toString() + "/";
            // bind open popup to marker's click event
            marker.on('click', function(evt){
                var targetMarker = evt.target;
                // open a loading popup so the user knows something is happening
                targetMarker.bindPopup('Loading...').openPopup();
                $.get(url).done(function(data){
                    targetMarker.bindPopup(data).openPopup();
                });
            });

            map.addLayer(marker);
            return point;
        })());
    }
    // fitting to bounds with one point will zoom too far
    if (latLngArray.length > 1) {
        var latlngbounds = new L.LatLngBounds(latLngArray);
        map.fitBounds(latlngbounds);
   }
}

@@ -143,81 +143,8 @@
 ');%0A
-    // todo: change cloudmade api key i.e. /398a...81/ to a modilabs one%0A
     
@@ -219,40 +219,40 @@
 com/
-398a8a41acd34d688dde441c60edfd81
+b1e5699de0e74928959c89bf0f777a5b
 /997
@@ -988,16 +988,22 @@
 = new L.
+Circle
 Marker(p
@@ -1006,16 +1006,62 @@
 er(point
+, %7B%0A                'radius': 8 %0A            %7D
 );%0A     
@@ -1122,12 +1122,12 @@
  // 
-todo
+TODO
 : re
@@ -1219,16 +1219,159 @@
  + %22/%22;%0A
+            // open a loading popup so the user knows something is happening%0A            //a = marker.bindPopup('Loading...');//.openPopup();%0A%0A
         
@@ -1458,18 +1458,16 @@
 nction(e
-vt
 )%7B%0A     
@@ -1501,10 +1501,8 @@
  = e
-vt
 .tar
@@ -1526,72 +1526,125 @@
     
-// open a loading popup so the user knows something is happeni
+var popup = new L.Popup(%7B%0A                    'maxWidth': 500,%0A                %7D);%0A                latlng = e.latl
 ng
+;
 %0A   
@@ -1660,55 +1660,63 @@
     
-targetMarker.bindPopup('Loading...').openPopup(
+latlng.lat += 1;%0A                popup.setLatLng(latlng
 );%0A 
@@ -1786,36 +1786,55 @@
     
-targetMarker.bindPopup(data)
+popup.setContent(data);%0A                    map
 .ope
@@ -1840,16 +1840,21 @@
 enPopup(
+popup
 );%0A     

use modilab api key; use circles over markers; load popups differently; still need better fix for position popups