//<![CDATA[
var CarteItineraire;
var gdir;
var geocoder = null;
var addressMarker;

var Periode = 'Ouvert toute l\'année';
var Photo = '';
var Centre = 'Le Looping';
var Adresse = 'Aérodrome Gap-Tallard';
var CodePostal = '05130';
var Ville = 'TALLARD';
var Latitude = '44.45493578917987';
var Longitude = '6.033961772918701';
//var point = new GPoint(6.034809,44.457976);

function load() {
	
	if (GBrowserIsCompatible()) {
		MaCarte = new GMap2(document.getElementById("EmplacementDeMacarte"));
		MaCarte.setCenter(new GLatLng(45.921076040880166,3.753917694091797), 6);
		MaCarte.setCenter(new GLatLng(44.455778,6.035914), 7);
		var point = new GLatLng(Latitude,Longitude);
		var marker = CreationDuMarqueur(point,Periode,Photo,Centre,Adresse,CodePostal,Ville,Latitude,Longitude);
		
		MaCarte.addControl(new GLargeMapControl());  
		MaCarte.addControl(new GMapTypeControl());
		MaCarte.addOverlay(marker);
	}else{
		alert("Désolé, mais votre navigateur n'est pas compatible avec Google Maps");
	}
}
function CreationDuMarqueur(point,periode,photo,societe,adresse,cp,ville,latitude,longitude)
{
	var marker = new GMarker(point,{title:societe});
	
	GEvent.addListener(marker, 'click', function() {
	
	var formulaire_itineraire ='<div style="text-align: center; width:470px; height:250px; border: 1px solid #ccc; color: #062041; background:#c0d1eb; font: 1em \'trebuchet ms\',verdana, helvetica, sans-serif; margin:10px 10px 10px 10px">' +
	'<b>'+societe+'</b><br />'+
		periode+'<br />' +
		'<form action="http://maps.google.com/maps" method="get" target="_blank" style="margin:10px 10px 10px 10px">' +
			'<hr />' +
			'<img src='+photo+' border="1" alt="Le Looping" vspace="10" hspace="10" align="right" />' +				
			'<div style="text-align: left">Indiquez votre ville de départ ci-dessous : ' +
			'<input type="text" name="saddr" id="saddr" value="" style="width:300px; height:20px; border:1px solid grey;" /><br />' +
			'Adresse d\'arrivée : <br /><b>'+societe+'</b><br />'+adresse+'<br />'+cp+' '+ville+'<br /></div>' +
			'<hr />' +
			'<input value="Calculez votre itinéraire avec Google Maps" type="submit">' +
			'<input type="hidden" name="daddr" value="'+latitude+','+longitude+'"/>'+
		'</form>' +
	'</div>';
	marker.openInfoWindowHtml(formulaire_itineraire);
	
	});
	return marker;
}
