function initMap() {
var centre = {lat: 49.91, lng: 2.3} ;
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 8,
center: centre
});
var tempMarkers = [];
var infoWindow = new google.maps.InfoWindow();
var marker, i;
for (var i = 0; i < locations.length; i++) {
var lat = locations[i].lat;
var lng = locations[i].lng;
marker = new google.maps.Marker({
position: new google.maps.LatLng(lat, lng),
map: map,
icon: 'https://cdn2.iconfinder.com/data/icons/flat-ui-icons-24-px/24/location-24-32.png'
});
tempMarkers.push(marker);
//markerCluster.addMarker(marker);
var prev_infowindow = false;
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
var contentString = ''+locations[i].nom+'
'+locations[i].activite+' à '+locations[i].ville;
var infoWindow = new google.maps.InfoWindow({
content: contentString
});
if (prev_infowindow) {
prev_infowindow.close();
}
prev_infowindow = infoWindow;
infoWindow.open(map, marker);
}
})(marker, i));
}
var markerCluster = new MarkerClusterer(map,tempMarkers,{imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'});
}
var locations = [
{lat: 50.33951520, lng: 1.55856980,
nom: 'Casino de Fort Mahon',url: '/hotspot-wifi-bar-restaurant-fort-mahon-casino-de-fort-mahon-4138.html',ville: 'Fort Mahon', activite: 'Bar restaurant'},
{lat: 49.90741670, lng: 2.65128900,
nom: 'Camping Au Gros Buisson',url: '/hotspot-wifi-camping-chipilly-camping-au-gros-buisson-4803.html',ville: 'Chipilly', activite: 'Camping'},
{lat: 50.34135180, lng: 1.55119600,
nom: 'Résidence le Grand Bleu',url: '/hotspot-wifi-collectif-fort-mahon-plage-residence-le-grand-bleu-5803.html',ville: 'Fort Mahon Plage', activite: 'Collectif'},
{lat: 50.33892440, lng: 1.55083190,
nom: 'Sarl Hotel la Terrasse',url: '/hotspot-wifi-hotel-fort-mahon-plage-sarl-hotel-la-terrasse-5879.html',ville: 'Fort Mahon Plage', activite: 'Hôtel'},
{lat: -99.00000000, lng: -99.00000000,
nom: '856',url: '/hotspot-wifi-vehicule-de-transport-rivery-856-8201.html',ville: 'Rivery', activite: 'Véhicule de transport'},
{lat: 49.91860500, lng: 2.22942000,
nom: 'Gite de la Marine',url: '/hotspot-wifi-gite-chambres-d-hotes-dreuil-les-amiens-gite-de-la-marine-8865.html',ville: 'Dreuil les Amiens', activite: 'Gîte / Chambres d\'hôtes'},
{lat: 50.06106500, lng: 1.37053400,
nom: 'Au Crédit Agricole Brie Picardie',url: '/hotspot-wifi-agence-bancaire-friville-escarbotin-au-credit-agricole-brie-picardie-9844.html',ville: 'Friville Escarbotin', activite: 'Agence bancaire'},
{lat: 49.88536530, lng: 2.26966920,
nom: 'Restaurant le Vivier',url: '/hotspot-wifi-restaurant-amiens-restaurant-le-vivier-11067.html',ville: 'Amiens', activite: 'Restaurant'},
{lat: 49.89344370, lng: 2.28882290,
nom: 'Résidence Crems',url: '/hotspot-wifi-collectif-amiens-residence-crems-11251.html',ville: 'Amiens', activite: 'Collectif'},
{lat: -99.00000000, lng: -99.00000000,
nom: 'Credit Agricole Brie Picardie',url: '/hotspot-wifi-agence-bancaire-amiens-credit-agricole-brie-picardie-11285.html',ville: 'Amiens', activite: 'Agence bancaire'},
{lat: 49.86091830, lng: 2.27650440,
nom: 'Hotel-Inn Design/restaurant',url: '/hotspot-wifi-bar-brasserie-dury-hotel-inn-design-restaurant-12209.html',ville: 'Dury', activite: 'Bar brasserie'},
{lat: 49.86091830, lng: 2.27650440,
nom: 'Hotel Inn Design',url: '/hotspot-wifi-hotel-dury-hotel-inn-design-12693.html',ville: 'Dury', activite: 'Hôtel'}
]