function ajax_initObject()      {
        var A;
        try     {
                A=new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e)     {
                try     {
                        A=new ActiveXObject("Microsoft.XMLHTTP");
                } catch (oc)    {
                        A=null;
                }
        }
        if(!A && typeof XMLHttpRequest != "undefined")  {
                A = new XMLHttpRequest();
        }
        return A;
}
function ajax_doRequest(url)    {
        var x;

        x = ajax_initObject();
        if(!x)  {
                gmap_failRequest(url);
        }
        x.open("GET", url, true);

        x.onreadystatechange = function()       {
                if (x.readyState != 4)  {
                        return;
                }
                var xmldoc = x.responseXML;
                var t3ajax = xmldoc.getElementsByTagName("t3ajax")[0];
                gmap_fillMarkers(t3ajax);
        }
        x.send("");

        delete x;
}
window.currentMarkers = new Array();

function gmap_failRequest(url)
{
	alert("XMLHttpRequest not available");
}

function gmap_fillMarkers(t3ajax)
{
	var map = window.mainmap;
	if (t3ajax == null)
	{
		alert("La requête à échoué.");
		return;
	}
	while (window.currentMarkers.length > 0)
	{
		map.removeOverlay(window.currentMarkers[0]);
		window.currentMarkers.shift();
	}
	var sheets = t3ajax.firstChild;
	if (sheets.childNodes.length == 0)
		return;
	var value = sheets.firstChild.getElementsByTagName('geolocalisation')[0];
	var coords = value.text.split(',');
	var bounds = null;
	var latlng;
	var entries = sheets.childNodes;
	for (var i = 0; i < entries.length; i++)
	{
		var entry = entries[i];
		value = entry.getElementsByTagName('geolocalisation')[0];
		coords = value.text.split(',');
		if (coords[0] == "0" && coords[1] == "0")
			continue;
		var marker = new google.maps.Marker(latlng = new google.maps.LatLng(parseFloat(coords[0]), parseFloat(coords[1])));
		window.currentMarkers.push(marker);
		var content = document.createElement("div");
		content.style.fontFamily = "Arial";
		var name = document.createElement("p");
		value = entry.getElementsByTagName('name')[0];
		name.appendChild(document.createTextNode(value.text));
		name.style.fontWeight = "bold";
		content.appendChild(name);
		var address = document.createElement("p");
		value = entry.getElementsByTagName('address')[0];
		if (value.text.length > 0)
		{
			value = value.text.split('<br/>');
			for (var j = 0; j < value.length; j++)
			{
				address.appendChild(document.createTextNode(value[j]));
				address.appendChild(document.createElement("br"));
			}
		}
		value = entry.getElementsByTagName('zip')[0];
		address.appendChild(document.createTextNode(value.text));
		address.appendChild(document.createTextNode(" "));
		value = entry.getElementsByTagName('city')[0];
		address.appendChild(document.createTextNode(value.text));
		content.appendChild(address);
		marker.bindInfoWindow(content);
		if (bounds == null)
			bounds = new google.maps.LatLngBounds(latlng, latlng);
		else
			bounds.extend(latlng);
		map.addOverlay(marker);
	}
	if (bounds != null)
	{
		map.setZoom(map.getBoundsZoomLevel(bounds));
		map.panTo(bounds.getCenter());
	}
}
function SlipSelectControl()
{
}
SlipSelectControl.prototype = new google.maps.Control();
SlipSelectControl.prototype.initialize = function(map)
{
	var container = document.createElement("div");
	var select = document.createElement("select");
	select.onchange = function ()
	{
		ajax_doRequest("http://cdtvdm.ic-s.org/?id=11&tx_basecontactgmap_pi1[type]=" + this.options[this.selectedIndex].value);
	}
	var option = null;
	option = document.createElement("option");
	option.value = "";
	option.appendChild(document.createTextNode(""));
	select.appendChild(option);
	option = document.createElement("option");
	option.value = "22";
	option.appendChild(document.createTextNode("HLO"));
	select.appendChild(option);
	option = document.createElement("option");
	option.value = "21";
	option.appendChild(document.createTextNode("FMA"));
	select.appendChild(option);
	option = document.createElement("option");
	option.value = "20";
	option.appendChild(document.createTextNode("ASC"));
	select.appendChild(option);
	option = document.createElement("option");
	option.value = "19";
	option.appendChild(document.createTextNode("AFF"));
	select.appendChild(option);
	option = document.createElement("option");
	option.value = "18";
	option.appendChild(document.createTextNode("HOT"));
	select.appendChild(option);
	option = document.createElement("option");
	option.value = "17";
	option.appendChild(document.createTextNode("ITI"));
	select.appendChild(option);
	option = document.createElement("option");
	option.value = "16";
	option.appendChild(document.createTextNode("HPA"));
	select.appendChild(option);
	option = document.createElement("option");
	option.value = "15";
	option.appendChild(document.createTextNode("RES"));
	select.appendChild(option);
	option = document.createElement("option");
	option.value = "14";
	option.appendChild(document.createTextNode("PNA"));
	select.appendChild(option);
	option = document.createElement("option");
	option.value = "13";
	option.appendChild(document.createTextNode("PCU"));
	select.appendChild(option);
	option = document.createElement("option");
	option.value = "12";
	option.appendChild(document.createTextNode("ORG"));
	select.appendChild(option);
	container.appendChild(select);
	map.getContainer().appendChild(container);
	return container;
}
SlipSelectControl.prototype.getDefaultPosition = function()
{
	return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(2, 12));
}
    function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new google.maps.Map2(document.getElementById("map_canvas"), { googleBarOptions: { onGenerateMarkerHtmlCallback: function (marker, html, result) { return ''; }}});
        map.setCenter(new GLatLng(48.783102, 2.19173), 16);
		map.enableScrollWheelZoom();
        map.addControl(new google.maps.LargeMapControl());
        map.addControl(new google.maps.MapTypeControl());
		//map.addControl(new SlipSelectControl());
		var point = new GLatLng(48.783102,2.19173);
		var marker = new GMarker(point);
		map.addOverlay(marker);
		window.mainmap = map;
      }
    }