function initMap() {
var centre = {lat: 44.5, lng: 3.49} ;
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: 44.81139140, lng: 3.16684720,
nom: 'Auberge du Verdy',url: '/hotspot-wifi-hotel-termes-auberge-du-verdy-7702.html',ville: 'Termes', activite: 'Hôtel'},
{lat: 44.32931600, lng: 3.89193100,
nom: 'Ehpad de Vialas',url: '/hotspot-wifi-ehpad-vialas-ehpad-de-vialas-9318.html',ville: 'Vialas', activite: 'EHPAD'},
{lat: 44.50460800, lng: 3.73570900,
nom: 'Hotel la Remise',url: '/hotspot-wifi-hotel-mont-lozere-et-goulet-hotel-la-remise-10730.html',ville: 'Mont Lozere Et Goulet', activite: 'Hôtel'},
{lat: 44.51420000, lng: 3.47486400,
nom: 'Camping le Tivoli',url: '/hotspot-wifi-camping-mende-camping-le-tivoli-11348.html',ville: 'Mende', activite: 'Camping'},
{lat: 44.32176030, lng: 3.59542210,
nom: 'Hôtel des Gorges du Tarn',url: '/hotspot-wifi-hotel-florac-hotel-des-gorges-du-tarn-12152.html',ville: 'Florac', activite: 'Hôtel'}
]