I need a hand adding a custom icon to some Google Maps javascript.
Code below for your reference:
function populateMap() {
var map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(55.915832522285235, -3.5911989212036133), 10);
map.setUIToDefault();
var points = new Array(5);
points[1] = [55.992602,-3.92968, <div class="infoContainer"><h2><a href="#">Mayfield Drive, Longcroft, Bonnybridge</a></h2><p class="address">{locations_address}</p></div> ];
points[2] = [55.9471382,-3.9729174, <div class="infoContainer"><h2><a href="#">Oakwood Cumbernauld</a></h2><p class="address">{locations_address}</p></div> ];
points[3] = [55.933873,-3.12406, <div class="infoContainer"><h2><a href="#">Wauchope Square, Edinburgh</a></h2><p class="address">{locations_address}</p></div> ];
points[4] = [55.843728,-3.95258, <div class="infoContainer"><h2><a href="#">Gibb Street, Chapelhall</a></h2><p class="address">{locations_address}</p></div> ];
points[5] = [55.854559,-4.000543, <div class="infoContainer"><h2><a href="#">Paddock Street, Sikeside</a></h2><p class="address">{locations_address}</p></div> ];
for(var i=1; i < points.length; i++) {
var point = new GLatLng(points[i][0],points[i][1]);
var windowInfo = points[i][2];
var marker = createMarker(point,windowInfo);
map.addOverlay(marker);
}
}
function createMarker(point, overlayText) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(overlayText);});
return marker;
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != function ) {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(populateMap);