//<![CDATA[

var map;
var marker_tab = [] ;
function load() {
	if (GBrowserIsCompatible()) {

		map = new GMap2(document.getElementById("map"));
		map.disableDoubleClickZoom() ;
		var point_club =new GLatLng( 43.830665, 5.836937 ) ;       
		var marker_club = new GMarker( point_club , { title: "Aviron club Manosque cliquer pour plus d infos" } ) ;
		map.setCenter( point_club, 8 );
		map.addOverlay( marker_club ) ;

		GEvent.addListener(marker_club, "click", function() {
			marker_club.openInfoWindowHtml( 'Local aviron <br/>Lac des Vannades<br/> tel Pr&eacute;sident 04 92 72 00 11 <br/> tel entraineur 06 03 44 46 22  <br/> <a href=\"mailto:avironmanosque@gmail.com\"  >avironmanosque@gmail.com<\/a><br/><a href=\"http://www.aviron-club-manosque.org\"  >www.aviron-club-manosque.org<\/a><br/>'  );
		});

		var mapControl = new GMapTypeControl();
		map.addControl(mapControl);
		map.addControl(new GLargeMapControl());
		map.addControl(new GOverviewMapControl());

		GDownloadUrl("squelettes/data_clubs.xml", function(data) {
			var xml = GXml.parse(data);
			var markers = xml.documentElement.getElementsByTagName("marker");
			for (var i = 0; i < markers.length; i++) {
				var point = new GLatLng( parseFloat(markers[i].getAttribute("lat")),
						parseFloat(markers[i].getAttribute("lng")));
				var title_mark = ""+markers[i].getAttribute("nom")+" cliquer pour plus d'infos"+"" ;

				marker_tab[i] =  new GMarker( point , {title:title_mark} )  ; 
				map.addOverlay(  marker_tab[i]  );

				GEvent.addListener(marker_tab[i]  , "click", function() {
					var k ;
					for (var j = 0; j < marker_tab.length; j++) {
						if( ( marker_tab[j].getLatLng().lat() ==  this.getLatLng().lat() ) &&  ( marker_tab[j].getLatLng().lng() ==  this.getLatLng().lng() )  )
						{
							k=j;
							break ;
						}
					}

					var titi ="" ;
					if(  markers[k].getAttribute("nom") != null && markers[k].getAttribute("nom") != ""  )
					{
						titi += markers[k].getAttribute("nom") +"<br/>"  ;
					}
					if(  markers[k].getAttribute("adresse") != null && markers[k].getAttribute("adresse") != ""  )
					{
						titi += markers[k].getAttribute("adresse") +"<br/>"  ;
					}
					if(  markers[k].getAttribute("tel") != null && markers[k].getAttribute("tel") != ""  )
					{
						titi += "tel : "+markers[k].getAttribute("tel") +"<br/>"  ;
					}
					if( markers[k].getAttribute("email") != null && markers[k].getAttribute("email") != "" )
					{
						titi  += "email : "+"<a href=\"mailto:"+markers[k].getAttribute("email")+"\">"+markers[k].getAttribute("email")+"<\/a><br/>" ;
					}
					if( markers[k].getAttribute("site") != null && markers[k].getAttribute("site") != "" )
					{
						titi  += "site : "+"<a href=\""+markers[k].getAttribute("site")+"\">"+markers[k].getAttribute("site")+"<\/a><br/>" ;
					}
					titi += "" ;
					this.openInfoWindowHtml( titi  );
				});
			}
		});
	}
}
    //]]>

