// JavaScript Document

var map = null;
var map2 = null;

var geocoder = null;
var geocoder2 = null;


function showInfoWindow(idx,html) 
{
	map.centerAtLatLng(points[idx]);
	markers[idx].openInfoWindowHtml(html);
}


function load() 
{
	if (GBrowserIsCompatible()) 
	{
		geocoder = new GClientGeocoder();
		
		showAddress('Rue de la comtesse Cécile - 12000 RODEZ', "map");
	}
}

function showAddress(address, mapId) 
{
	map = new GMap2(document.getElementById(mapId));
	
	if (geocoder) 
	{
		geocoder.getLatLng(
		address,
		function(point)
		{
			if (!point) {alert(address + " not found");} 
			else 
			{
				map.setCenter(point, 13);
				var marker = new GMarker(point);
				map.addOverlay(marker);
				
				marker.openInfoWindowHtml(address); // info bulle
				
				map.addControl(new GScaleControl());
				map.addControl(new GLargeMapControl()); 	//zoom
				map.addControl(new GMapTypeControl()); // type de carte
				//map.addControl(new GOverviewMapControl()); //  cadre bas droit
				
			}
		});
	}
}


function load2() 
{
	if (GBrowserIsCompatible()) 
	{
		geocoder2 = new GClientGeocoder();
		
		showAddress2('33 avenue d\'Italie 75013 PARIS', "map2");
	}
}

function showAddress2(address2, mapId2) 
{
	map2 = new GMap2(document.getElementById(mapId2));
	
	if (geocoder2) 
	{
		geocoder2.getLatLng(
		address2,
		function(point2)
		{
			if (!point2) {alert(address + " not found");} 
			else 
			{
				map2.setCenter(point2, 13);
				var marker2 = new GMarker(point2);
				map2.addOverlay(marker2);
				marker2.openInfoWindowHtml(address2); // info bulle
				
				map2.addControl(new GScaleControl());
				map2.addControl(new GLargeMapControl()); 	//zoom
				map2.addControl(new GMapTypeControl()); // type de carte
				//map2.addControl(new GOverviewMapControl()); //  cadre bas droit
				
			}
		});
	}
}
