/* Initializes the map */
function GM_Init ( html_elem_id, lat, lng, alt, controls )
{
	return GM_Init(html_elem_id, lat, lng, alt, controls, controls, controls);
}

/* Initializes the map (detailed options) */
function GM_Init ( html_elem_id, lat, lng, alt, mapTypeCtrl, navCtrl, scaleCtrl )
{
	var latlng = new google.maps.LatLng(lat, lng);
	var mapOptions = {
		center: latlng,
		zoom: alt,
		mapTypeId: google.maps.MapTypeId.ROADMAP,
		mapTypeControl: mapTypeCtrl,
		navigationControl: navCtrl,
		scaleControl: scaleCtrl
	};
	
	 var map = new google.maps.Map(document.getElementById(html_elem_id), mapOptions);
	 return map;
}

/* Changes the current location */
function GM_SetCenter ( map, lat, lng )
{
	var latlng = new google.maps.LatLng(lat, lng);
	map.setCenter(latlng);
}

/* Adds a marker to a fixed location */
function GM_AddMarker ( map, lat, lng )
{
	var latlng = new google.maps.LatLng(lat, lng);
	var marker = new google.maps.Marker({
		map: map,
		position: latlng
	});
	
	return marker;
}

/* Adds a circle to the center of the map */
function GM_AddCenterCircle ( map, lat, lng, rad )
{
	var latlng = new google.maps.LatLng(lat, lng);
	var circle = new google.maps.Circle({
		map: map,
		center: latlng,
		radius: rad * 1000 // km
    });
	
	circle.bindTo('center', map, 'center');
	
	return circle;
}

/* Changes the radius of a circle */
function GM_ChangeCircle ( circle, rad )
{
	circle.setRadius(rad * 1000);
}

