

// Kezdő koordináták:
var start_x = 47.685799;
var start_y = 19.280887;
var defzoom = 15;

// teszt bubor?k
var message = "<b>Leho Lapszabászat</b><br />Lehoczki Csaba<br>2162 Őrbottyán, Rákóczi út 120.";

// gombok URL
var usedefault = true; //használja e a beépített gombokat, ha true, akkor nem ''-val töltsék fel a köv. sorokat!
/*var uparrow = 'images/arrow_up.png';
var downarrow = 'images/arrow_down.png';
var leftarrow = 'images/arrow_left.png';
var rightarrow = 'images/arrow_right.png';
var zoomin = 'images/zoom_in.png';
var zoomout = 'images/zoom_out.png';
var centerbutt = 'images/arrow_center.png';*/
var uparrow = ''; 
var downarrow = ''; 
var leftarrow =  ''; 
var rightarrow = ''; 
var zoomin = '';
var zoomout = '';
var centerbutt = '';


function load() {

  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    map.setCenter(new GLatLng(start_x, start_y), defzoom); // ((x,y),zoom level)
    map.setMapType(G_NORMAL_MAP);
    
       // ---- Sz?vegbubor?k ---- 
        //map.openInfoWindow(map.getCenter(), document.createTextNode("Hello, world"));
        
        // ************************************************************************
        
        // ---- Koordin?ta kiir?s ----
    /*GEvent.addListener(map, "moveend", function() {
      var center = map.getCenter();
      document.getElementById("message").innerHTML = center.toString();
      });*/
        
        //*************************************************************************
        

    // F?ggv?ny ami mutat?t tesz a megadott helyre, a mutat?ra kattintva elt?nik/el?j?n a bubor?k
        /*function createMarker(point, title, address) {
          var marker = new GMarker(point);
          marker.value = title;
          GEvent.addListener(marker,"click", function() {
            var myHtml = "<b>"+ title + "</b><br/>" + address;
            map.openInfoWindowHtml(point, myHtml);
          });
          return marker;
        }*/
        
       
       
       
       
        var baseIcon = new GIcon();
        baseIcon.shadow = "images/bubble_shad.png";
        baseIcon.iconSize = new GSize(40, 42);
        baseIcon.shadowSize = new GSize(45, 50);
        baseIcon.iconAnchor = new GPoint(9, 34);
        baseIcon.infoWindowAnchor = new GPoint(9, 2);
        baseIcon.infoShadowAnchor = new GPoint(18, 25);

        // Creates a marker whose info window displays the letter corresponding
        // to the given index.
        function createMarker(point, index) {
          // Create a lettered icon for this point using our icon class
          var letter = String.fromCharCode("A".charCodeAt(0) + index);
          var letteredIcon = new GIcon(baseIcon);
          letteredIcon.image = "images/bubble.png";

          // Set up our GMarkerOptions object
          markerOptions = { icon:letteredIcon };
          var marker = new GMarker(point, markerOptions);

          GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml("<font color='black'>"+message+"</font>");
          });
          return marker;
        }
        
        point = new GLatLng(start_x, start_y);
        map.addOverlay(createMarker(point,1));
       
       
       
       
       
            
        //******************************************************************************
        
        // ---- Zoom, meg a t?bbi :D ----
        
        var posiTion = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10,10));
        /* ez a pozicion?l?! : - mihez k?pest? -> ( G_ANCHOR_TOP_RIGHT, 
                                                    G_ANCHOR_TOP_LEFT, 
                                                    G_ANCHOR_BOTTOM_RIGHT, 
                                                    G_ANCHOR_BOTTOM_LEFT) ->?rtelemszer?en
                                - ennyivel -> GSize (x,y) */
 
        //map.addControl(new GLargeMapControl(),posiTion); // zoom, [opt poz?ci?ja] ... alap?rtelmez?sben a bal fels?
       
        
        
        /*function TextualZoomControl() {
            
        TextualZoomControl.prototype = new GControl();

        TextualZoomControl.prototype.initialize = function(map) {
          var container = document.createElement("div"); 
          
           var panUpDiv = document.createElement("div");
          this.setButtonStyle_(panUpDiv);
          container.appendChild(panUpDiv);
          panUpDiv.style.backgroundImage = "url('"+uparrow+"')";
          panUpDiv.appendChild(document.createTextNode(" "));
          GEvent.addDomListener(panUpDiv, "click", function() {
            map.panDirection(0,1);
          });
          
          var panLeftDiv = document.createElement("div");
          this.setButtonStyle_(panLeftDiv);
          container.appendChild(panLeftDiv);
          panLeftDiv.style.backgroundImage = "url('"+leftarrow+"')";
          panLeftDiv.style.position = 'relative';
          panLeftDiv.style.left = '-18';
          panLeftDiv.appendChild(document.createTextNode(" "));
          GEvent.addDomListener(panLeftDiv, "click", function() {
            map.panDirection(1,0);
          });
          
          var panRightDiv = document.createElement("div");
          this.setButtonStyle_(panRightDiv);
          container.appendChild(panRightDiv);
          panRightDiv.style.backgroundImage = "url('"+rightarrow+"')";
          panRightDiv.style.position = 'relative';
          panRightDiv.style.left = '18';
          panRightDiv.style.top = '-19.5';
          panRightDiv.appendChild(document.createTextNode(""));
          GEvent.addDomListener(panRightDiv, "click", function() {
            map.panDirection(-1,0);
          });
          
          var panDownDiv = document.createElement("div");
          this.setButtonStyle_(panDownDiv);
          container.appendChild(panDownDiv);
          panDownDiv.style.backgroundImage = "url('"+downarrow+"')";
          panDownDiv.style.position = 'relative';
          panDownDiv.style.top = '-19.5';
          panDownDiv.appendChild(document.createTextNode(""));
          GEvent.addDomListener(panDownDiv, "click", function() {
            map.panDirection(0,-1);
          });
          var centerpoint = new GLatLng(start_x, start_y);
          var panCenterDiv = document.createElement("div");
          this.setButtonStyle_(panCenterDiv);
          container.appendChild(panCenterDiv);
          panCenterDiv.style.backgroundImage = "url('"+centerbutt+"')";
          panCenterDiv.style.position = 'relative';
          panCenterDiv.style.top = '-58.5';
          panCenterDiv.appendChild(document.createTextNode(""));
          GEvent.addDomListener(panCenterDiv, "click", function() {
            map.panTo(centerpoint);
          });
          
          var zoomInDiv = document.createElement("div");
          this.setButtonStyle_(zoomInDiv);
          container.appendChild(zoomInDiv);
          zoomInDiv.style.backgroundImage = "url('"+zoomin+"')";
          zoomInDiv.style.position = 'relative';
          zoomInDiv.style.top = '-39';
          zoomInDiv.appendChild(document.createTextNode(""));
          GEvent.addDomListener(zoomInDiv, "click", function() {
            map.zoomIn();
          });
    
          var zoomOutDiv = document.createElement("div");
          this.setButtonStyle_(zoomOutDiv);
          container.appendChild(zoomOutDiv);
          zoomOutDiv.style.backgroundImage = "url('"+zoomout+"')";
          zoomOutDiv.style.position = 'relative';
          zoomOutDiv.style.top = '-39';
          zoomOutDiv.appendChild(document.createTextNode(""));
          GEvent.addDomListener(zoomOutDiv, "click", function() {
            map.zoomOut();
          });
          
          map.getContainer().appendChild(container);
          return container;
          }
        
        TextualZoomControl.prototype.getDefaultPosition = function() {
              return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(20, 5));
            }
        
        TextualZoomControl.prototype.setButtonStyle_ = function(button) {
              button.style.textDecoration = "none";
              button.style.color = "#ffffff";
              button.style.height = "13px";
              button.style.width = "13px";
              button.style.font = "Arial";
              button.style.border = "0px";
              button.style.padding = "2px";
              button.style.marginBottom = "3px";
              button.style.textAlign = "center";
              button.style.cursor = "pointer";
           }  */
        
        
        
        if (usedefault) map.addControl(new GSmallMapControl()); else map.addControl(new TextualZoomControl());
        
        map.addControl(new GMapTypeControl()); // n?zet (Map,Satellite,Hybrid)
        
        // kiirja a kattint?s hely?nek inf?it
        /*GEvent.addListener(map,"click", function(overlay,point) {     
          var myHtml = "The GPoint value is: " + map.fromLatLngToDivPixel(point) + " at zoom level " + map.getZoom();
          map.openInfoWindow(point, myHtml);
        });*/
        
        //********************************************************************************
        // ide j?nne egy sz?ml?l?, ami a t?rk?pre kettint?st sz?molja, csak nagyon ?t k?ne
        // vari?lni az eg?szet hozz? ez?rt csak megjegyzem, hogy ez is megoldhat?!
        //********************************************************************************
           
        
        
        function TextOut() {
            }
        TextOut.prototype = new GOverlay();

        TextOut.prototype.initialize = function(map) {
          var cont = document.createElement("div");
          
           var textDiv = document.createElement("div");
          this.setButtonStyle2_(textDiv);
          cont.appendChild(textDiv);
          textDiv.appendChild(document.createTextNode("blaaablabalacd"));
          
          map.getContainer().appendChild(cont);
          return cont;
          }
        
        TextOut.prototype.setButtonStyle2_ = function(button) {
              button.style.color = "#ffffff";
              button.style.height = "13px";
              button.style.width = "13px";
              button.style.backroundColor = '#ffffff';
              button.style.font = "Arial";
              button.style.border = "0";
              button.style.padding = "2px";
              button.style.marginBottom = "3px";
              button.style.textAlign = "center";
              button.style.cursor = "pointer";
           }
        
        
        
        map.addControl(new TextualZoomControl());
        
            
      }
    }
