/**
 * Trigger de mise a jour de la carto
 * @param event
 * @param name
 * @param id
 */
var majMap = function(event, name, id, option)
{	
	/* --- Recupere l'objet GMap --- */
	var mapObj;
	if(option['gmap'] != null) {
		mapObj = option['gmap'];
	}

	/* --- Genere les StopArea depuis KML */
	if(name == 'stopAreaKml') {
		mapObj.DrawKmlStopAreas(name, option);
	}
	
	/* --- Genere les lieu remaquable --- */
	if(name == 'siteKml') {
		mapObj.DrawKmlStopAreas(name, option);
	}
	
	if(name == 'lineKml') {
		mapObj.GetKmlForExternalCode(option['externalCode'],option['externalCodeType']);
	}
	
	/* --- Genere les POIS --- */
	if(mapObj.clusterManager[name] == null && id.indexOf('afficher') != -1){
		mapObj.DrawMarkerSite(name, option);
	} else if (mapObj.clusterManager[name] != null) {
		if(id.indexOf('afficher') != -1) {
			mapObj.clusterManager[name].showAllMarkers();
		} else if (id.indexOf('masquer') != -1) {
			mapObj.clusterManager[name].hideAllMarkers();
		}
	}
	
	/* --- Affiche / Masque les POIS selon le zoom --- */
	if(name == 'poiZoomAdapt') {
		if(option['zoom'] < 16) {
			for(var i in mapObj.clusterManager) {
				if (i != 'in_array' &&  i != 'stopAreaKml') {
					if (typeof(mapObj.clusterManager[i].hideAllMarkers) != 'undefined') {
							mapObj.clusterManager[i].hideAllMarkers();
					}
				}
			}
		} else {
			if (mapObj.clusterManager['poiItineraire'] != null)  {
				mapObj.clusterManager['poiItineraire'].showAllMarkers();
			}
		}
	}
};

/**
 * Trigger de mise a jour de formulaire
 * @param event
 * @param name
 * @param id
 */
var majForm = function (event, name, id, option)
{
	if(option['zoom'] != null) {
		hideShowRadioBtPoiCaption(option['zoom'], option['current']);
	}
};

/**
 * Trigger recherche de lieu/commune (carte interactive)
 * @param event
 * @param mapObj
 * @param options
 */
var LocalitySearch = function(event,mapObj,options)
{
	mapObj.LocalitySearch(options);
}

