bgneal@821: var bandmap = null; bgneal@821: var geocoder = null; bgneal@827: var surfbands = []; bgneal@827: var map_options = { bgneal@827: center: {lat: 15.0, lng: -30.0}, bgneal@827: zoom: 2 bgneal@827: }; bgneal@827: var info_win = null; bgneal@821: bgneal@821: function addBandOnSubmit(event) { bgneal@821: var location = $('#id_location').val(); bgneal@821: if (!location) { bgneal@821: alert("Please enter a location"); bgneal@821: return false; bgneal@821: } bgneal@821: var button = $(this); bgneal@821: button.attr('disabled', 'disabled'); bgneal@821: var form = $('#bandmap-add-form'); bgneal@821: geocoder.geocode({'address': location}, function(results, status) { bgneal@821: button.removeAttr('disabled'); bgneal@821: if (status == google.maps.GeocoderStatus.OK) { bgneal@821: $('#id_lat').val(results[0].geometry.location.lat().toString()); bgneal@821: $('#id_lon').val(results[0].geometry.location.lng().toString()); bgneal@821: $(form).submit(); bgneal@821: } bgneal@821: else { bgneal@821: var msg = "Geocode unsuccessful: " + status + "\n" + bgneal@821: "Enter a new location"; bgneal@821: alert(msg); bgneal@821: } bgneal@821: }); bgneal@821: return false; bgneal@821: } bgneal@821: bgneal@827: bgneal@827: function refreshMap() { bgneal@827: bandmap.setOptions(map_options); bgneal@827: $.each(surfbands, function(i, band) { bgneal@827: band.marker.setMap(null); bgneal@827: }); bgneal@827: surfbands.length = 0; bgneal@827: var band_sel = $('#map-bands'); bgneal@827: band_sel[0].length = 0; bgneal@827: band_sel.append($('