	var map;
    var geocoder;
    var marker;
    var gmapFlag = 1;
    
    function initialize_set() {
    	var address = '';
    	if(document.getElementById('country_title'))
    		address = document.getElementById('country_title').value;
    	if(document.getElementById('not_settleOther').value!='' && document.getElementById('not_settleOther').value!='Город')
	    	address+= ', ' + document.getElementById('not_settleOther').value;
    	//var address = 'Украина, Киев';	
    	//alert(address);
    	
      var startLat = 50.441;
      var startLng = 30.5272;
      //if(document.getElementById('not_zoom').value)
      		//var startZoomLevel = document.getElementById('not_zoom').value;
      //else 	
      		var startZoomLevel = 9;
      //var zoom = 6;
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"),
  		{ size: new GSize(600,400) } );
        geocoder = new GClientGeocoder();
        
        map.setCenter(new GLatLng(startLat, startLng), startZoomLevel);
        marker = new GMarker(new GLatLng(startLat, startLng), {draggable: true});
       	map.addOverlay(marker);
       if (geocoder) {
        	geocoder.getLatLng(
        		address,
        		function(point) {
        			if (!point) {
         				alert("Адрес " + address + " не найден");
              			map.setCenter(new GLatLng(startLat, startLng), startZoomLevel);
        				//marker = new GMarker(new GLatLng(startLat, startLng), {draggable: true});
       					//map.addOverlay(marker);
            		} else {	//alert(startZoomLevel);
              			map.setCenter(point, 7);
              			//marker = new GMarker(point, {draggable: true});	alert(213);
              			//map.addOverlay(marker);
              			marker.setLatLng(point);
              			document.getElementById('not_coord').value = point.toUrlValue(4);
              			document.getElementById('not_zoom').value = map.getZoom();
            		}
          		}
        	);
       	} else {
        	map.setCenter(new GLatLng(startLat, startLng), startZoomLevel);
        	//marker = new GMarker(new GLatLng(startLat, startLng), {draggable: true});
       		//map.addOverlay(marker);
       	}
        //map.setUIToDefault();
        map.enableScrollWheelZoom();
        GEvent.addListener(map, "zoomend", function(oldZoom, newZoom) {
    		document.getElementById('not_zoom').value = newZoom;
  		});
        GEvent.addListener(map, "click", function(overlay,latlng) {
          if (latlng) {
            //var myHtml = 'Широта: ' + latlng.lat() + '<br>' + 'Долгота: ' + latlng.lng() + '<br>' + 'Масштаб: ' + map.getZoom();
            //map.openInfoWindow(latlng, myHtml);
            marker.setLatLng(latlng);
            map.addOverlay(marker);
            document.getElementById('not_coord').value = latlng.toUrlValue(4);
            document.getElementById('not_zoom').value = map.getZoom();
          }
        });
        GEvent.addListener(marker, "dragstart", function() {
          //map.closeInfoWindow();
        });
        GEvent.addListener(marker, "dragend", function() {
          document.getElementById('not_zoom').value = map.getZoom();
          document.getElementById('not_coord').value = marker.getLatLng().toUrlValue(4);
          //marker.openInfoWindowHtml("Zoom: " + map.getZoom() + "<br> Coord: " + marker.getLatLng().toUrlValue(4));
        });
        //map.addControl(new GSmallMapControl());
        //map.addControl(new GMapTypeControl());
        map.addControl(new GLargeMapControl());
      }
    }
    
    function resetLatLng() {
    	document.getElementById('not_coord').value = '';
        document.getElementById('not_zoom').value = 0;
        document.getElementById('map_canvas').style.height = '0px';
        document.getElementById('map_canvas').innerHTML = '';
    }
    
