// Google Maps Javascript

// KEY: ABQIAAAAbzhOyZ_FALKgIXenT46qHBS9s_f-PclpQ7Xcs0JSBQrvlraDdBTaGgTSvOcLVzgbRN6JP5FkWe5ztQ
// Longitude / Latitude finder: http://mapki.com/getLonLat.php
// GMaps Tutorial: http://kbups.org/pub/38/7/1/3/utilisation-de-google-maps-afficher-des-marqueurs/

//<![CDATA[

    function load() {
		
      if (GBrowserIsCompatible()) {
		/* Affichage de la carte dans la "div" */
        var map = new GMap2(document.getElementById("map"));

/*****************************************************************************************************/
/*									Positionnement des points										 */
/*****************************************************************************************************/

		/* Adare House */
		var point = new GLatLng(44.848668,-0.580635);
		/* Gd Theatre */
		var point2 = new GLatLng(44.84240551150019, -0.5742287635803223);
		/* Chartrons */
		var point3 = new GLatLng(44.85028610500659, -0.5698299407958984);
		/* Quinconces */
		var point4 = new GLatLng(44.845341843202355, -0.5732202529907227);
		/* Place de la Bourse */
		var point5 = new GLatLng(44.84140134300145, -0.5701303482055664);
		/* Jardin Public */
		var point6 = new GLatLng(44.84928207387408, -0.5789387226104736);

/*****************************************************************************************************/
/*								Position et contrôles de la carte									 */
/*****************************************************************************************************/

		/* Centre la carte aux coordonnées indiquées et réalise un zoom de niveau 14 */
		map.setCenter(point, 14);
		/* Control déplacement */
        map.addControl(new GLargeMapControl());
		/* Control type de carte (normale, satellite, mixte) */
		map.addControl(new GMapTypeControl());
		/* Control du zoom */
		map.addControl(new GScaleControl());

/*****************************************************************************************************/
/*							Fonction Positionnement et affichage info								 */
/*****************************************************************************************************/

		/* Fonction qui à partir d'une adresse va déterminer le point géographique */
		function createInfoMarker(point, text) {
			/* Création d'un marqueur */
			var marker = new GMarker(point);
			/* Afficher le marqueur */
			map.addOverlay(marker);
			
			/* Lorsque le marqueur est cliqué, on ouvre l'info-bulle */
			GEvent.addListener(marker, "click", function() {
				marker.openInfoWindowHtml(text);
			});
		}
		
/*****************************************************************************************************/
/*										Création des points											 */
/*****************************************************************************************************/
		
		var house = new GMarker(point);
		map.addOverlay(house);
		house.openInfoWindowHtml('<div style="text-align:center; width:250px; height:105px;"><strong>ADARE HOUSE</strong><br /><br /><img src="images/gmaps/adare-house.png" alt="Adare House" /></div>');

		createInfoMarker(point, '<div style="text-align:center; width:250px; height:105px;"><strong>ADARE HOUSE</strong><br /><br /><img src="images/gmaps/adare-house.png" alt="Adare House" /></div>');
		createInfoMarker(point2, '<div style="text-align:center; width:250px; height:105px;">Grand Théatre<br /><br /><img src="images/gmaps/grand-theatre.png" alt="Grand Théatre" /></div>');
		createInfoMarker(point3, '<div style="text-align:center; width:250px; height:105px;">Quais des Chartrons<br /><br /><img src="images/gmaps/quais-bordeaux.png" alt="Quais des Chartrons" /></div>');
		createInfoMarker(point4, '<div style="text-align:center; height:105px;">Quinconces<br /><br /><img src="images/gmaps/quinconces.png" alt="Quinconces" /></div>');
		createInfoMarker(point5, '<div style="text-align:center; width:250px; height:105px;">Place de la Bourse<br /><br /><img src="images/gmaps/place-de-la-bourse.png" alt="Place de la Bourse" /></div>');
		createInfoMarker(point6, '<div style="text-align:center;"><br />Jardin Public</div>');

/*****************************************************************************************************/
/*										Création des liaisons										 */
/*****************************************************************************************************/

		/* Liaison Gd Theatre */
		var line_gdtheatre = new GPolyline([
		new GLatLng(44.848668,-0.580635),
		new GLatLng(44.84240551150019, -0.5742287635803223)
		], "#FF6600", 2, 1);
		map.addOverlay(line_gdtheatre);

		/* Liaison Chartrons */
		var line_chartrons = new GPolyline([
		new GLatLng(44.848668,-0.580635),
		new GLatLng(44.85028610500659, -0.5698299407958984)
		], "#FF6600", 2, 1);
		map.addOverlay(line_chartrons);

		/* Liaison Quinconces */
		var line_quinconces = new GPolyline([
		new GLatLng(44.848668,-0.580635),
		new GLatLng(44.845341843202355, -0.5732202529907227)
		], "#FF6600", 2, 1);
		map.addOverlay(line_quinconces);

		/* Liaison Bourse */
		var line_bourse = new GPolyline([
		new GLatLng(44.848668,-0.580635),
		new GLatLng(44.84140134300145, -0.5701303482055664)
		], "#FF6600", 2, 1);
		map.addOverlay(line_bourse);

		/* Liaison Jardin Public */
		var line_jardin = new GPolyline([
		new GLatLng(44.848668,-0.580635),
		new GLatLng(44.84928207387408, -0.5789387226104736)
		], "#FF6600", 2, 1);
		map.addOverlay(line_jardin);


      }
    }

    //]]>