// A TextualZoomControl is a GControl that displays textual "Zoom In"
// and "Zoom Out" buttons (as opposed to the iconic buttons used in
// Google Maps).


function Line(marker1, marker2, map, color) {
	this.map = map;

	this.polyLine = null;
	
	this.marker1 = marker1;
	this.marker2 = marker2;
	
	this.color = color;
}

Line.prototype.createPoint = function(point) {
	var marker = new GMarker(point,{draggable: true, icon:this.getMarkerIcon(), bouncy:false, dragCrossMove:false});
	return marker;
}

Line.prototype.draw = function() {
	GEvent.bind(this.marker1, "dragend", this, this.movePoint);
	GEvent.bind(this.marker2, "dragend", this, this.movePoint);

	this.map.map.addOverlay(this.marker2);
	this.polyLine = new GPolyline([this.marker1.getPoint(), this.marker2.getPoint()], this.color);
	this.map.map.addOverlay(this.polyLine);
}

Line.prototype.movePoint = function() {
	this.map.map.removeOverlay(this.polyLine);
	this.polyLine = new GPolyline([this.marker1.getPoint(), this.marker2.getPoint()], this.color);
	this.map.map.addOverlay(this.polyLine);
}

Line.prototype.getPolyline = function() {
	return this.polyLine;
}

Line.prototype.getMarkerIcon = function() {
	var icon = new GIcon(G_DEFAULT_ICON);
	icon.iconAnchor = new GPoint(5,5);
	icon.iconSize = new GSize(10,10);
	icon.shadow = null;
	icon.shadowSize = new GSize(10,10);
	icon.image = "images/lineMarkeru.png";
	
	return icon;
}
