var tinyIcon = new Array;
var geocoder=null;
var map =null;

function gm_load() {
	

  if (GBrowserIsCompatible()) {
  	
    map = new GMap2(document.getElementById("googlemap"));
		
		//centrer sur la france
    map.setCenter(new GLatLng(46.75984,1.738281), 6);    

    geocoder = new GClientGeocoder(); // Géocoding
    
    // on place les points
		addAllMarker(tabCoord);

    map.addControl(new GLargeMapControl());    
    map.addControl(new GHierarchicalMapTypeControl());		

  }
  tabCoord= new Array;
}

   
   

function addAllMarker(tabCoord) {
	
	for(i=0;i<tabCoord.length;i++) {
		
		var coord = tabCoord[i][0].split(';'); 
		
		var point = new GLatLng(coord[0], coord[1]);
		if(point)
			map.addOverlay(addMarker(point,tabCoord[i][1],tabCoord[i][2],tabCoord[i][3],tabCoord[i][4]));
		
	}

}


function addMarker(point,adresse,origine,intensite,remarque) {
		
    var marker = new GMarker(point);  // Initialisation d'un marker
    //map.addOverlay(marker);           // Affichage du marker
    
    GEvent.addListener(marker, "click", function() { 
    	var texte_bulle='<b>Adresse : </b><br />'+adresse+'<br /><br /><b>Origine : </b>'+origine+'<br /><br /><b>Intensit&eacute; : </b><br />'+intensite;
			if(remarque!=''){
				texte_bulle+='<br /><br /><b>Remarque : </b><br />'+remarque;
			}
	
			marker.openInfoWindowHtml(texte_bulle);        // Affichage d'une bulle contenant l'adresse et le detail
		});  
		return marker;
	
}