	//creer un marker avec plusieurs onglet depuis un point
	function creerMarker(point, onglet1, onglet2, onglet3,idmag) {
		var pic = new GIcon();
		          pic.iconSize=new GSize(60,31);
		          pic.shadowSize=new GSize(56,32);
		          pic.iconAnchor=new GPoint(30,32);
		          pic.infoWindowAnchor=new GPoint(30,0);
		var pic = new GIcon(pic, "/images/mags/alentour.png");
		
		var marker = new GMarker(point,pic);
		
		if ((onglet3!='')&&(onglet3!=undefined)){
			var infoTabs = [
			  new GInfoWindowTab("Contact", '<div style="width:280px;">'+onglet2+'</div>'),
			  new GInfoWindowTab("Infos", '<div style="width:280px;">'+onglet1+'</div>') ,
			  new GInfoWindowTab("Avantages", '<div style="width:280px;">'+onglet3+'</div>') 
			  ];
		}else{
			if ((onglet1!='')&&(onglet1!=undefined)){
				var infoTabs = [
				  new GInfoWindowTab("Contact", '<div style="width:280px;">'+onglet2+'</div>'),
				  new GInfoWindowTab("Infos", '<div style="width:280px;">'+onglet1+'</div>')  
				  ];
			}else{
				var infoTabs = [
				  new GInfoWindowTab("Contact", '<div style="width:280px;">'+onglet2+'</div>') 
				  ];
			}
		}
		  marker.idmag=idmag;
		  marker.infoTab=infoTabs;


		return marker;
	}
       
       
    //creer marker depuis adresse et cr� un taleau de point avec leurs markers
    function markerDepuisAdresse(address,adresse,adresse_secour,idmag,infos,avantages) {  
       if (geocoder) {
         geocoder.getLatLng(
           address,
           function(point) {
             if (!point) {
               //console.log(address + " introuvable");
               if(adresse_secour!=0){
               		markerDepuisAdresse(adresse_secour,adresse,0,idmag);    
               	}    
             } else {
             	 point.addresse=address;
             	 var marker = creerMarker(point,infos,adresse,avantages,idmag );
             	 if($('destination'))
             	 	$('destination').value=address;
             	 point.markMoi=marker;
             	 
       			//markpush.push(marker);
       			markpush[idmag]=marker;
       			mm.addMarker(marker,0,17); 
             	 //map.addOverlay(marker);
               	 points.push(point);
               	 //console.log(point.x);
               	  	map.setCenter(point, 15);
             }
           }
         );
       }
     }
    function afficherAdresseRecherche(address,zoom) {
       if (geocoder) {
         geocoder.getLatLng(
           address,
           function(point) {
             if (!point) {
               alert(address + " introuvable");
             } else {
             centre=point;
              var baseIcon = new GIcon();
		          baseIcon.iconSize=new GSize(32,32);
		          baseIcon.shadowSize=new GSize(56,32);
		          baseIcon.iconAnchor=new GPoint(16,32);
		          baseIcon.infoWindowAnchor=new GPoint(16,0);
          
				var drapeau = new GIcon(baseIcon, "http://maps.google.com/mapfiles/kml/pal4/icon25.png", null, "http://maps.google.com/mapfiles/kml/pal4/icon25s.png");
               map.setCenter(point, zoom);
               var marker = new GMarker(point,drapeau);
               map.addOverlay(marker);
             }
           }
         );
       }
     }
     
	
    //placement du texte dans la fenetre
	function addMag(originalRequest){
		$('magasin').innerHTML=originalRequest.responseText;
	}
	
	//afficher un magasin depuis la fenetre ajax et ouvrir le marker
	function afficheMag(id){
		if(markpush[id]!=undefined){
			markpush[id].openInfoWindowTabsHtml(markpush[id].infoTab);
		}
		choisirMag(id);
	}