	
		

    
    var map;
    var adres1;
    var address1;
    var loaded = 0;

	function addAddressToMap(response) {
      map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("Nie odnaleziono adresu");
      } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
		
	    
        marker = new GMarker(point);
        map.addOverlay(marker);
        map.setZoom(15);
		marker.setImage('/upload_module/wysiwyg/ikony/pok-ikona.png');
        marker.openInfoWindowHtml(adres1);
      }
    }

    function load() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(52.13, 21.00), 7);
        geocoder = new GClientGeocoder();
        
        loaded = 1;
      }
    }

    function setAddress(street, city, name, id) {
    	document.getElementById("maps").style.display='block';
      if (!loaded) load();
      adres1 = "<b>" + name + "</b>" + "<br />" + street + "<br />" + city;
      address1 = street + ", " + city + ", Poland";
      geocoder.getLocations(address1, addAddressToMap);
      document.getElementById("city_g").value = city;
      document.getElementById("street").value = "";
      document.getElementById("mapa").style.visibility='visible';
      var v=document.getElementById("tabela"+id).offsetTop-document.getElementById("punkt-podparcia").offsetTop-78;
      document.getElementById("mapa").style.marginTop=v+"px";
      
    }


    function start() {
	  var from = document.getElementById("street").value + ", " + document.getElementById("city_g").value + ", Poland";
	  directionsPanel = document.getElementById("route");
	  directions = new GDirections(map);
	  directions.load("from: "+from+" to: "+address1 , {travelMode:G_TRAVEL_MODE_DRIVING});
    }
		