	var map_tr;
	var directionsPanel_tr;
	var directions_tr;
	$(document).ready(function() {	
		load_map($("#intAdrTr").html()+" "+$("#intVilleTr").html()+" "+$("#intCpTr").html() , "map_tr_interne");

		$("#frm_directions_tr").submit(function(){
				getDirections($("#f_code_postal_tr").val(), $("#intAdrTr").html()+" "+$("#intVilleTr").html()+" "+$("#intCpTr").html());
				return false;
		});
		
		if($.browser.msie)
		{
			$("#cliquer_image").hide();
			$("a.lien_ie").show();
		}
	});

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

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

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

	function onGDirectionsLoaded() {
		// return true;
	}

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

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

				  directionsPanel_tr = document.getElementById("directions_tr");
				  directions_tr = new GDirections(map_tr, directionsPanel_tr);

				  GEvent.addListener(directions_tr, "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_tr.hideControls();
	    }
	}
