//fichier javascript de la carte
	  function switchDisplay(n, force) {
		window.focus();
		if (document.all) { 
			detail=eval("document.all."+ n + '');
		} else {
			detail=document.getElementById(n);
		}
		if (detail==null) return false;
		if (force!=null)  {
			detail.style.display=force;
		} else {
			if ((detail.style.display!="block") || (detail.style.display=="")) {
			   detail.style.display="block";
			 } else  {
			   detail.style.display="none";
			}
		}
	  }
	  
	  function pygSetLatLng() {
		var lat = document.form2.lat.value;
		var lng = document.form2.lng.value;
		map.setCenter(new GPoint(lng, lat));
		document.location.href = "#top";
	  }
	  
	  
//----
function pyg_icon(type) {
	var color;
	if ((typeof(type)=="undefined") || (type==null)) { color = "red" } else { color = type }
	var icon = new GIcon();
	icon.image = "/gfx/gmap/mm_20_"+ color +".png"; //alert(icon.image);
	icon.shadow = "/gfx/gmap/mm_20_shadow.png";
	icon.iconSize = new GSize(12, 20);
	icon.shadowSize = new GSize(22, 20);
	icon.iconAnchor = new GPoint(6, 20);
	icon.infoWindowAnchor = new GPoint(5, 1);
	return icon;
}

var icon = new GIcon();
icon.image = "/gfx/gmap/mm_20_red.png";
icon.shadow = "/gfx/gmap/mm_20_shadow.png";
icon.iconSize = new GSize(12, 20);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(5, 1);

var map;
var markers; 
//------------------------------------------
function createMarker(point,icon,type,title,text,fullurlid) {
        var marker = new GMarker(point,icon);
        GEvent.addListener(marker, "click", function() {
		
		title2 = "<a href='/annuaire/" + fullurlid + "'>"+ title +"</a>";
		
		var html = "<div align=\"center\"><strong>"+ title2 +"</strong></div>" + "<hr width=\"100\"/><div align=\"left\" style=\"width: 20em\">" + text +"</div>";
          marker.openInfoWindowHtml(html);
        });
        return marker;
      }
function load() {
	map = new GMap2(document.getElementById("map"));
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	var ovcontrol = new GOverviewMapControl(new GSize(150,150));
	map.addControl(ovcontrol); 
	map.setCenter(new GLatLng(dlat, dlng), dzoom, G_NORMAL_MAP);
	GEvent.addListener(map, "click", function(markerP, point) {
	  if (markerP) {
		map.setCenter(point); 
	  } else {

	  }
	});

	GDownloadUrl("/annuaire/markers.xml", function(data, responseCode) {
	  var xml = GXml.parse(data);
	  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 text = markers[i].getAttribute("text");
		var title = markers[i].getAttribute("title");
		var type = markers[i].getAttribute("type");
		var fullurlid = markers[i].getAttribute("fullurlid");
		var icon = pyg_icon(type);
		var marker = createMarker(point,icon,type,title,text,fullurlid);
		map.addOverlay(marker);
	  }
	});
// 	document.getElementById('loading').style.display='none'; 
}
//----------------------------------------------------
