Index: gs3-extensions/map-editor/DrawingManager/historyManager.js
===================================================================
--- gs3-extensions/map-editor/DrawingManager/historyManager.js	(revision 32710)
+++ gs3-extensions/map-editor/DrawingManager/historyManager.js	(revision 32710)
@@ -0,0 +1,179 @@
+var prevOverlays = [];
+
+function undoMovement() {
+	console.log("*** undoMovement called");
+	for (var i = 0; i < overlays.length; i++) {
+		overlays[i].setMap(null);
+
+	}
+	
+	overlays = [];
+	
+	var prev_overlay = prevOverlays.pop();
+	
+	for (var i = 0; i < prev_overlay.length; i++) {
+		overlays[i] = prev_overlay[i];
+		overlays[i].setMap(map);
+	}
+	
+}
+
+function clonePath(path)
+{
+	var clone_path = [];
+	
+	for (var i = 0; i < path.length; i++) {
+		var lati = path.getAt(i).lat();
+		var lngi = path.getAt(i).lng();
+		clone_lat_lng = {
+			lat: lati,
+			lng: lngi
+		};
+		clone_path.push(clone_lat_lng);
+	}
+	
+	return clone_path;
+}
+
+function clonePolyline(polyline)
+{
+	var path          = polyline.getPath();
+	var geodesic      = polyline.geodesic;
+	var strokeColor   = polyline.strokeColor;
+	var strokeOpacity = polyline.strokeOpacity;
+	var strokeWeight  = polyline.strokeWeight;
+	
+	var clone_path    = clonePath(path);
+	
+	var clone_polyline = new google.maps.Polyline({
+		geodesic: geodesic,
+		strokeColor: strokeColor,
+		strokeOpacity: strokeOpacity,
+		strokeWeight: strokeWeight,
+		path: clone_path
+	});
+	
+	clone_polyline.type = google.maps.drawing.OverlayType.POLYLINE;
+	
+	return clone_polyline;
+}
+
+function clonePolygon(polygon)
+{
+	var path          = polygon.getPath();
+	var geodesic      = polygon.geodesic;
+	var strokeColor   = polygon.strokeColor;
+	var strokeOpacity = polygon.strokeOpacity;
+	var strokeWeight  = polygon.strokeWeight;
+	var fillColor     = polygon.fillColor;
+	var fillOpacity   = polygon.fillOpacity;
+	
+	var clone_path    = clonePath(path);
+	
+	var clone_polygon = new google.maps.Polygon({
+		geodesic: geodesic,
+		strokeColor: strokeColor,
+		strokeOpacity: strokeOpacity,
+		strokeWeight: strokeWeight,
+		fillColor: fillColor,
+		fillOpacity: fillOpacity,
+		path: clone_path
+	});
+	
+	clone_polygon.type = google.maps.drawing.OverlayType.POLYGON;
+	
+	return clone_polygon;
+}
+
+function cloneRectangle(rect)
+{
+	var strokeColor   = rect.strokeColor;
+	var strokeOpacity = rect.strokeOpacity;
+	var strokeWeight  = rect.strokeWeight;
+	var fillColor     = rect.fillColor;
+	var fillOpacity   = rect.fillOpacity;
+	var bounds        = rect.getBounds();
+	
+	var clone_rect = new google.maps.Rectangle({
+		strokeColor: strokeColor,
+		strokeOpacity: strokeOpacity,
+		strokeWeight: strokeWeight,
+		fillColor: fillColor,
+		fillOpacity: fillOpacity,
+		bounds: bounds
+	});
+	
+	clone_rect.type = google.maps.drawing.OverlayType.RECTANGLE;
+	
+	return clone_rect;
+}
+
+function cloneCircle(circ)
+{
+	var strokeColor   = circ.strokeColor;
+	var strokeOpacity = circ.strokeOpacity;
+	var strokeWeight  = circ.strokeWeight;
+	var fillColor     = circ.fillColor;
+	var fillOpacity   = circ.fillOpacity;
+	var center        = circ.center;
+	var radius        = circ.radius;
+	
+	var clone_circ = new google.maps.Circle({
+		strokeColor: strokeColor,
+		strokeOpacity: strokeOpacity,
+		strokeWeight: strokeWeight,
+		fillColor: fillColor,
+		fillOpacity: fillOpacity,
+		center: center,
+		radius: radius
+	});
+	
+	clone_circ.type = google.maps.drawing.OverlayType.CIRCLE;
+	
+	return clone_circ;
+}
+
+
+function cloneShape(shape)
+{
+	if (shape.type === google.maps.drawing.OverlayType.POLYLINE) {
+		var clone_polyline = clonePolyline(shape);
+		return clone_polyline;
+	}
+	else if (shape.type === google.maps.drawing.OverlayType.POLYGON) {
+		var clone_polygon = clonePolygon(shape);
+		return clone_polygon;
+	}
+	else if (shape.type === google.maps.drawing.OverlayType.RECTANGLE) {
+		var clone_rect = cloneRectangle(shape);
+		return clone_rect;
+	
+	}
+	else if (shape.type === google.maps.drawing.OverlayType.CIRCLE) {
+		var clone_circ = cloneCircle(shape);
+		return clone_circ;
+	
+	}
+	else {
+		console.error("Unrecognized shape: " + shape);
+		return null;
+	}
+}
+
+function historyOverlayPush()
+{
+	console.log("historyOverlayPush()");
+	var overlays_copy = [];
+	for (var i = 0; i<overlays.length; i++) {
+		var clone_shape = cloneShape(overlays[i]);
+		
+		google.maps.event.addListener(clone_shape, 'click', function () {
+			setSelection(clone_shape);
+		});
+			
+		overlays_copy[i] = clone_shape;
+		
+	}
+	
+	prevOverlays.push(overlays_copy); 
+}
