function initialize()

in js/custom.js [1001:1109]


function initialize(id) {

    var image = 'images/icon-map.png';

    var overlayTitle = 'Agencies';

    var locations = [
        //point number 1
        ['Madison Square Garden', '4 Pennsylvania Plaza, New York, NY'],

        //point number 2
        ['Best town ever', 'Santa Cruz', 36.986021, -122.02216399999998],

        //point number 3 
        ['Located in the Midwestern United States', 'Kansas'],

        //point number 4
        ['I\'ll be there one day', 'Chicago', 41.8781136, -87.62979819999998] 
      
        ];

        /*** DON'T CHANGE ANYTHING PASSED THIS LINE ***/
        id = (id == undefined) ? 'mapWrapper' : id;

        var map = new google.maps.Map(document.getElementById(id), {
          mapTypeId: google.maps.MapTypeId.ROADMAP,
          zoom: 14

      });

        var myLatlng;
        var marker, i;
        var bounds = new google.maps.LatLngBounds();
        var infowindow = new google.maps.InfoWindow({ content: "loading..." });

        for (i = 0; i < locations.length; i++) { 


            if(locations[i][2] != undefined && locations[i][3] != undefined){
                var content = '<div class="infoWindow">'+locations[i][0]+'<br>'+locations[i][1]+'</div>';
                (function(content) {
                    myLatlng = new google.maps.LatLng(locations[i][2], locations[i][3]);

                    marker = new google.maps.Marker({
                        position: myLatlng,
                        icon:image,  
                        title: overlayTitle,
                        map: map
                    });

                    google.maps.event.addListener(marker, 'click', (function(marker, i) {
                        return function() {
                          infowindow.setContent(content);
                          infowindow.open(map, this);
                      }

                  })(this, i));

                    if(locations.length > 1){
                        bounds.extend(myLatlng);
                        map.fitBounds(bounds);
                    }else{
                        map.setCenter(myLatlng);
                    }

                })(content);
            }else{

             geocoder   = new google.maps.Geocoder();
             var info   = locations[i][0];
             var addr   = locations[i][1];
             var latLng = locations[i][1];

             (function(info, addr) {

                 geocoder.geocode( {

                    'address': latLng

                }, function(results, status) {

                    myLatlng = results[0].geometry.location;

                    marker = new google.maps.Marker({
                        position: myLatlng,
                        icon:image,  
                        title: overlayTitle,
                        map: map
                    });
                    var $content = '<div class="infoWindow">'+info+'<br>'+addr+'</div>';
                    google.maps.event.addListener(marker, 'click', (function(marker, i) {
                        return function() {
                          infowindow.setContent($content);
                          infowindow.open(map, this);
                      }
                  })(this, i));

                    if(locations.length > 1){
                        bounds.extend(myLatlng);
                        map.fitBounds(bounds);
                    }else{
                        map.setCenter(myLatlng);
                    }
                });
})(info, addr);

}
}
}