Ken Bolton avatar Ken Bolton committed 6f23c92

Update to Google Maps API v3.

Comments (0)

Files changed (2)

reploc/templates/reploc/locator.html

 {% block title %}Representative Locator{% endblock %}
 
 {% block extra_head %}
-<script src="http://maps.google.com/maps?file=api&amp;v=3&amp;key={{ GOOGLE_MAPS_KEY }}&amp;sensor=true" type="text/javascript"></script>
+<script src="http://maps.googleapis.com/maps/api/js?key={{ GOOGLE_MAPS_KEY }}&amp;sensor=true" type="text/javascript"></script>
 <script type="text/javascript">
 {# this is a template because it uses some Django tags #}
 {% include 'reploc/locator.js' %}
 <div id="location-matches"></div>
 <div style="clear:both"></div>
 
-<div id="representative-map" style="width: 690px; height: 500px; margin-top: 20px;"></div>
+<div id="representative-map" style="width: 690px; height: 500px; margin-top:
+    20px;">This page requires a modern browser which supports Google Maps!</div>
 <h3 id="directions-title"></h3>
 <div id="location-directions"></div>
 {% endblock %}

reploc/templates/reploc/locator.js

 //<![CDATA[
-var map, circle, circleRadius, centerMarker, origin, geocoder, reploc;
+var map, circle, circleRadius, centerMarker, origin, geocoder;
 var markers = [];
 var blurbs = [];
 var titles = [];
 
 // Things to do when the page is fully loaded
 $(document).ready(function () {
-  // Make it easy to access page elements
-  dirTitle = $('#directions-title');
-  dpJQ = $('#location-directions');
-  ajax = $('#ajax-progress');
-  refAdd = $('#reference-address');
-  refRad = $('#reference-radius');
-  btnFind = $('#find-locations');
-  btnReset = $('#reset-locations');
-  locMatch = $('#location-matches');
-  csrf_token = $('[name=csrfmiddlewaretoken]');
 
-  // for some reason, pulling this back with jQuery doesn't work with the API
-  directionsPanel = document.getElementById("location-directions");
 
-  // make sure the browser can handle Google Maps
-  if (google.maps.BrowserIsCompatible()) {
-    // set up Google Maps
+    var siberia = new google.maps.LatLng(60, 105);
+    // Make it easy to access page elements
+    dirTitle = $('#directions-title');
+    dpJQ = $('#location-directions');
+    ajax = $('#ajax-progress');
+    refAdd = $('#reference-address');
+    refRad = $('#reference-radius');
+    btnFind = $('#find-locations');
+    btnReset = $('#reset-locations');
+    locMatch = $('#location-matches');
+    csrf_token = $('[name=csrfmiddlewaretoken]');
+
+    directionsPanel = document.getElementById("location-directions");
+
     var myOptions = {
-      zoom: 4,
-      //center: myLatlng,
-      //mapTypeId: google.maps.MapTypeId.ROADMAP
+        zoom: 4,
+        center: new google.maps.LatLng(39.232253,-95.273437), // USA-centric, right in the heartland
+        mapTypeId: google.maps.MapTypeId.ROADMAP
     }
-    origin = new google.maps.LatLng(39.232253,-95.273437);
     map = new google.maps.Map(document.getElementById("representative-map"), myOptions);
-    map.setCenter(origin, 4);
-    map.addControl(new google.maps.SmallMapControl());
-    map.addControl(new google.maps.MapTypeControl());
-    //map.enableScrollWheelZoom();
 
-    {% if REPLOC_USE_JS %}geocoder = new google.maps.ClientGeocoder();{% endif %}
+    {% if REPLOC_USE_JS %}geocoder = new google.maps.Geocoder();{% endif %}
 
-    // for getting driving directions
-    directions = new google.maps.Directions(map, directionsPanel);
+    directions = new google.maps.DirectionsService(map, directionsPanel);
 
-    // put markers on the map for all locations in the database
-    reploc.showAllLocations();
+    showAllLocations();
 
-    // Setup some event listeners
     refAdd.keypress(function (e) {
-      // If the user hits enter in the address box, simulate clicking
-      // the "search" button
-      if (e.which == 13) { reploc.findLocationsInRadius(); return false; }
+        if (e.which == 13) { findLocationsInRadius(); return false; }
     });
-    btnFind.click(reploc.findLocationsInRadius);
-    btnReset.click(reploc.resetMap);
-  } else {
-    alert('This page requires a modern browser which supports Google Maps!');
-  }
+    btnFind.click(findLocationsInRadius);
+    btnReset.click(resetMap);
 
+    // Try W3C Geolocation (Preferred)
+    if(navigator.geolocation) {
+        browserSupportFlag = true;
+        navigator.geolocation.getCurrentPosition(function(position) {
+            myOptions.center = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
+            map.setCenter(myOptions.center);
+            map.setZoom(myOptions.zoom);
+        }, function() {
+            handleNoGeolocation(browserSupportFlag);
+        });
+        // Browser doesn't support Geolocation
+    } else {
+        browserSupportFlag = false;
+        handleNoGeolocation(browserSupportFlag);
+    }
+
+    function handleNoGeolocation(errorFlag) {
+        if (errorFlag == true) {
+            alert("Geolocation service failed.");
+        } else {
+            alert("Your browser doesn't support geolocation. We've placed you in Siberia.");
+            myOptions.center = siberia;
+        }
+        map.setCenter(myOptions.center);
+    }
+
+    function createMarker (point, number, loc) {
+        // Add a marker overlay to the map and store various bits of info about it
+        var marker = new google.maps.Marker({position: point, title: loc.representative});
+        marker.value = number;
+
+        // The only time we shouldn't have a representative is when it's the address
+        // entered by the user
+        if (loc.representative) {
+            // Setup the blurb for the marker's info box
+            var myHtml = '<h3 class="representative">' + loc.representative + '</h3>';
+            myHtml += '<div>' + loc.street1 + '</div>';
+            myHtml += '<div>' + loc.street2 + '</div>';
+            myHtml += '<div>' + loc.city + ', ';
+            myHtml += loc.state + ' ' + loc.postal_code + '</div>';
+
+            // Only show the telephone number if it's available
+            if (loc.telephone.length) {
+                myHtml += '<div><strong>Tel.</strong>: ' + loc.telephone + '</div>';
+            }
+
+            // Only show the fax number if it's available
+            if (loc.fax.length) {
+                myHtml += '<div><strong>Fax</strong>: ' + loc.fax + '</div>';
+            }
+
+            // Only show the website if it's available
+            if (loc.website.length) {
+                myHtml += '<div><strong>WWW</strong>: ' + loc.website + '</div>';
+            }
+
+            // Only show the email if it's available
+            if (loc.email.length) {
+                myHtml += '<div><strong>E-mail</strong>: ' + loc.email + '</div>';
+            }
+
+            // Add a listener to pop up an info box when the mouse goes over a marker
+            google.maps.event.addDomListener(marker, "mouseover", function() {
+                new google.maps.InfoWindow({
+                    position: point,
+                    content: myHtml
+                }).open(map);
+            });
+
+            // Keep track of the marker's data
+            titles.push(loc.representative);
+            markers.push(marker);
+            blurbs.push(myHtml);
+        }
+
+        return marker;
+    };
+
+    function showAllLocations () {
+        // Pull back all locations from the database and make markers for each one
+        $.ajax({
+            url : '{% url reploc-locations %}',
+            type : 'POST',
+            dataType : 'json',
+            success : function (json) {
+                for (var l = 0; l < json.locations.length; l++) {
+                    var loc = json.locations[l];
+                    var point = new google.maps.LatLng(loc.lat, loc.lng);
+                    createMarker(point, l, loc).setMap(map);
+                    //map.addOverlay(createMarker(point, l, loc));
+                }
+            }
+        });
+    };
+
+    function findLocationsInRadius () {
+        // Search all of the markers we have for points that are within the chosen
+        // radius from the address entered by the user
+        ajax.fadeIn('fast');
+
+        // reset some elements
+        dirTitle.text('');
+        directionsPanel.innerHTML = '';
+        //directions.clear();
+        //map.closeInfoWindow();
+
+        locMatch.slideUp('fast');
+        maxDist = parseInt(refRad.val());
+
+        {% if REPLOC_USE_JS %}
+            geocoder.geocode({
+                address: refAdd.val()
+            },
+            function (point, status) {
+                // Bail out if there was a problem on the server
+                if (!point) { alert('Please enter a valid address'); ajax.fadeOut(); return; }
+
+                if (centerMarker) {
+                    centerMarker.setMap(null);
+                }
+
+                map.setCenter(point[0].geometry.location);
+                map.setZoom(myOptions.zoom);
+                if (centerMarker == null){
+                    centerMarker = new google.maps.Marker({
+                        map: map,
+                    });
+                }
+                centerMarker.setPosition(point[0].geometry.location);
+                doDrawCircle(centerMarker);
+
+                // Only show markers that are within the specified radius
+                var op = centerMarker.getPosition();
+                var lat1 = op.lat();
+                var lng1 = op.lng();
+                var matches = [];
+
+                // iterate over all markers to find the distance from the specified address
+                for (var l = 0; l < markers.length; l++) {
+                    var m = markers[l];
+                    var mp = m.getPosition();
+                    var lat2 = mp.lat();
+                    var lng2 = mp.lng();
+
+                    // Compute the distance between the input address and the marker
+                    var dist = 0;
+                    with (Math) {
+                        // Source: http://www.meridianworlddata.com/Distance-Calculation.asp
+                        dist = 3963.189 * acos(sin(lat1 / C) * sin(lat2 / C) + cos(lat1 / C) * cos(lat2 / C) * cos(lng2 / C - lng1 / C));
+                    }
+                    m.setMap(null);
+
+                    if (dist <= maxDist) {
+                        m.setMap(map);
+                        matches.push(m);
+                    }
+                }
+
+                filterLocations(matches);
+            }
+                            );
+                            {% else %}
+                                $.ajax({
+                                    url : '{% url reploc-find-locations %}',
+                                    type : 'POST',
+                                    data : {'csrfmiddlewaretoken': csrf_token.val(),
+                                        'address': refAdd.val(),
+                                        'radius' : refRad.val()},
+                                        dataType : 'json',
+                                        error : function (xhr, status, err) {
+                                            alert(err);
+                                        },
+                                        success : function (json) {
+                                            // Bail out if there was a problem on the server
+                                            if (json.error) { alert(json.error); ajax.fadeOut(); return; }
+
+                                            if (centerMarker) {
+                                                map.removeOverlay(centerMarker);
+                                            }
+
+                                            var matches = [];
+                                            var point = new google.maps.LatLng(json.center.lat, json.center.lng);
+                                            centerMarker = createMarker(point, 10000, json.center);
+                                            map.addOverlay(centerMarker);
+                                            doDrawCircle();
+
+                                            // now run over all markers to find markers with the same lat/lng
+                                            for (var l = 0; l < markers.length; l++) {
+                                                var m = markers[l];
+                                                var mp = m.getPosition();
+                                                var lat = mp.lat;
+                                                var lng = mp.lng;
+
+                                                //m.hide();
+                                                m.setMap(map);
+
+                                                with (Math) {
+                                                    for (var z = 0; z < json.locations.length; z++) {
+                                                        var loc = json.locations[z];
+                                                        if (loc.lat.toFixed(5) == lat.toFixed(5) &&
+                                                            loc.lng.toFixed(5) == lng.toFixed(5)) {
+                                                            m.show();
+                                                        matches.push(m);
+                                                        }
+                                                    }
+                                                }
+                                            }
+                                            filterLocations(matches);
+                                        }
+                                });
+                                {% endif %}
+    };
+
+    function resetMap () {
+        // Reset the map and overlays
+        ajax.fadeIn();
+        map.setZoom(4);
+        map.panTo(origin);
+        locMatch.slideUp('slow', function () { $(this).html(''); });
+        map.removeOverlay(circle);
+        map.removeOverlay(centerMarker);
+        map.closeInfoWindow();
+        for (var m = 0; m < markers.length; m++) {
+            var mkr = markers[m];
+            if (mkr.isHidden()) { mkr.show(); }
+        }
+        dirTitle.text('');
+        directionsPanel.innerHTML = '';
+        //directions.clear();
+        ajax.fadeOut();
+    };
+
+    // Source: http://maps.forum.nu/gm_sensitive_circle2.html
+    function doDrawCircle (centerMarker) {
+        if (circle) {
+            circle.setMap(null);
+        }
+        var center = centerMarker.getPosition();
+        centerMarker.setMap(map);
+        circleRadius = parseInt(refRad.val()) * 1609.344;
+        circle = new google.maps.Circle({center: center, fillColor: '#051b2d',
+                                        fillOpacity: 0.3, strokeColor: '#7688a0',
+                                        strokeWeight: 2, strokeOpacity: 1, map: map,
+                                        radius: circleRadius})
+                                        var bounds = circle.getBounds();
+                                        myOptions.zoom = 14;
+                                        map.panTo(centerMarker.getPosition());
+                                        map.fitBounds(bounds);
+    };
+
+    function filterLocations (matches) {
+        // now list each of the matches
+        var html = '<h4>Locations Found Within ' + maxDist + ' Miles of ' + refAdd.val() + '</h4>';
+        if (matches.length <= 0) {
+            html += '<p>No locations are within the area specified.</p>';
+        } else {
+            for (var m = 0; m < matches.length; m++) {
+                marker = matches[m];
+                html += '<div class="representative-location" id="dl' + marker.value + '">';
+                html += blurbs[marker.value];
+                html += '<div><a href="#representative-map" id="dda' + marker.value + '" class="get-directions">Driving directions</a></div>';
+                html += '</div>';
+            }
+        }
+        locMatch.html(html);
+
+        // add a listener for when the user clicks on a match
+        var locs = $('div.representative-location');
+        locs.click(function () {
+            document.location = '#representative-map';
+            ajax.fadeIn();
+
+            // Get the marker's value
+            var num = parseInt($(this).attr('id').replace('dl', ''));
+            marker = markers[num];
+            map.setZoom(14);
+
+            // show an info box for the marker
+            infoBox = new google.maps.InfoWindow({
+                content: blurbs[num],
+                maps: map
+            })
+            //map.openInfoWindowHtml(marker.getPosition(), blurbs[num]);
+            map.panTo(marker.getPosition());
+
+            // keep the chosen match highlighted
+            $(this).siblings().removeClass('active');
+            $(this).addClass('active');
+
+            ajax.fadeOut();
+        });
+
+        locMatch.slideDown();
+
+        // add an event handler for when the user wants to get driving directions
+        var drvDirs = $('a.get-directions').click(function () {
+            ajax.fadeIn();
+            var directionsRenderer = new google.maps.DirectionsRenderer();
+            directionsRenderer.setMap(map);
+            directionsRenderer.setPanel(directionsPanel);
+
+            directionsPanel.innerHTML = '';
+
+            // Get the marker's value
+            var num = parseInt($(this).attr('id').replace('dda', ''));
+            marker = markers[num];
+            var request = {
+                origin: centerMarker.getPosition(),
+                destination: marker.getPosition(),
+                unitSystem: google.maps.DirectionsUnitSystem.IMPERIAL,
+                travelMode: google.maps.TravelMode.DRIVING
+            };
+            directions.route(request, function(response, status) {
+                if (status == google.maps.DirectionsStatus.OK) {
+                    directionsRenderer.setDirections(response);
+                } else {
+                    alert('Error: ' + status);
+                };
+            });
+            dirTitle.text('Driving Directions to ' + titles[num]);
+
+            ajax.fadeOut();
+        });
+
+        // make all matches the same height, both for aesthetics and CSS sanity
+        var maxHeight = 0;
+        $.each(locs, function () {
+            var h = $(this).height();
+            if (h > maxHeight) { maxHeight = h; }
+        });
+        locs.height(maxHeight);
+
+        ajax.fadeOut('slow');
+    };
 
 });
+
 $(document).unload(google.maps.Unload);
 
 
-reploc = {
-
-  createMarker: function(point, number, loc) {
-    // Add a marker overlay to the map and store various bits of info about it
-    var marker = new google.maps.Marker(point);
-    marker.value = number;
-
-    // The only time we shouldn't have a representative is when it's the address
-    // entered by the user
-    if (loc.representative) {
-      // Setup the blurb for the marker's info box
-      var myHtml = '<h3 class="representative">' + loc.representative + '</h3>';
-      myHtml += '<div>' + loc.street1 + '</div>';
-      myHtml += '<div>' + loc.street2 + '</div>';
-      myHtml += '<div>' + loc.city + ', ';
-      myHtml += loc.state + ' ' + loc.postal_code + '</div>';
-
-      // Only show the telephone number if it's available
-      if (loc.telephone.length) {
-        myHtml += '<div><strong>Tel.</strong>: ' + loc.telephone + '</div>';
-      }
-
-      // Only show the fax number if it's available
-      if (loc.fax.length) {
-        myHtml += '<div><strong>Fax</strong>: ' + loc.fax + '</div>';
-      }
-
-      // Only show the website if it's available
-      if (loc.website.length) {
-        myHtml += '<div><strong>WWW</strong>: ' + loc.website + '</div>';
-      }
-
-      // Only show the email if it's available
-      if (loc.email.length) {
-        myHtml += '<div><strong>E-mail</strong>: ' + loc.email + '</div>';
-      }
-
-      // Add a listener to pop up an info box when the mouse goes over a marker
-      google.maps.Event.addListener(marker, "mouseover", function() {
-        map.openInfoWindowHtml(point, myHtml);
-      });
-
-      // Keep track of the marker's data
-      titles.push(loc.representative);
-      markers.push(marker);
-      blurbs.push(myHtml);
-    }
-
-    return marker;
-  },
-
-  showAllLocations: function() {
-    // Pull back all locations from the database and make markers for each one
-    $.ajax({
-      url : '{% url reploc-locations %}',
-      type : 'POST',
-      dataType : 'json',
-      success : function (json) {
-        for (var l = 0; l < json.locations.length; l++) {
-          var loc = json.locations[l];
-          var point = new google.maps.LatLng(loc.lat, loc.lng);
-          map.addOverlay(reploc.createMarker(point, l, loc));
-        }
-      }
-    });
-  },
-
-  findLocationsInRadius: function() {
-    // Search all of the markers we have for points that are within the chosen
-    // radius from the address entered by the user
-    ajax.fadeIn('fast');
-
-    // reset some elements
-    dirTitle.text('');
-    directionsPanel.innerHTML = '';
-    directions.clear();
-    map.closeInfoWindow();
-
-    locMatch.slideUp('fast');
-    maxDist = parseInt(refRad.val());
-
-    {% if REPLOC_USE_JS %}
-      geocoder.getLatLng(
-        refAdd.val(),
-      function (point) {
-        // Bail out if there was a problem on the server
-        if (!point) { alert('Please enter a valid address'); ajax.fadeOut(); return; }
-
-        if (centerMarker) {
-          map.removeOverlay(centerMarker);
-        }
-
-        centerMarker = reploc.createMarker(point, 10000, {address : refAdd.val()});
-        map.addOverlay(centerMarker);
-        reploc.doDrawCircle();
-
-        // Only show markers that are within the specified radius
-        var op = centerMarker.getLatLng();
-        var lat1 = op.lat();
-        var lng1 = op.lng();
-        var matches = [];
-
-        // iterate over all markers to find the distance from the specified address
-        for (var l = 0; l < markers.length; l++) {
-          var m = markers[l];
-          var mp = m.getLatLng();
-          var lat2 = mp.lat();
-          var lng2 = mp.lng();
-
-          // Compute the distance between the input address and the marker
-          var dist = 0;
-          with (Math) {
-            // Source: http://www.meridianworlddata.com/Distance-Calculation.asp
-            dist = 3963.189 * acos(sin(lat1 / C) * sin(lat2 / C) + cos(lat1 / C) * cos(lat2 / C) * cos(lng2 / C - lng1 / C));
-          }
-          m.hide();
-
-          if (dist <= maxDist) {
-            m.show();
-            matches.push(m);
-          }
-        }
-
-        reploc.filterLocations(matches);
-      }
-      );
-      {% else %}
-        $.ajax({
-          url : '{% url reploc-find-locations %}',
-          type : 'POST',
-          data : {'csrfmiddlewaretoken': csrf_token.val(),
-            'address': refAdd.val(),
-            'radius' : refRad.val()},
-            dataType : 'json',
-            error : function (xhr, status, err) {
-              alert(err);
-            },
-            success : function (json) {
-              // Bail out if there was a problem on the server
-              if (json.error) { alert(json.error); ajax.fadeOut(); return; }
-
-              if (centerMarker) {
-                map.removeOverlay(centerMarker);
-              }
-
-              var matches = [];
-              var point = new google.maps.LatLng(json.center.lat, json.center.lng);
-              centerMarker = reploc.createMarker(point, 10000, json.center);
-              map.addOverlay(centerMarker);
-              reploc.doDrawCircle();
-
-              // now run over all markers to find markers with the same lat/lng
-              for (var l = 0; l < markers.length; l++) {
-                var m = markers[l];
-                var mp = m.getLatLng();
-                var lat = mp.lat();
-                var lng = mp.lng();
-
-                m.hide();
-
-                with (Math) {
-                  for (var z = 0; z < json.locations.length; z++) {
-                    var loc = json.locations[z];
-                    if (loc.lat.toFixed(5) == lat.toFixed(5) &&
-                        loc.lng.toFixed(5) == lng.toFixed(5)) {
-                      m.show();
-                    matches.push(m);
-                    }
-                  }
-                }
-              }
-              reploc.filterLocations(matches);
-            }
-        });
-        {% endif %}
-  },
-
-  resetMap: function() {
-    // Reset the map and overlays
-    ajax.fadeIn();
-    map.setZoom(4);
-    map.panTo(origin);
-    locMatch.slideUp('slow', function () { $(this).html(''); });
-    map.removeOverlay(circle);
-    map.removeOverlay(centerMarker);
-    map.closeInfoWindow();
-    for (var m = 0; m < markers.length; m++) {
-      var mkr = markers[m];
-      if (mkr.isHidden()) { mkr.show(); }
-    }
-    dirTitle.text('');
-    directionsPanel.innerHTML = '';
-    directions.clear();
-    ajax.fadeOut();
-  },
-
-  // Source: http://maps.forum.nu/gm_sensitive_circle2.html
-  doDrawCircle: function() {
-    if (circle) {
-      map.removeOverlay(circle);
-    }
-
-    var center = centerMarker.getLatLng();
-    var bounds = new google.maps.LatLngBounds();
-    var circlePoints = Array();
-    circleRadius = parseInt(refRad.val());
-
-    with (Math) {
-      var d = circleRadius / 3963.189;  // radians
-
-      var lat1 = (PI / 180) * center.lat(); // radians
-      var lng1 = (PI / 180) * center.lng(); // radians
-
-      for (var a = 0 ; a < 361 ; a++ ) {
-        var tc = (PI / 180) * a;
-        var y = asin(sin(lat1) * cos(d) + cos(lat1) * sin(d) * cos(tc));
-        var dlng = atan2(sin(tc) * sin(d) * cos(lat1), cos(d) - sin(lat1) * sin(y));
-        var x = ((lng1 - dlng + PI) % (2 * PI)) - PI ; // MOD function
-        var point = new google.maps.LatLng(parseFloat(y * (180 / PI)), parseFloat(x * (180 / PI)));
-        circlePoints.push(point);
-        bounds.extend(point);
-      }
-
-      if (d < 1.5678565720686044) {
-        circle = new google.maps.Polygon(circlePoints, '#051b2d', 2, 1, '#7688a0', 0.3);
-      }
-      else {
-        circle = new google.mapsPolygon(circlePoints, '#000000', 2, 1);
-      }
-      map.addOverlay(circle);
-
-      map.setZoom(map.getBoundsZoomLevel(bounds));
-    }
-    map.panTo(centerMarker.getLatLng());
-  },
-
-  filterLocations: function(matches) {
-    // now list each of the matches
-    var html = '<h4>Locations Found Within ' + maxDist + ' Miles of ' + refAdd.val() + '</h4>';
-    if (matches.length <= 0) {
-      html += '<p>No locations are within the area specified.</p>';
-    } else {
-      for (var m = 0; m < matches.length; m++) {
-        marker = matches[m];
-        html += '<div class="representative-location" id="dl' + marker.value + '">';
-        html += blurbs[marker.value];
-        html += '<div><a href="#representative-map" id="dda' + marker.value + '" class="get-directions">Driving directions</a></div>';
-        html += '</div>';
-      }
-    }
-    locMatch.html(html);
-
-    // add a listener for when the user clicks on a match
-    var locs = $('div.representative-location');
-    locs.click(function () {
-      document.location = '#representative-map';
-      ajax.fadeIn();
-
-      // Get the marker's value
-      var num = parseInt($(this).attr('id').replace('dl', ''));
-      marker = markers[num];
-      map.setZoom(14);
-
-      // show an info box for the marker
-      map.openInfoWindowHtml(marker.getLatLng(), blurbs[num]);
-      map.panTo(marker.getLatLng());
-
-      // keep the chosen match highlighted
-      $(this).siblings().removeClass('active');
-      $(this).addClass('active');
-
-      ajax.fadeOut();
-    });
-
-    locMatch.slideDown();
-
-    // add an event handler for when the user wants to get driving directions
-    var drvDirs = $('a.get-directions').click(function () {
-      ajax.fadeIn();
-
-      directionsPanel.innerHTML = '';
-
-      // Get the marker's value
-      var num = parseInt($(this).attr('id').replace('dda', ''));
-      marker = markers[num];
-      directions.load('from: ' + centerMarker.getLatLng().lat() + ', ' + centerMarker.getLatLng().lng() + ' to: ' + marker.getLatLng().lat() + ', ' + marker.getLatLng().lng());
-      dirTitle.text('Driving Directions to ' + titles[num]);
-
-      ajax.fadeOut();
-    });
-
-    // make all matches the same height, both for aesthetics and CSS sanity
-    var maxHeight = 0;
-    $.each(locs, function () {
-      var h = $(this).height();
-      if (h > maxHeight) { maxHeight = h; }
-    });
-    locs.height(maxHeight);
-
-    ajax.fadeOut('slow');
-  }
-
-};
 
 //]]>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.