
function initialize(largeMap, overview) {
	if (GBrowserIsCompatible()) {
		var map=new GMap2(document.getElementById('map'));
		map.setCenter(new GLatLng(0, 0), 0, G_NORMAL_MAP);		
		map.addControl(new GMapTypeControl(), new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7)));
		if(largeMap) map.addControl(new GLargeMapControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 28)));
		else map.addControl(new GSmallMapControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 28)));
		if(overview) map.addControl(new GOverviewMapControl());

		var clusterIcon = new GIcon();
		clusterIcon.image="/js/novallia/maps/icon-cluster.png";
		clusterIcon.shadow = "http://maps.google.com/mapfiles/kml/pal2/icon2s.png";
		clusterIcon.iconSize=new GSize(32,32);
		clusterIcon.shadowSize=new GSize(56,32);
		clusterIcon.iconAnchor=new GPoint(16,32);
		clusterIcon.infoWindowAnchor=new GPoint(16,0);
		var finalIcon = new GIcon();
		finalIcon.image="/js/novallia/maps/icon-final.png";
		finalIcon.shadow = "http://maps.google.com/mapfiles/kml/pal2/icon10s.png";
		finalIcon.iconSize=new GSize(32,32);
		finalIcon.shadowSize=new GSize(59,32);
		finalIcon.iconAnchor=new GPoint(16,32);
		finalIcon.infoWindowAnchor=new GPoint(16,0);

		var marker, markersArray=[];	
		for (var i=0; i<json.length; i++) {
			marker=createMarker(new GLatLng(json[i].lat, json[i].lng), json[i].id, json[i].title, json[i].content);
			markersArray.push(marker);
		}
		var cluster=new ClusterMarker(map, { markers:markersArray, clusterMarkerIcon:clusterIcon } );
		cluster.clusterMarkerTitle="Cliquez pour zoomer";
		cluster.fitMapToMarkers();
	}
	
	function createMarker(point, index, title, content) {
		markerOptions = { title:title, maxContent:content, icon:finalIcon };
		var marker=new GMarker(point, markerOptions);
		marker.value=index;
		GEvent.addListener(marker, 'click', function() {
			marker.openInfoWindowHtml(content);
		});
		return marker;
	}
}
