function PLMapTypeControl() {
}
PLMapTypeControl.prototype = new GControl();

PLMapTypeControl.prototype.initialize = function(map) {
  var container = document.createElement("div");

  var normalMapDiv = document.createElement("div");
  this.setButtonStyle_(normalMapDiv);
  container.appendChild(normalMapDiv);
  normalMapDiv.appendChild(document.createTextNode("Mapa"));
  GEvent.addDomListener(normalMapDiv, "click", function() {
    map.setMapType(G_NORMAL_MAP);  
  });

  var satelliteMapDiv = document.createElement("div");
  this.setButtonStyle_(satelliteMapDiv);
  container.appendChild(satelliteMapDiv);
  satelliteMapDiv.appendChild(document.createTextNode("Satelita"));
  GEvent.addDomListener(satelliteMapDiv, "click", function() {
    map.setMapType(G_SATELLITE_MAP);  
  });

  var hybridMapDiv = document.createElement("div");
  this.setButtonStyle_(hybridMapDiv);
  container.appendChild(hybridMapDiv);
  hybridMapDiv.appendChild(document.createTextNode("Hybryda"));
  GEvent.addDomListener(hybridMapDiv, "click", function() {
    map.setMapType(G_HYBRID_MAP);  
  });

  map.getContainer().appendChild(container);
  return container;
}

PLMapTypeControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
}

PLMapTypeControl.prototype.setButtonStyle_ = function(button) {
  button.style.textDecoration = "underline";
  button.style.color = "#0000cc";
  button.style.backgroundColor = "white";
  button.style.font = "small Arial";
  button.style.border = "1px solid black";
  button.style.padding = "2px 10px 2px 10px";
  button.style.marginBottom = "3px";
  button.style.textAlign = "center";
  button.style.width = "6em";
  button.style.cursor = "pointer";
  button.style.display = "inline";  
  button.style.float = "right";    
}

function positionOverview(x,y) {
        var omap=document.getElementById("map_overview");
        omap.style.left = x+"px";
        omap.style.top = y+"px";
}

function init_gmap (dl,sz)
{
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
		  map.addControl(new GLargeMapControl())
		  
		  map.addControl(new PLMapTypeControl());
 		 		  		  
		  var point = new GLatLng(sz, dl)
	  	  var marker = new GMarker(point)
			map.setCenter(new GLatLng(sz,dl), 12, G_SATELLITE_MAP );	  	  					  
			
	  	  map.addOverlay(marker)
	  	  
 		  map.addControl(new GOverviewMapControl(new GSize(100,100)))	  	  
		  var overview = document.getElementById("map_overview");
		  document.getElementById("map").appendChild(overview); 		  
		  setTimeout("positionOverview(400,300)",1);  	  	  
      }
}

function onSatelitaSzukajClick (url)
{
	adres = url+"tekst/"+encodeURI(document.forms.form_miejsc.tekst.value)
	js_cWindow ( adres, "", "resizable,scrollbars", 780, 550 )	
	return false
}

function onSatelitaPokazClick (url)
{
	adres = url+"mst/"+encodeURI(document.forms.form_miejsc.tekst.value)
	self.location.href = adres	
	return false
}

