function afficherAnnonce(map, marker, idAnnonce, nbAnnonce)
{
	var xhr999=getXhr();
	xhr999.onreadystatechange = function()
	{
		if(xhr999.readyState==4)
		{
            marker.openExtInfoWindow(map, "extInfoWindow_funkyBox", xhr999.responseText);
		}
	}
	
	xhr999.open("POST",'ajax/ajax_afficherAnnonceCarte.php', true);
	xhr999.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr999.send("idannonce="+idAnnonce+"&nbannonce="+nbAnnonce);
}

function afficherIcone(image,nbAnnonce)
{
	var icon = new GIcon();
	icon.image = image+"?chiffre="+nbAnnonce;
	icon.iconSize = new GSize(37, 32);
	icon.iconAnchor = new GPoint(0, 0);
	icon.infoWindowAnchor = new GPoint(0, 0);
	
	return icon;
}

function marqueur(latitude, longitude, map, icone, ville, nbAnnonce, idAnnonce)
{
	//Affichage de l'icone au bon endroit
	var icon=afficherIcone(icone, nbAnnonce);
	var point = new GLatLng(latitude, longitude);
	var options={icon : icon, title : ville};
	var marker = new GMarker(point, options);
	
	//Evenement sur le marqueur
	GEvent.addListener(marker, "mouseover", function() 
	{
		afficherAnnonce(map, marker, idAnnonce, nbAnnonce);
	});
	
	/*GEvent.addListener(marker, "mouseout", function() 
	{ 
		marker.closeInfoWindow();
	});*/
	
	map.addOverlay(marker);
}


function getWindowHeight() 
{
    var h = 0;
    if (typeof(window.innerHeight) == 'number') { // Netscape
        h = window.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) {
        h = document.documentElement.clientHeight;
    } else if (document.body && document.body.offsetHeight) { //client
        h = document.body.offsetHeight;
    }
    return h;
}

function getWindowWidth() 
{
    var w = 0;
    if (typeof(window.innerWidth) == 'number') { // Netscape
        w = window.innerWidth;
    } else if (document.documentElement && document.documentElement.clientWidth) {
        w = document.documentElement.clientWidth;
    } else if (document.body && document.body.offsetWidth) { //client
        w = document.body.offsetWidth;
    }
    return w;
}

function afficherMap()
{	
	hauteurFenetre=getWindowHeight();
	
	if(document.getElementById('fondmap').style.visibility=='visible')
	{
		document.getElementById('fondmap').style.visibility='hidden';
	}
	else
	{
		document.getElementById('fondmap').style.visibility='visible';
	}
	
	hauteurMap=document.getElementById('themap').offsetHeight;
	hauteurInt=hauteurFenetre-hauteurMap;
	mTop=hauteurInt/2;
	document.getElementById('themap').style.top=mTop+'px';
	
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])

	if (version==6)
	{
		largeurFenetre=getWindowWidth();
		placementLargeur=((largeurFenetre/2)-400);
		hauteurDocument=document.getElementById('global').offsetHeight;
		hauteurDocument+=40;
		document.getElementById('fondmap').style.width=largeurFenetre+'px';
		document.getElementById('fondmap').style.height=hauteurDocument+'px';		
		document.getElementById('themap').style.marginLeft=placementLargeur+'px';
		document.getElementById('themap').style.marginTop=mTop+'px';
	}
}
