function initMap() {
var centre = {lat: 45.5613, lng: 4.80519} ;
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: 45.64186200, lng: 4.16761200,
nom: 'Gîte Cottin Jean-Francois',url: '/hotspot-wifi-gite-chambres-d-hotes-chalain-le-comtal-gite-cottin-jean-francois-2542.html',ville: 'Chalain le Comtal', activite: 'Gîte / Chambres d\'hôtes'},
{lat: 45.41907580, lng: 4.40279800,
nom: 'Cos Crepse',url: '/hotspot-wifi-ehpad-saint-etienne-cos-crepse-4024.html',ville: 'Saint-Etienne', activite: 'EHPAD'},
{lat: 45.43929600, lng: 4.39369300,
nom: 'Immeuble République',url: '/hotspot-wifi-societe-saint-etienne-immeuble-republique-9769.html',ville: 'Saint Etienne', activite: 'Société'},
{lat: 45.41310800, lng: 4.39452950,
nom: 'Hotel du Midi',url: '/hotspot-wifi-hotel-saint-etienne-hotel-du-midi-10150.html',ville: 'Saint Etienne', activite: 'Hôtel'},
{lat: 45.81646700, lng: 3.75753800,
nom: 'Au Rendez Vous des Chasseurs',url: '/hotspot-wifi-hotel-noiretable-au-rendez-vous-des-chasseurs-10489.html',ville: 'Noiretable', activite: 'Hôtel'},
{lat: 45.43929600, lng: 4.39369300,
nom: 'Immeuble Ferdinand',url: '/hotspot-wifi-collectif-saint-etienne-immeuble-ferdinand-10502.html',ville: 'Saint étienne', activite: 'Collectif'},
{lat: 45.99023400, lng: 4.02499300,
nom: 'Ace - 422s',url: '/hotspot-wifi-ehpad-villerest-ace-422s-10901.html',ville: 'Villerest', activite: 'EHPAD'},
{lat: -99.00000000, lng: -99.00000000,
nom: 'Gsvi St-Etienne',url: '/hotspot-wifi-vehicule-de-transport-andrezieux-boutheon-gsvi-st-etienne-10995.html',ville: 'Andrezieux Boutheon', activite: 'Véhicule de transport'},
{lat: -99.00000000, lng: -99.00000000,
nom: 'Us Feurs',url: '/hotspot-wifi-espace-public-feurs-us-feurs-11077.html',ville: 'Feurs', activite: 'Espace public'},
{lat: 45.42806400, lng: 4.39042700,
nom: 'Comme A la Maison Clients',url: '/hotspot-wifi-bar-restaurant-saint-etienne-comme-a-la-maison-clients-11144.html',ville: 'Saint Etienne', activite: 'Bar restaurant'},
{lat: -99.00000000, lng: -99.00000000,
nom: 'Ace Hotel Roanne',url: '/hotspot-wifi-hotel-mably-ace-hotel-roanne-11333.html',ville: 'Mably', activite: 'Hôtel'},
{lat: -99.00000000, lng: -99.00000000,
nom: '19 Rue Ferdinand',url: '/hotspot-wifi-collectif-saint-etienne-19-rue-ferdinand-11360.html',ville: 'Saint étienne', activite: 'Collectif'},
{lat: 46.05395400, lng: 4.06415400,
nom: 'Feuillette Riorges',url: '/hotspot-wifi-sandwicherie-riorges-feuillette-riorges-12351.html',ville: 'Riorges', activite: 'Sandwicherie'}
]