    var map = null;
    var geocoder = null;


function showGoogleMaps(maps_id, maps_lat, maps_lng, maps_zoom, cur_markers ) {
	if (GBrowserIsCompatible()) {

		if ( (maps_lat==undefined) ||(maps_lng==undefined)) {
			//alert();
			return false;
		}

		if (maps_zoom==undefined)
			maps_zoom = 8;

		map = new GMap2(document.getElementById(maps_id));

		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.addControl(new GScaleControl()) ;
		map.addControl(new GOverviewMapControl()) ;

		map.setCenter(new GLatLng(maps_lat, maps_lng), maps_zoom);

		geocoder = new GClientGeocoder();

		if (cur_markers != undefined) {
			for (i in cur_markers) {
				cur_marker = cur_markers[i];
				var point = new GLatLng(cur_marker[0], cur_marker[1]);
				var marker = createMarker(point, cur_marker[2])
				map.addOverlay(marker);
			}
		}

	//GBrowserIsCompatible()
	}
}


// A function to create the marker and set up the event window
// Dont try to unroll this function. It has to be here for the function closure
// Each instance of the function preserves the contends of a different instance
// of the "marker" and "html" variables which will be needed later when the event triggers.
function createMarker(point,html) {
	var marker = new GMarker(point);
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(html);
	});
	return marker;
}



// addAddressToMap() is called when the geocoder returns an
// answer.  It adds a marker to the map with an open info window
// showing the nicely formatted version of the address and the country code.
function addAddressToMap(response) {
	//map.clearOverlays();
	if (!response || response.Status.code != 200) {
		alert('Адрес «' + address + '» не найден');
	} else {
		place = response.Placemark[0];
		point = new GLatLng(place.Point.coordinates[1],
							place.Point.coordinates[0]);
		map.setCenter(point, 13);
		marker = new GMarker(point);
		map.addOverlay(marker);
		marker.openInfoWindowHtml(place.address// + '<br>' +
			//'<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode);
			);
	}

	$('#image').val(place.Point.coordinates[1] + "," + place.Point.coordinates[0]);
}

// showLocation() is called when you click on the Search button
// in the form.  It geocodes the address entered into the form
// and adds a marker to the map at that location.
function showLocation(loc) {
	var address = loc;
	geocoder.getLocations(address, addAddressToMap);
}







function showRegionsShow() {
	//$('#regionsList').animate({height:"1em"}, 2000).hide();
	$('#regionsList').hide();
	$('#regionsShow').show();
}

function showRegionsList(cat_url, get_only) {
	if (cat_url == undefined)
		return false;

	if (get_only == undefined)
		get_only = false;

	if ( $('#regionsList').html() == '' ) {
		$('#regionsList').html('<table cellpadding="0" cellspacing="0" border="0"  class="content" width="98%" align="center" style="margin:10px auto 14px; line-height:100%;" id="regionsShow"><tr><td colspan="2" align="left" valign="top" class="maintext" height="22" style="color:black;">Регион: <img src="/front/loader.gif" style="vertical-align:-4px;" /></td></tr></table>');
		$.post('/getRegionsList.php', {cat_url: cat_url, get_only: get_only}, function(data) {
			if (data) {
				$('#regionsList').html(data);
			}
		});
	}

	$('#regionsShow').hide();
	$('#regionsList').show();
	//$('#regionsList').show().animate({height:"auto"}, 2000);
}
