function centrecarte(){
	var nbmarqueurvisible=0;
	var bounds = new GLatLngBounds();
	var liste="";
	for(id in carto.marqueurs) {
		if(!carto.marqueurs[id].isHidden()){
			bounds.extend(carto.marqueurs[id].getLatLng());
			nbmarqueurvisible++;
		}
	} 
	var zoom=carto.map.getBoundsZoomLevel(bounds);
	if (zoom>15) zoom=15
	
//	alert(nbmarqueurvisible+" - "+bounds.getCenter() +" - "+zoom);
	if (nbmarqueurvisible>0) {
//		alert(nbmarqueurvisible);
		carto.map.setCenter(bounds.getCenter(),zoom );}
	else{
		carto.centrer2(LatitudeDefaut,LongitudeDefaut,ZoomDefaut);
	
	}
}


/**********************************************
	Permet de compter le nombre de fichier sources json charger et déclencher le centrage de la carte une fois terminée
***********************************************/
var nbchargement=0;
function CompteChargement()
{
	nbchargement++;
	if(nbchargement==carto.json_sources_index.length) {
		centrecarte();
	}
}

 function afficheInfos(Id){
	if (carto.marqueurs[Id].isHidden()){
		carto.marqueurs[Id].show();
	}
	carto.ouvrirInfoHtml(Id);
 }
function MasquerFamille(Id){
	carto.checkFamille(0,Id);
}
function AfficherFamille(Id){
	carto.checkFamille(1,Id);
}
function ToggleFamille(Id){
//	$('#MenuCartoFamille'+Id).toggleClass('off');
	if(carto.estFamilleVisible(Id)==1) {MasquerFamille(Id);}
	else {AfficherFamille(Id)}
	centrecarte();
}

function ToggleMenuFamille(Id){
//	if ($("#tabs-"+Id).show();
}


function CheckboxCarto(obj){
	var Id=obj.id;
	if($("#"+Id).attr("checked")==true){
		carto.checkFamille(1,Id);
		$("#onglet-"+Id).show();	
		centrecarte();		
	}else{
		carto.checkFamille(0,Id);		
		$("#onglet-"+Id).hide();
		centrecarte();		
	}
}	

