function drawCircle(center, radius, color, mapElement){
	var points = [];
	var theta, i, x, y;
	var sides = 36;
	var trans = 0.5;	
	
	// 3963 = earth radius in miles
	var lat = (radius/3963)*180/Math.PI;  
	var lng = lat/Math.cos(center.lat()*Math.PI/180);
	
	for (i=-1; i < sides; i++) {
		theta = ((2*i+1)/sides-0.5) * Math.PI;
		x = center.lng() + (lng * Math.cos(theta));
		y = center.lat() + (lat * Math.sin(theta)); 
		points.push(new GLatLng(y,x));
	}
	
	// GPolygon(points,  strokeColor?,  strokeWeight?,  strokeOpacity?,  fillColor?,  fillOpacity?)
	map.addOverlay(new GPolygon(points,color,5,0.25));
}


function addPoint(point,name) {
	//map.setCenter(point, 10);
	//var marker = new GMarker(point);
	var marker = createMarker(point,name);
	map.addOverlay(marker);
	//marker.openInfoWindowHtml(point.toString());
}


function showAddress(address) {
	geocoder.getLatLng(
		address,
		function(point) {
			if (!point) {
				alert(address + " not found");
			} else {
				map.setCenter(point, 13);
				var marker = new GMarker(point);
				map.addOverlay(marker);
				marker.openInfoWindowHtml(address + "<br/>" + point);
			}
		}
	);
}


// Creates a marker whose info window displays the letter corresponding
// to the given index.
function createMarker(point, placeName,num) {
	// Create a lettered icon for this point using our icon class
	var icon = new GIcon(baseIcon);
	if(!num) num="1";
	icon.image = "/images/mapmarker"+num+".png";
	var marker = new GMarker(point, icon);
	GEvent.addListener(
		marker, "mouseover",
		function() {
			marker.openInfoWindowHtml(placeName+"");
		}
	);
	return marker;
}

