  var geo;
  var mapa;
		 
	function skoczDoAdresu(adres){
			if(!geo) return;
			geo.getLatLng(adres,function(punkt){
				if (!punkt)alert(adres + " nie został znaleziony!"); 
				else
				{ 
					// centrujemy na znalezionym punkcie
					mapa.panTo(punkt);
					document.getElementById("wspolrzedne").value=punkt; 

					// czyścimy markery z mapy
					mapa.clearOverlays();
					
					// dodajemy w tym miejscu marker
					var ikona = new GIcon();
					ikona.image='http://maps.google.com/mapfiles/kml/pal3/icon52.png';
					ikona.shadow='';
					ikona.iconSize=new GSize(32,32);
					ikona.iconAnchor=new GPoint(16,16);
					ikona.infoWindowAnchor=new GPoint(16,16);
					
					var marker = new GMarker(punkt,{icon: ikona, title: adres});
					mapa.addOverlay(marker);
					
					// i otwieramy dymek z adresem
					marker.openInfoWindowHtml('<strong>Wyszukana lokalizacja </strong><br />'+adres);
				}
			});
		}

		function mapaStart(x,y,tytul){
			if(GBrowserIsCompatible()) {
				mapa = new GMap2(document.getElementById("mapka"),{mapTypes: [G_NORMAL_MAP,G_SATELLITE_MAP,G_HYBRID_MAP]});
        if(x=='' || y=='')mapa.setCenter(new GLatLng(51.7596459, 19.4750652), 13);
				else {
          var wspolrzedne = new GLatLng(x, y);
          mapa.setCenter(wspolrzedne, 13);
          var marker = new GMarker(wspolrzedne,{title: tytul, clickable: false});
          mapa.addOverlay(marker);
				}
        // kontrolki mapy
				mapa.addControl(new GLargeMapControl());
				var typyMapy = mapa.getMapTypes();    
				typyMapy[0].getName= function() { return "Mapa";}
				typyMapy[1].getName = function() { return "Satelita";}
				typyMapy[2].getName = function() { return "Hybryda";}
				mapa.addControl(new GMapTypeControl());
				//mapa.addControl(new GOverviewMapControl()); 
				//mapa.addControl(new GScaleControl());
				
				// nowy obiekt do geokodowania
			  geo = new GClientGeocoder();
			}
		}
		
		function ukryjmape(idrekord){
		
		  	var div = "mapka_mini_"+idrekord;
		  	var div_1 = "pokazmape_"+idrekord;
		  	var div_2 = "ukryjmape_"+idrekord;
		    
		    if (navigator.appName=="Microsoft Internet Explorer") { 
              document.all[div].style.visibility = 'hidden';
              document.all[div].style.display = 'none';
              document.all[div_1].style.visibility = 'visible';
              document.all[div_1].style.display = 'block';
              document.all[div_2].style.visibility = 'hidden';
              document.all[div_2].style.display = 'none';
        }
        else { 
              document.getElementById(div).style.visibility = 'hidden';
              document.getElementById(div).style.display = 'none';
              document.getElementById(div_1).style.visibility = 'visible';
              document.getElementById(div_1).style.display = 'block';
              document.getElementById(div_2).style.visibility = 'hidden';
              document.getElementById(div_2).style.display = 'none';
        }
		
		}
		
		function mapaMiniStart(idrekord,x,y,tytul){
		
		    var div = "mapka_mini_"+idrekord;
		    var div_1 = "pokazmape_"+idrekord;
		    var div_2 = "ukryjmape_"+idrekord;
		    
		    if (navigator.appName=="Microsoft Internet Explorer") { 
              document.all[div].style.visibility = 'visible';
              document.all[div].style.display = 'block';
              document.all[div_1].style.visibility = 'hidden';
              document.all[div_1].style.display = 'none';
              document.all[div_2].style.visibility = 'visible';
              document.all[div_2].style.display = 'block';
        }
        else { 
              document.getElementById(div).style.visibility = 'visible';
              document.getElementById(div).style.display = 'block';
              document.getElementById(div_1).style.visibility = 'hidden';
              document.getElementById(div_1).style.display = 'none';
              document.getElementById(div_2).style.visibility = 'visible';
              document.getElementById(div_2).style.display = 'block';
        }
		
		
			if(GBrowserIsCompatible()) {
				mapa = new GMap2(document.getElementById(div),'');
        if(x=='' || y=='')mapa.setCenter(new GLatLng(51.7596459, 19.4750652), 13);
				else {
          var wspolrzedne = new GLatLng(x, y);
          mapa.setCenter(wspolrzedne, 13);
          var marker = new GMarker(wspolrzedne,{title: tytul, clickable: false});
          mapa.addOverlay(marker); 
				}
        // kontrolki mapy
				mapa.addControl(new GLargeMapControl());
				//mapa.addControl(new GScaleControl());				
			}
		}
		
