function initMap() {
var centre = {lat: 47.08, lng: 2.38} ;
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: 47.08438030, lng: 2.39727180,
nom: 'Pms Marguier',url: '/hotspot-wifi-collectif-bourges-pms-marguier-1268.html',ville: 'Bourges', activite: 'Collectif'},
{lat: 47.22143800, lng: 2.06979100,
nom: 'Cdc Parc Techno',url: '/hotspot-wifi-collectif-vierzon-cdc-parc-techno-1352.html',ville: 'Vierzon', activite: 'Collectif'},
{lat: 47.19148440, lng: 1.89103070,
nom: 'Salle de Conférence Cdc',url: '/hotspot-wifi-centre-culturel-vierzon-salle-de-conference-cdc-1655.html',ville: 'Vierzon', activite: 'Centre culturel'},
{lat: 47.08101200, lng: 2.39878200,
nom: 'Emmaus',url: '/hotspot-wifi-collectif-la-chapelle-saint-ursin-emmaus-2767.html',ville: 'La Chapelle Saint Ursin', activite: 'Collectif'},
{lat: 47.19148440, lng: 1.89103070,
nom: 'Cdc Pole Rural Genouilly',url: '/hotspot-wifi-collectif-genouilly-cdc-pole-rural-genouilly-3848.html',ville: 'Genouilly', activite: 'Collectif'},
{lat: 47.06654140, lng: 2.37079740,
nom: 'Feuillette Bourges',url: '/hotspot-wifi-sandwicherie-bourges-feuillette-bourges-6950.html',ville: 'Bourges', activite: 'Sandwicherie'},
{lat: 47.06686100, lng: 2.39534100,
nom: 'Hotel Inn Design',url: '/hotspot-wifi-hotel-bourges-hotel-inn-design-9414.html',ville: 'Bourges', activite: 'Hôtel'},
{lat: 47.34931200, lng: 2.18302800,
nom: 'Les Sablés de Nancay',url: '/hotspot-wifi-societe-nancay-les-sables-de-nancay-10218.html',ville: 'Nancay', activite: 'Société'},
{lat: -99.00000000, lng: -99.00000000,
nom: 'Feuillette Vierzon',url: '/hotspot-wifi-sandwicherie-vierzo-feuillette-vierzon-11022.html',ville: 'Vierzo', activite: 'Sandwicherie'},
{lat: -99.00000000, lng: -99.00000000,
nom: 'Ace Hotel Bourges',url: '/hotspot-wifi-hotel-bourges-ace-hotel-bourges-11344.html',ville: 'Bourges', activite: 'Hôtel'},
{lat: 47.06395440, lng: 2.38899950,
nom: 'Gite Et Amitié',url: '/hotspot-wifi-collectif-bourges-gite-et-amitie-12047.html',ville: 'Bourges', activite: 'Collectif'},
{lat: 47.21656280, lng: 2.10379730,
nom: 'Hotel Inn Vierzon',url: '/hotspot-wifi-hotel-vierzon-hotel-inn-vierzon-12499.html',ville: 'Vierzon', activite: 'Hôtel'}
]