How to set position of google maps infowindow

Discussion in 'PHP' started by tygas, May 31, 2011.

  1. #1
    The web is on http://esmd.info/index.php?file=MAP


    Ant the source with window:

    
    
      
       // On page load, call this function
       function load()
       {
          // Create new map object
        map = new GMap2(document.getElementById("map"));  
     
    	   // Set map center location	  
    	  map.setCenter(new GLatLng(63.13450320833446,16.69921875), 3);
    	  
    	   // Add Map Controls
           map.addControl(new GSmallMapControl());
           map.addControl(new GMapTypeControl());
    	   
          // Create new geocoding object
          geocoder = new GClientGeocoder();
           var bounds = new google.maps.LatLngBounds();
    	  
      	  // Download the data in data.xml and load it on the map.
    //	   GDownloadUrl("http://esmd.info/index.php?file=map&MAP", function(data) {
          
    
         GDownloadUrl(  "data.php", function(data) {
              xml = GXml.parse(data);
              markers = xml.documentElement.getElementsByTagName("marker");
              name = [];  
              for (var i = 0; i < markers.length; i++) {
                address = markers[i].getAttribute("address");
                name[address]  = markers[i].getAttribute("name");
                var uid = markers[i].getAttribute("uid");
                      
                markerId = "id_"+i;
                
    //            vardas  = "<div id="+markerId+">"+name+"</div>";
                 
                geocoder.getLocations(address, addToMap);
                
                   
                var point = new google.maps.LatLng(
                parseFloat(markers[i].getAttribute("lat")),
                parseFloat(markers[i].getAttribute("lng")));
                       
               }
            });   
       }
         
      
       function addToMap(response )
       {
                  
          // Retrieve the object
          
          place = response.Placemark[0];
    
          // Retrieve the latitude and longitude
          point = new GLatLng(place.Point.coordinates[1],
                              place.Point.coordinates[0]);
     
       
          marker = new GMarker(   point    );
          GEvent.addListener(marker, "click", function() {
      
          marker.openInfoWindowHtml(   name[response.name] +' ' +  response.name );
          
           
          });
         
          map.addOverlay(marker);
       
      
       }
    
    
    Code (markup):
     
    tygas, May 31, 2011 IP