var map;
// logi wersja
var pointPL; 
var markerPL; 
var pointUS; 
var markerUS; 

function addEvent(obj, type, fn)
{
  if (obj.addEventListener) { obj.addEventListener(type, fn, false); }
  else if (obj.attachEvent) { obj["e"+type+fn] = fn; obj[type+fn] = function(){obj["e"+type+fn](window.event);}; obj.attachEvent("on"+type, obj[type+fn]); }
}

function getInfoPL(address_link)
{
	var infoPL='<div class="gInfo"><img src="/images/'+logo+'" alt="Ostrowski-biz.pl" /><br /><a target="lokalizacja" href="'+address_link+'">Powiększ (w nowym oknie)</a></div>';
	return infoPL;
}

function load()
{
    if (GBrowserIsCompatible())
    {
		map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());

        var geocoder = new GClientGeocoder();
        
        // place the map at the center of the United States at a low
        // zoom level, so you can see the entire country
         geocoder.getLatLng(address, function(pointPL)
          {
            map.setCenter(pointPL, 14);
            
            markerPL = new GMarker(pointPL);
        
            GEvent.addListener(markerPL, "click", function() {
              markerPL.openInfoWindowHtml(getInfoPL(address_link));
            });
            map.addOverlay(markerPL);
            
            markerPL.openInfoWindowHtml(getInfoPL(address_link));
          });

	}
}

function showGooglePL()
{
    var geocoder = new GClientGeocoder();
    
    // place the map at the center of the United States at a low
    // zoom level, so you can see the entire country
     geocoder.getLatLng(address, function(point)
      {
        map.setCenter(point, 14);
        markerPL.openInfoWindowHtml(getInfoPL(address_link));
      });
}

addEvent(window,"load",load);
addEvent(window,"unload",GUnload);
