change image according to description in mysql table for multiple geo locations
<p>I have a script that sets multiple locations of places on my map, but here's the thing, there are different places that needs different icons. Presently I have one icon that sets all the locations to that but I want to place a custom icon for most places. This is an example of my script below!</p>

<pre><code>//&lt;![CDATA[

    var map;


    // Default location
    var center = new google.maps.LatLng(10.684899573032132, -61.20208740234375);

    var geocoder = new google.maps.Geocoder();
    var infowindow = new google.maps.InfoWindow();

    var directionsService = new google.maps.DirectionsService();
    var directionsDisplay = new google.maps.DirectionsRenderer();

    function init() {

        var mapOptions = {
          zoom: 11,
          center: center,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        }

        map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);

        directionsDisplay.setMap(map);
        //directionsDisplay.setPanel(document.getElementById('directions_panel'));

        // Detect user location
        if(navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function(position) {

                var userLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);

                geocoder.geocode( { 'latLng': userLocation }, function(results, status) {
                    if (status == google.maps.GeocoderStatus.OK) {
                        /*document.getElementById('start').*/value = results[0].formatted_address;
                    }
                var mapMarker = new google.maps.Marker({
                position: userLocation,
                title:"You are here."
            });
            mapMarker.setMap(map);
                });

            }, function() {
                alert('Geolocation is supported, but it failed');
            });
        }

                    // This code uses a php file to get the table's info
        makeRequest('get_locations.php', function(data) {

            var data = JSON.parse(data.responseText);
            //var selectBox = document.getElementById('destination');

            for (var i = 0; i &lt; data.length; i++) {
                displayLocation(data[i]);
                addOption(/*selectBox,*/ data[i]['name'], data[i]['address']);
            }
        });
    }

    function displayLocation(location) {

        var content =   '&lt;div class="infoWindow"&gt;&lt;strong&gt;'  + location.name + '&lt;/strong&gt;'
                        + '&lt;br/&gt;'   + location.address
                        + '&lt;br/&gt;'   + location.description + '&lt;/div&gt;';

        if (parseInt(location.lat) == 0) {
            geocoder.geocode( { 'address': location.address }, function(results, status) {
                if (status == google.maps.GeocoderStatus.OK) {
 }
            });
        } else {

            /*var position = new google.maps.LatLng(parseFloat(location.lat), parseFloat(location.lon));
            var marker = new google.maps.Marker({
                map: map, 
                position: position,
                title: location.name
            });*/
                            // This is the icon that all the locations use
            var image = 'np.png';
                    var position = new google.maps.LatLng(parseFloat(location.lat), parseFloat(location.lon));
                    var marker = new google.maps.Marker({
                        position: position,
                        map: map,
                        icon: image,
                        title:"Hi There!"
            });

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

    function addOption(selectBox, text, value) {
        var option = document.createElement("OPTION");
        option.text = text;
        option.value = value;
        //selectBox.options.add(option);
    }
function makeRequest(url, callback) {
        var request;
        if (window.XMLHttpRequest) {
            request = new XMLHttpRequest(); // IE7+, Firefox, Chrome, Opera, Safari
        } else {
            request = new ActiveXObject("Microsoft.XMLHTTP"); // IE6, IE5
        }
        request.onreadystatechange = function() {
            if (request.readyState == 4 &amp;&amp; request.status == 200) {
                callback(request);
            }
        }
        request.open("GET", url, true);
        request.send();
    }
    //]]&gt;
</code></pre>
