google.load("maps", "2.x");

$(document).ready(function initialize() {

    var myHtml = "<address><img src='"+webUrl+"images/logo-kryzalid-google-map.png' alt='Kryzalid communication' /><br>6750, av. de L'Esplanade , bureau 290,<br />Montréal , Qc<br />H2V 4M1<br />514.278.5050</address>";

   if (GBrowserIsCompatible()) {
		// Création de l'objet GMap2
		var map = new GMap2(document.getElementById("googleMap"));

		// Création d'un point, selon les coordonnées
		var point = new GLatLng(45.529858,-73.6158712);

                //STREETVIEW http://code.google.com/intl/fr/apis/maps/documentation/services.html#Streetview
                myPOV = {yaw:180.64659986187695,pitch:-5};
                panoramaOptions = { latlng:point, pov:myPOV};
                var myPano = new GStreetviewPanorama(document.getElementById("kryzStreetView"), panoramaOptions);
                //FIN STREETVIEW

		// On détermine le centre de départ, selon le point (coordonnées) et le zoom
		map.setCenter(point, 15);

		// Controles principaux
		map.addControl(new GLargeMapControl()); // Affiche les controles de déplacement/zoom
		map.addControl(new GOverviewMapControl()); // Affiche la petite carte d'overview, en bas à droite

		// Autres controles
		//map.addControl(new GMapTypeControl()); // Changer le type de carte: carte/satellite/mixte
		//map.addControl(new GScaleControl()); // Affiche l'échelle

		// Création d'un marqueur
                var myIcon = new GIcon(G_DEFAULT_ICON);
                //myIcon.image = "images/marker.png";


                //myIcon.image = webUrl+"images/marker.png";



		/*myIcon.iconSize = new GSize(22, 31);
                myIcon.shadow = "my_custom_icon_shadow.png";
                myIcon.shadowSize = new GSize(42, 31);
                myIcon.iconAnchor = new GPoint(10, 29);
                myIcon.infoWindowAnchor = new GPoint(10, 14);
                myIcon.printImage = "my_custom_icon_print.gif";
                myIcon.mozPrintImage = "my_custom_icon_mozPrint.gif";
                myIcon.printShadow = "my_custom_icon_printShadow.gif";
                myIcon.transparent = "my_custom_icon_transparent.png";
                myIcon.imageMap = [ 10,29, 1,16, 0,5, 5,0, 12,4, 18,2, 21,12, 21,16 ]; */

                var markerOptions = { icon:myIcon };

   		marker = new GMarker(point, markerOptions);
		map.addOverlay(marker);

		// Création d'une info-bulle
		//marker.openInfoWindowHtml(myHtml); // OU
		//map.openInfoWindowHtml(point, myHtml);
		// Création d'un événement CLICK sur le marqueur
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml(myHtml);
	  	});

                GEvent.addListener(map, "tilesloaded", function() {
                	$("div[dir='ltr'] span").hide(); //pour enlever un bout de la legende
        	});
		//
		geocoder = new GClientGeocoder();
   }

});

