Evt_Draw_Rectangle.prototype=new Event();
function Evt_Draw_Rectangle()
{
	this._w=0;
	this._h=0;
	this._map_node=document.getElementById(_MAP_ID);
	this._jg = this._jg == null ? new jsGraphics(_MAP_ID):this._jg;
	this._curr_x=0;
	this._curr_y=0;
	this._listener=null;
}	
Evt_Draw_Rectangle.prototype.mouse_move=function(event)
{
	var px_coords=_MAP_WRAPPER.convert_to_relative_pixel_coords(event.clientX,event.clientY);
	this._curr_x=px_coords[0];
	this._curr_y=px_coords[1];
	
	this._w=this._curr_x-this._x_click;
	this._h=this._curr_y-this._y_click;
	
	this._x_mov=this._x_click;
	this._y_mov=this._y_click;		
	
	if((px_coords[0])< this._x_click)
	{
		this._x_mov=Math.abs(px_coords[0]);
		this._w=Math.abs(this._w);
	}
	if((px_coords[1])<this._y_click)
	{
		this._y_mov=Math.abs(px_coords[1]);
		this._h=Math.abs(this._h);
	}
	this._jg.clear();
	this._jg.setColor("#000000");
	this._jg.drawRect(parseInt(this._x_mov),parseInt(this._y_mov),parseInt(this._w),parseInt(this._h));
	this._jg.paint();
	
	stop_propagating_event(event);
};

	
Evt_Draw_Rectangle.prototype.mouse_up=function(event)
{
	stop_propagating_event(event);
	this._jg.clear();
    if( (this._x_mov==0) && (this._y_mov == 0) )
        return;
	this.do_operation();
};

Evt_Draw_Rectangle.prototype.do_operation=function()
{
    
};

Evt_Draw_Rectangle.prototype.notify=function()
{
	if(this._listener != null)
		this._listener.notify_selected();
};

Evt_Draw_Rectangle.prototype.add_listener=function(obj)
{
	this._listener=obj;
};

