	var map_mtl;
	var directionsPanel_mtl;
	var directions_mtl;
	$(document).ready(function() {	
		load_map($("#intAdrMtl").html()+" "+$("#intVilleMtl").html()+" "+$("#intCpMtl").html() , "map_mtl_interne");

		$("#frm_directions_mtl").submit(function(){
				getDirections($("#f_code_postal_mtl").val(), $("#intCpMtl").html());
				return false;
		});
	});

	function getDirections(from, to){
		dirString = "from: "+from+" to: "+to;
		directions_mtl.load(dirString);
	}

	function onGDirectionsLoad(){
		$("#directions_mtl").show();
		map_mtl.setMapType(G_NORMAL_MAP);
		return true;
	}

	function onGDirectionsError(){
		$("#directions_mtl").show();
	}

	function onGDirectionsLoaded() {
		// return true;
	}

	function load_map(address, id) {
	    if (GBrowserIsCompatible()) {
	        map_mtl = new GMap2(document.getElementById(id));

	        var geocoder = new GClientGeocoder();
	        var cadPoint = geocoder.getLatLng(
	          address,
	          function(point) {
	            if (point) {
	              map_mtl.setCenter(point, 15);
	              marker = new GMarker(point);
	              map_mtl.addOverlay(marker);

				  directionsPanel_mtl = document.getElementById("directions_mtl");
				  directions_mtl = new GDirections(map_mtl, directionsPanel_mtl);

				  GEvent.addListener(directions_mtl, "load", onGDirectionsLoad);
	              GEvent.addListener(marker, "click", function() {
	                window.open('http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q='+address+'&sll='+point['x']+','+point['y']+'&sspn=0.0097,0.019011&ie=UTF8&hq=&hnear='+address+'&t=h&z=16');
	              });

	            }
	          });
	        //map_mtl.hideControls();
	    }
	}
