﻿function initialize() {
    if (GBrowserIsCompatible()) 
    {
        var map = new GMap2(document.getElementById("map"));

        map.addControl(new GSmallMapControl());
        //---harita uydu menüsü için
        map.addControl(new GMapTypeControl());
        
        var center = new GLatLng(document.forms[0].txtLatitude.value, document.forms[0].txtLongitude.value);
        map.setCenter(center, 10);
        var marker = new GMarker(center, { draggable: true });
        GEvent.addListener(marker, "dragstart",
                              function() {
                                  marker.openInfoWindowHtml("Doğduğum yer burası mı ?<br> beni doğduğum yere götür !");
                              });
        GEvent.addListener(marker, "dragend",
                    function() {
                         marker.openInfoWindowHtml("This is <br>My birth place");
                        var latlng = marker.getLatLng();
                        document.forms[0].txtLatitude.value = latlng.lat().toFixed(2);
                        document.forms[0].txtLongitude.value = (latlng.lng()).toFixed(2);
                    });

        GEvent.addListener(map, "moveend", function() {
            var bounds = map.getBounds();
            var southWest = bounds.getSouthWest();
            var northEast = bounds.getNorthEast();
            //                     document.forms[0].SouthWest.value = southWest.x ;
            //                     document.forms[0].NorthEast.value = northEast.x ;
        });
        map.addOverlay(marker);

        
        // The new marker "mouseover" listener
        //                 GEvent.addListener(marker, "mouseover", function()
        //                   {
        //                       marker.openInfoWindowHtml("Doğduğum yer burası mı ?<br> beni doğduğum yere götür !");
        //                    });              
    }
}
  
