
/* Google mapa */


// A TextualACViewsControl is a GControl that displays textual "Widok 1"
// and "Widok 2" buttons (as opposed to the iconic buttons used in
// Google Maps).
function TextualACViewsControl() {
}

TextualACViewsControl.prototype = new GControl();

// Creates a one DIV for each of the buttons and places them in a container
// DIV which is returned as our control element. We add the control to
// to the map container and return the element for the map class to
// position properly.
TextualACViewsControl.prototype.initialize = function(map) {
  var container = document.createElement("div");

  var view1Div = document.createElement("div");
  view1Div.style.position = "absolute";
  view1Div.style.top = "0";
  view1Div.style.left = "0";
  this.setButtonStyle_(view1Div);
  container.appendChild(view1Div);
  view1Div.appendChild(document.createTextNode("Zoom x7"));
  GEvent.addDomListener(view1Div, "click", function() {
    map.setMapType(G_NORMAL_MAP);
    map.setCenter(new GLatLng(53.911031, 18.344500), 7);
  });

  var view2Div = document.createElement("div");
  view2Div.style.position = "absolute";
  view2Div.style.top = "0";
  view2Div.style.left = "7em";
  this.setButtonStyle_(view2Div);
  container.appendChild(view2Div);
  view2Div.appendChild(document.createTextNode("Zoom x9"));
  GEvent.addDomListener(view2Div, "click", function() {
    map.setMapType(G_NORMAL_MAP);
    map.setCenter(new GLatLng(53.911031, 18.344500), 9);
  });

  var view3Div = document.createElement("div");
  view3Div.style.position = "absolute";
  view3Div.style.top = "0";
  view3Div.style.left = "14em";
  this.setButtonStyle_(view3Div);
  container.appendChild(view3Div);
  view3Div.appendChild(document.createTextNode("Zoom x12"));
  GEvent.addDomListener(view3Div, "click", function() {
    map.setMapType(G_NORMAL_MAP);
    map.setCenter(new GLatLng(53.929613, 18.439522), 12);
  });

  var view4Div = document.createElement("div");
  view4Div.style.position = "absolute";
  view4Div.style.top = "0";
  view4Div.style.left = "21em";
  this.setButtonStyle_(view4Div);
  container.appendChild(view4Div);
  view4Div.appendChild(document.createTextNode("Zoom x16"));
  GEvent.addDomListener(view4Div, "click", function() {
    map.setMapType(G_HYBRID_MAP);
    map.setCenter(new GLatLng(53.911031, 18.344500), 16);
  });

  map.getContainer().appendChild(container);
  return container;
}

// By default, the control will appear in the top left corner of the
// map with 7 pixels of padding.
TextualACViewsControl.prototype.getDefaultPosition = function() {
  return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(80, 7));
}

// Sets the proper CSS for the given button element.
TextualACViewsControl.prototype.setButtonStyle_ = function(button) {
  button.style.textDecoration = "underline";
  button.style.color = "#0000ff";
  button.style.backgroundColor = "white";
  button.style.font = "10px Arial, sans-serif, Verdana, Tahoma, Helvetica";
  button.style.border = "1px solid black";
  button.style.padding = "2px";
  button.style.marginBottom = "3px";
  button.style.textAlign = "center";
  button.style.width = "6em";
  button.style.cursor = "pointer";
}


// centrum:    53.929613, 18.439522 lub +53° 55' 46.61", +18° 26' 22.28"
// Bialachowo: 53.911031, 18.344500 lub +53° 54' 39.71", +18° 20' 40.20"
// logo_darek_180x68.jpg 180 x68

// <img src="../baner/logo_darek_180x68.jpg" alt="" title="" width="180" height="68" />
// <img src=\"../baner/logo_darek_180x68.jpg\" alt=\"\" title=\"\" width=\"180\" height=\"68\" />

function mapload() {
  if (GBrowserIsCompatible()) {
    var map1 = new GMap2(document.getElementById("map1"));

    map1.addMapType(G_PHYSICAL_MAP);

    var mt = map1.getMapTypes();

    for (var i=0; i<mt.length; i++) {
      if (mt[i].getName() == 'Hybrid') {
        mt[i].getName = function() { return "Hybrydowa";}
      }
      if (mt[i].getName() == 'Map') {
        mt[i].getName = function() { return "Mapa";}
      }
      if ( (mt[i].getName() == 'Satellite') || (mt[i].getName() == 'Satelita') ){
        mt[i].getName = function() { return "Satelitarna";}
      }
      if ( (mt[i].getName() == 'Terrain') || (mt[i].getName() == 'Teren') ) {
        mt[i].getName = function() { return "Fizyczna";}
      }
    }

    map1.addControl(new GLargeMapControl());
    map1.addControl(new GOverviewMapControl());
    map1.addControl(new GMapTypeControl());
    map1.addControl(new TextualACViewsControl());
    map1.addControl(new GScaleControl());
    map1.enableDoubleClickZoom();
    // map1.setCenter(new GLatLng(53.911031, 18.344500), 7);
    // map1.setMapType(G_NORMAL_MAP);
    map1.setCenter(new GLatLng(53.911031, 18.344500), 16);
    map1.setMapType(G_HYBRID_MAP);

    // Bialachowo
    var point1 = new GLatLng(53.911031, 18.344500);
    var marker1 = new GMarker(point1)
    map1.addOverlay(marker1);

    var tekst1 = "<div class=\"gmapinfo1\" style=\"width:240px; height:180px\"><br><img src=\"../baner/logo_darek_180x68.jpg\" class=\"gmapinfo1\" alt=\"\" title=\"\" width=\"180\" height=\"68\" /><br><br><b>Domki Nad Jeziorem - Białachowo</b><br><br>53&#176; 54&#39; 39.71&#34; N, 18&#176; 20&#39; 40.20&#34; E<br>(53.911031 N, 18.344500 E)<br></div>";

    GEvent.addListener(marker1, "click", function() {
      marker1.openInfoWindowHtml(tekst1);
    });

    // Marysia
    var point2 = new GLatLng(53.617225, 16.471723);
    var marker2 = new GMarker(point2)
    map1.addOverlay(marker2);

    var tekst2 = "<div class=\"gmapinfo1\" style=\"width:220px; height:225px\"><br><img src=\"../ikony/logo/logo_marysia_180x113.jpg\" class=\"gmapinfo1\" alt=\"\" title=\"\" width=\"180\" height=\"113\" /><br><br><a href=\"http://www.domwakacyjnymarysia.pl/\" target=_blank>Dom Wakacyjny <b>Marysia</b></a><br>Piława<br>53&#176; 37&#39; 2.01&#34; N, 16&#176; 28&#39; 18.20&#34; E<br>(53.617225 N, 16.471723 E)<br></div>";

    GEvent.addListener(marker2, "click", function() {
      marker2.openInfoWindowHtml(tekst2);
    });


    // map1.openInfoWindowHtml(map1.getCenter(), tekst1);
    map1.openInfoWindowHtml(point1, tekst1);
  }
}




