function initMap() {
var centre = {lat: 46.38, lng: 3.16} ;
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: 46.28932550, lng: 2.73768330,
nom: 'Hôtel le Lyon Vert',url: '/hotspot-wifi-hotel-commentry-hotel-le-lyon-vert-1110.html',ville: 'Commentry', activite: 'Hôtel'},
{lat: 46.58547360, lng: 3.07020450,
nom: 'Casino de Bourbon L\'Archambault',url: '/hotspot-wifi-restaurant-bourbon-l-archambault-casino-de-bourbon-l-archambault-4986.html',ville: 'Bourbon L\'Archambault', activite: 'Restaurant'},
{lat: 46.33472300, lng: 2.60601300,
nom: 'Montlucon-Residence les Grands Pres',url: '/hotspot-wifi-ehpad-montlucon-montlucon-residence-les-grands-pres-6659.html',ville: 'Montlucon', activite: 'EHPAD'},
{lat: 46.12065710, lng: 3.42588480,
nom: 'Cocoon Coffee',url: '/hotspot-wifi-bar-brasserie-vichy-cocoon-coffee-6902.html',ville: 'Vichy', activite: 'Bar brasserie'},
{lat: 46.12595200, lng: 3.42917300,
nom: 'Demeure D\'Hortense',url: '/hotspot-wifi-gite-chambres-d-hotes-vichy-demeure-d-hortense-6963.html',ville: 'Vichy', activite: 'Gîte / Chambres d\'hôtes'},
{lat: 46.12438660, lng: 3.41818340,
nom: 'Les Rives du Parc',url: '/hotspot-wifi-gite-chambres-d-hotes-vichy-les-rives-du-parc-7883.html',ville: 'Vichy', activite: 'Gîte / Chambres d\'hôtes'},
{lat: 46.12627100, lng: 3.42529000,
nom: 'Hôtel de Naples',url: '/hotspot-wifi-hotel-vichy-hotel-de-naples-9866.html',ville: 'Vichy', activite: 'Hôtel'},
{lat: -99.00000000, lng: -99.00000000,
nom: 'Beaurivage - Camping, Lodges & Spa',url: '/hotspot-wifi-camping-bellerive-sur-allier-beaurivage-camping-lodges-spa-11329.html',ville: 'Bellerive Sur Allier', activite: 'Camping'},
{lat: -99.00000000, lng: -99.00000000,
nom: 'Aire de Camping-Car de Vichy / Bellerive',url: '/hotspot-wifi-camping-bellerive-sur-allier-aire-de-camping-car-de-vichy-bellerive-11330.html',ville: 'Bellerive Sur Allier', activite: 'Camping'},
{lat: -99.00000000, lng: -99.00000000,
nom: 'Ace Hotel Montlucon',url: '/hotspot-wifi-hotel-saint-victor-ace-hotel-montlucon-11334.html',ville: 'Saint Victor', activite: 'Hôtel'},
{lat: 46.54725400, lng: 3.34066800,
nom: 'Feuillette Yzeure',url: '/hotspot-wifi-sandwicherie-yzeure-feuillette-yzeure-12421.html',ville: 'Yzeure', activite: 'Sandwicherie'},
{lat: 46.56560600, lng: 3.33015600,
nom: 'Fiteco Moulins',url: '/hotspot-wifi-societe-moulins-fiteco-moulins-12721.html',ville: 'Moulins', activite: 'Société'}
]