var map = null;
var geocoder = null;
	
function initialize(longitude, latitude)
{
	if (GBrowserIsCompatible()) 
	{
		//alert(longitude+latitude);
		map = new GMap2(document.getElementById("map_canvas"));
		if(longitude != undefined)
		{
			map.setCenter(new GLatLng(latitude, longitude), 16);
			var marker = new GMarker(new GLatLng(latitude, longitude));
			map.addOverlay(marker);
		}
		/*
		GEvent.addListener(map,"click", function(overlay,latlng) 
		{     
		if (latlng) 
		{   
			var myHtml = "The GLatLng value is: " + map.fromLatLngToDivPixel(latlng) + " at zoom level " + map.getZoom();
			map.openInfoWindow(latlng, myHtml);
		}
		});*/
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		geocoder = new GClientGeocoder();
	}
}


function searchaddress(address) {
      if (geocoder) 
	  {
        geocoder.getLatLng(
          address,
          function(point) 
		  {
            if (!point) 
			{              
              var ville = address.substr(address.lastIndexOf(" ",    address.lastIndexOf(" ") -1   ));
              searchaddress(ville);
            } 
			else 
			{
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(address);
            }
          }
        );
      }
    }
