﻿// JScript File

// Register the namespace for the control.
Type.registerNamespace('Logis');

Logis.OverviewMap = function(element) { 
	/// <summary>
	/// OverviewMap is a control for panning a map control and displaying an overview of the
	/// current extent.
	/// </summary>
	Logis.OverviewMap.initializeBase(this, [element]);
	this._map = null;
	this._width = 0;
	this._height = 0;
	this._boxLeft = 0;
	this._boxTop = 0;
	this._boxWidth = 0;
	this._boxHeight = 0;
	this._imageURL = "";
	this._blankURL = "";
	this._tooltip = "";
	this._boxColor = "Red";
	this._lineWidth = 3;
	this._lineType = "solid";
	this._aoiResizable = true;
	this._aoiDraggable = true;
	this._aoiMinWidth = 15;
	this._aoiMinHeight = 15;
	this._panMouseUpHandler = null;
	this._panMouseMoveHandler = null;
	this._resizeMouseUpHandler = null;
	this._resizeMouseMoveHandler = null;
	this._mouseDownOriginX = 0;
	this._mouseDownOriginY = 0;
	this._mousePanX = 0;
	this._mousePanY = 0;
	this._resizeWidth = 0;
	this._resizeHeight = 0;
	this._resizeOriginX = 0;
	this._resizeOriginY = 0;
	this._enabled = false;
	
  //delegates
  this._extentChanged = Function.createDelegate(this, this.extentChangedHandler);
 
	
	window.setTimeout('LogisOverview.wireUpMap()',2000);
};

Logis.OverviewMap.prototype = {

  wireUpMap : function() {
    Maps[this.get_map().get_id()].add_extentChanged(this._extentChanged);
  },

  extentChangedHandler : function(sender, args) {
    var env = args.current;
    //alert(env.get_xmin() + "\n" + env.get_xmax() + "\n" + env.get_ymax()+ "\n" + env.get_ymin());
    
    var pixX = (this._rwRight - this._rwLeft) / this._width;
    var pixY = (this._rwTop - this._rwBottom) / this._height;
    //alert(pixX + "\n" + pixY);
    
    var bLeft = Math.round( (env.get_xmin() - this._rwLeft) / pixX );
    if (bLeft < 0) {
      bLeft = 0;
    }
    
    var bTop = Math.round( (this._rwTop - env.get_ymax()) / pixY );
    if (bTop < 0) {
      bTop = 0;
    }
    
    var bWidth = Math.round( (env.get_xmax() - env.get_xmin()) / pixX );
    //alert(bWidth + "\n" + this._aoiMinWidth);
    
    if (bWidth < this._aoiMinWidth) {
      bWidth = this._aoiMinWidth;
    }
    if (bWidth > this._width) {
      bWidth = this._width;
    }
   
    var bHeight = Math.round( (env.get_ymax() - env.get_ymin()) / pixY );
    //alert(bHeight + "\n" + this._aoiMinHeight);
    
    if (bHeight < this._aoiMinHeight) {
      bHeight = this._aoiMinHeight;
    }
    if (bHeight > this._height) {
      bHeight = this._height;
    }
    
    this._updateAOI(bLeft, bTop, bWidth, bHeight);
    
  },
  
  // realworld LRTB of image
  get_rwLeft : function () {return this._rwLeft;},
	set_rwLeft : function(value) {this._rwLeft = value;},
	
	get_rwRight : function () {return this._rwRight;},
	set_rwRight : function(value) {this._rwRight = value;},
	
	get_rwTop : function () {return this._rwTop;},
	set_rwTop : function(value) {this._rwTop = value;},
	
	get_rwBottom : function () {return this._rwBottom;},
	set_rwBottom : function(value) {this._rwBottom = value;},
	
	
	
  
//  doCallback : function(argument, context) {
//    ESRI.ADF.System._doCallback(this._callbackFunctionString, this._id, this._id, argument, context);
//  },
//  
//	get_callbackFunctionString : function() {
//    return this._callbackFunctionString;
//  },
//  
//  set_callbackFunctionString : function(value) {
//    this._callbackFunctionString = value;
//  },

	  

	initialize : function() {
		/// <summary>
		/// Initialize the parent along with any child controls that have not yet been initialized.
		/// </summary>

		Logis.OverviewMap.callBaseMethod(this, 'initialize');
		
		// Get element representing this control so it can be used in the code below
		var ovm = this.get_element();

		// If no buddy map has been associated with this control, hide this control
		if (this._map === null) {
			ovm.style.display = "none";
			ovm.style.visibility = "hidden";
		}	else {
			// To indicate that event handlers are established so they can be removed
			this._enabled = true;

			this._right = this._width;
			this._bottom = this._height;
			this._boxRight = this._boxLeft + this._boxWidth;
			this._boxBottom = this._boxTop + this._boxHeight;
			this._aoiResizable = Boolean(this._aoiResizable);
			this._aoiDraggable = Boolean(this._aoiDraggable);

			this._divId = "OVDiv_" + this.get_id();
			this._imageId = "OVImage_" + this.get_id();
			this._boxDivId = "OVBoxDiv_" + this.get_id();
			this._boxImageId = "OVBoxImage_" + this.get_id();
			this._boxResizeDivId = "OVBoxResizeDiv_" + this.get_id();

			this._boxDivObject = null;
			this._imageObject = null;
			this._boxResizeObject = null;

			this._dragOVBox = false;
			this._dragOVResizeBox = false;

			this._mapXRatio = 1;
			this._mapYRatio = 1;
			this._mapXYRatio = 1;

			this._ovPanStartLeft = 0;
			this._ovPanStartTop = 0;

			// Create UI representation
			this._createDivs (ovm);
		}
	},

	dispose : function() {
		/// <summary>
		/// Dispose the control.
		/// </summary>

		$clearHandlers(this._element);
		Logis.OverviewMap.callBaseMethod(this, 'dispose');
	},

	_createDivs : function (ovm) {
		/// <summary>
		/// Create DIV elements to represent the control.
		/// </summary>

		// keep displayed aoi box within display area
		var leftAdjust = 0;
		var topAdjust = 0;
		if (this._boxLeft<0) {
			leftAdjust = this._boxLeft; 
			this._boxLeft = 0;
		}
		if (this._boxTop<0) {
			topAdjust = this._boxTop; 
			this._boxTop = 0;
		}
		if (this._boxLeft + this._boxWidth+(this._lineWidth*2)>=this._width) {
			this._boxWidth = this._width - this._boxLeft-(this._lineWidth*2) + leftAdjust;
		}
		if (this._boxTop + this._boxHeight+(this._lineWidth*2)>=this._height) {
			this._boxHeight = this._height - this._boxTop-(this._lineWidth*2) + topAdjust; 
		}

		// Control DIV 
		var s = "";
		s += '<div id="OVControlDiv_' + this.get_id() + '" style="position: relative; background-color: White; width: ' + this._width + 'px; height: ' + this._height + 'px; overflow:hidden;">\n';	

		// Map Image DIV
		s += '<div id="' + this._divId + '" style="position: absolute; left: 0px; top: 0px; background-color: White; width: ' + this._width + 'px; height: ' + this._height + 'px; overflow:hidden;">\n';
		s += '<img id="' + this._imageId + '" alt="' + this._tooltip + '"  title="' + this._tooltip + '" src="' + this._imageURL + '" width="' + this._width + '" height="' + this._height + '" hspace="0" vspace="0" border="0" />\n';
		s += '</div>\n';

		// Box DIV
		var style = "border: " + this._lineWidth + "px " + this._lineType + " " + this._boxColor + ";";
		s += '<div id="' + this._boxDivId + '" style="position: absolute; left: ' + this._boxLeft + 'px; top: ' + this._boxTop + 'px;' + style + ' width: ' + this._boxWidth + 'px; height: ' + this._boxHeight + 'px; overflow:hidden; ">\n';
		s += '<img id="' + this._boxImageId + '" alt="' + this._tooltip + '"  title="' + this._tooltip + '" src="' + this._blankURL + '" width="100%" height="100%" hspace="0" vspace="0" border="0">\n';

		// Add "glass" layer above control to prevent drag issues on Firefox
		if (Sys.Browser.agent == Sys.Browser.Firefox)
		{
			s += '<div style=\"width: 100%; height: 100%; left: 0; top: 0; position: absolute\"></div>';
		}

		s += '</div>\n';

		// Resize DIV
		if (this._aoiResizable)
		{
			s += '<div id="' + this._boxResizeDivId + '" style="position: absolute; left: ' + (this._boxLeft + this._boxWidth - 5) + '; top: ' + (this._boxTop + this._boxHeight - 5) + '; cursor: nw-resize; width: 10px; height: 10px; overflow:hidden;">\n';
			s += '<img  alt="Resize AOI"  title="Resize AOI" src="' + this._blankURL + '" width="10" height="10" hspace="0" vspace="0" border="0" >\n';

			// Add "glass" layer above control to prevent drag issues on Firefox
			if (Sys.Browser.agent == Sys.Browser.Firefox)
			{
				s += '<div style=\"width: 100%; height: 100%; left: 0; top: 0; position: absolute\"></div>';
			}

			s += '</div>\n';
		}

		s += '</div>\n';

		ovm.innerHTML = s;

		this._setObjects();
		this._setEvents();
		this._updateMapRatio();
	},

	_setObjects : function ()	{
		/// <summary>
		/// Create objects for each DIV so they can be manipulated quickly.
		/// </summary>

		this._divObject = $get(this._divId);
		this._boxDivObject = $get(this._boxDivId);
		this._imageObject = $get(this._imageId);
		
		if (this._aoiResizable)
		{
			this._boxResizeObject = $get(this._boxResizeDivId);
		}
	},

	_setEvents : function ()
	{
		/// <summary>
		/// Create event handlers and assign to UI elements
		/// </summary>

		// Setup cursors and mouse event handler
		if (this._aoiDraggable)
		{
			// Create event handler references for the mouse events that are handled once panning
			// starts. These are also then used when those events are no longer handled.
			this._panMouseUpHandler = Function.createDelegate(this, this._doPanMouseUp);
			this._panMouseMoveHandler = Function.createDelegate(this, this._doPanMouseMove);

			this._boxDivObject.style.cursor = "move";
			this._divObject.style.cursor = "default";
			$addHandler(this._boxDivObject, 'mousedown', Function.createDelegate(this, this._doPanMouseDown));
		}
		// Listen for the mouse down event on resize div
		if (this._aoiResizable)
		{ 
			// Create event handler references for the mouse events that are handled once resizing the AOI box
			// starts. These are also then used when those events are no longer handled.
			this._resizeMouseUpHandler = Function.createDelegate(this, this._doResizeMouseUp);
			this._resizeMouseMoveHandler = Function.createDelegate(this, this._doResizeMouseMove);

			$addHandler(this._boxResizeObject, 'mousedown', Function.createDelegate(this, this._doResizeMouseDown));
		}
	},

	_updateMapRatio : function ()
	{
		/// <summary>
		/// Update map ratio fields which are used to enforce resize AOI
		/// </summary>

		var bounds = Sys.UI.DomElement.getBounds (this._map.get_element());
		var mapWidth = bounds.width;
		var mapHeight = bounds.height;

		this._mapXRatio = mapWidth / this._boxWidth;
		this._mapYRatio = mapHeight / this._boxHeight;
		this._mapXYRatio = mapWidth / mapHeight;

		// Determine maximum X/Y values, using ratio, so AOI resize does not exceed the dimensions
		// of the control itself
		if (this._mapXYRatio > 1)
		{
			this._maxBoxWidth = this._width;
			this._maxBoxHeight = this._width / this._mapXYRatio;
		}
		else
		{
			this._maxBoxWidth = this._height * this._mapXYRatio;
			this._maxBoxHeight = this._height;
		}
		this._maxBoxWidth = Math.min(this._width, this._maxBoxWidth);
		this._maxBoxHeight = Math.min(this._height, this._maxBoxHeight);
	 },
	 
	_doPanMouseDown : function (e)
	{
		/// <summary>
		/// This is invoked when the AOI box is dragged. It will add handlers for other necessary mouse
		/// events to handle dragging and when the drag ends (mouse up).
		/// </summary>

		if (e.button == Sys.UI.MouseButton.leftButton)
		{
			if (!this._dragOVBox)
			{
				// Enter drag mode
				this._dragOVBox = true;

				// Establish coordinates
				this._ovPanStartLeft = this._boxDivObject.offsetLeft;
				this._ovPanStartTop = this._boxDivObject.offsetTop;

				// Remember current location to later determine how far the mouse has been dragged
				this._mouseDownOriginX = this._mousePanX = e.clientX;
				this._mouseDownOriginY = this._mousePanY = e.clientY;

				// Add handlers to handle when the panning should stop and when dragging occurs        
				$addHandler(this.get_element(), 'mouseup', this._panMouseUpHandler);
				$addHandler(this.get_element(), 'mousemove', this._panMouseMoveHandler);
			}
		}
	},

	_doPanMouseMove : function (e)
	{
		/// <summary>
		/// This is invoked when the AOI box is dragged. It will detect the difference between the initial
		/// mouse location and the current location to pan the overview map and associated map controls.
		/// </summary>

		// Execute this code only if we are in drag mode
		if (this._dragOVBox)
		{
			// Move overview map divs
			var ex = this._ovPanStartLeft + (e.clientX - this._mouseDownOriginX);
			var ey = this._ovPanStartTop + (e.clientY - this._mouseDownOriginY);
			this._boxDivObject.style.left = ex + "px";
			this._boxDivObject.style.top = ey + "px";

			// If the AOI is resizable, then move it in relation to its parent
			if (this._aoiResizable)
			{
				this._boxResizeObject.style.left = (ex + this._boxWidth - 5) + "px";
				this._boxResizeObject.style.top = (ey + this._boxHeight - 5) + "px";
			}
			
			// Pan the map by moving it the number of pixels difference between the mouse location the
			// last time we panned the map and the current mouse location
			var nx = Math.round((e.clientX - this._mousePanX) * this._mapXRatio);
			var ny = Math.round((e.clientY - this._mousePanY) * this._mapYRatio);

			// Only pan the map if it is necessary to do so. Invoking this method with both values being
			// zero will cause it to make a postback (if necessary) to refresh the map and we don't want
			// to do that until dragging/panning is done via the mouse up event.
			if (nx !== 0 || ny !== 0)
			{
				this._map._doContinuousPan (nx, ny);
			}

			// Reset origin since we are only interested in panning the map the number of pixels
			// the mouse has moved since the last time we panned the map (not since the original
			// sample was taken during the mouse down event).
			this._mousePanX = e.clientX;
			this._mousePanY = e.clientY;

			// Do not perform the default action and do not propagate this so that the cursor will not
			// become a circle with a line through it during the dragging of the mouse while panning.
			e.preventDefault();
			e.stopPropagation();
		}
	},

	_doPanMouseUp : function (e)
	{
		/// <summary>
		/// This is invoked when the AOI box is no longer dragged. It will exit drag mode, tell the map to 
		/// update itself as needed and remove mouse handlers.
		/// </summary>

		// Exit the dragging mode
		this._dragOVBox = false;

		// Remove handlers assigned when panning started with the mouse down event
		$removeHandler(this.get_element(), 'mouseup', this._panMouseUpHandler);
		$removeHandler(this.get_element(), 'mousemove', this._panMouseMoveHandler);

		// Tell map that we are done panning
		this._map._doContinuousPan (0, 0);
	},

	_doResizeMouseDown : function (e)
	{
		/// <summary>
		/// This is invoked when the AOI box is resized. It will add handlers for other necessary mouse
		/// events to handle resizing and when the resize ends (mouse up).
		/// </summary>

		if (e.button == Sys.UI.MouseButton.leftButton)
		{
			if (!this._dragOVResizeBox)
			{
				// Enter drag mode
				this._dragOVResizeBox = true;

				// Store control center using "client" XY coordinates
				var bounds;
				bounds = Sys.UI.DomElement.getBounds (this.get_element());
				this._resizeOriginX = bounds.x + (bounds.width / 2);
				this._resizeOriginY = bounds.y + (bounds.height / 2);

				// Remember current dimensions of box
				bounds = Sys.UI.DomElement.getBounds (this._boxDivObject);
				this._resizeWidth = bounds.width - (this._lineWidth * 2);
				this._resizeHeight = bounds.height - (this._lineWidth * 2);

				// Add handlers to handle when the resizing should stop and when dragging occurs
				$addHandler(this.get_element(), 'mouseup', this._resizeMouseUpHandler);
				$addHandler(this.get_element(), 'mousemove', this._resizeMouseMoveHandler);
			}
		}
	},

	_doResizeMouseMove : function (e)
	{
		/// <summary>
		/// Handle mouse movement while resizing AOI
		/// </summary>

		// Execute this code only if we are in drag mode
		if (this._dragOVResizeBox)
		{
			var normalWidth = 0;
			var normalHeight = 0;

			// Determine the number of pixels in each direction (X and Y) that the mouse is from
			// the center of the control
			var deltaX = Math.abs(e.clientX - this._resizeOriginX);
			var deltaY = Math.abs(e.clientY - this._resizeOriginY);

			// If the distance in the X direction is greater than distance in the Y direction (taking
			// into consideration the ratio factor) then X determines the rectange, else Y determines
			if (deltaX > (deltaY * this._mapXYRatio))
			{
				normalWidth = deltaX * 2;

				// Make sure width is not too small or too large
				if (normalWidth < this._aoiMinWidth)
				{
					normalWidth = this._aoiMinWidth;
				}
				else if (normalWidth > this._maxBoxWidth)
				{
					normalWidth = this._maxBoxWidth;
				}

				// Height determined by width and ratio between them
				normalHeight = normalWidth / this._mapXYRatio;
			}
			else
			{
				normalHeight = deltaY * 2;

				// Make sure height is not too small or too large
				if (normalHeight < this._aoiMinHeight)
				{
					normalHeight = this._aoiMinHeight;
				}
				else if (normalHeight > this._maxBoxHeight)
				{
					normalHeight = this._maxBoxHeight;
				}

				// Width determined by height and ratio between them
				normalWidth = normalHeight * this._mapXYRatio;
			}

			// Resize DIV object to redraw rectangle based upon updated mouse coordinates
			this._boxDivObject.style.width = (normalWidth - (this._lineWidth * 2)) + "px";
			this._boxDivObject.style.height = (normalHeight - (this._lineWidth * 2)) + "px";
			this._boxDivObject.style.left = ((this._width - normalWidth) / 2) + "px";
			this._boxDivObject.style.top = ((this._height - normalHeight) / 2) + "px";

			this._boxWidth = normalWidth;
			this._boxHeight = normalHeight;

			// Do not perform the default action and do not propagate this so that the cursor will not
			// become a circle with a line through it during the dragging of the mouse while moving.
			e.preventDefault();
			e.stopPropagation();
		}
	},

	_doResizeMouseUp : function (e)
	{
		/// <summary>
		/// Handle mouse up event to end resizing of the AOI
		/// </summary>

		// Exit the dragging mode
		this._dragOVResizeBox = false;

		// Remove handlers assigned when panning started with the mouse down event
		$removeHandler(this.get_element(), 'mouseup', this._resizeMouseUpHandler);
		$removeHandler(this.get_element(), 'mousemove', this._resizeMouseMoveHandler);
		
		// If zooming does not cause a zoom or pan to occur, then we must reset the AOI to its original
		// dimensions
		if (!this._map.zoom(this._resizeWidth / this._boxWidth))
		{
			this._boxDivObject.style.width = this._resizeWidth + "px";
			this._boxDivObject.style.height = this._resizeHeight + "px";
			this._boxDivObject.style.left = ((this._width - this._resizeWidth) / 2) + "px";
			this._boxDivObject.style.top = ((this._height - this._resizeHeight) / 2) + "px";
		}
	},

	_updateAOI : function (boxLeft, boxTop, boxWidth, boxHeight)
	{
		/// <summary>
		/// Process AOI updated values and update corresponding UI elements
		/// </summary>

		this._boxLeft = boxLeft;
		this._boxTop = boxTop;
		this._boxWidth = boxWidth;
		this._boxHeight = boxHeight;
		this._boxRight = boxLeft + boxWidth;
		this._boxBottom = boxTop + boxHeight;
		
		this._boxDivObject.style.left = boxLeft + "px";
		this._boxDivObject.style.top = boxTop + "px";
		this._boxDivObject.style.width = boxWidth + "px";
		this._boxDivObject.style.height = boxHeight + "px";

		if (this._aoiResizable)
		{
			this._boxResizeObject.style.left = (boxLeft + boxWidth - 5) + "px";
			this._boxResizeObject.style.top = (boxTop + boxHeight - 5) + "px";
		}

		this._updateMapRatio();
	},

	processCallbackResult : function(action, params) {
		/// <summary>
		/// Process callback results to update the overview map image and AOI rectangle
		/// </summary>
		if (action=='aoiextent')
		{
			// Process AOI rectangle
			this._updateAOI (params[0], params[1], params[2], params[3]);

			// If an image URL is present in the response parameters, update the image
			if (params[4])
			{
				if(!this._imageObject.src.endsWith(params[4])) {
					this._imageObject.src = params[4];
				}
			}
		}
	},

	show : function() {
		/// <summary>
		/// Sets the visibility of the OverviewMap to be visible. 
		/// </summary>
		var ovm = this.get_element();
		if (ovm)
		{
			ovm.style.visibility = 'visible';
		}
	},

	hide : function() {
		/// <summary>
		/// Sets the visibility of the OverviewMap to be hidden. 
		/// </summary>
		var ovm = this.get_element();
		if (ovm)
		{
			ovm.style.visibility = 'hidden';
		}
	},

	isVisible : function()
	{
		/// <summary>
		/// Returns whether the OverviewMap is currently visible or not.
		/// </summary>
		var ovm = this.get_element();
		return ovm && ovm.style.visibility != 'hidden';
	},

  //
	// Properties
	//
	
	
	get_map : function ()
	{
		/// <field type="Logis.Map" mayBeNull="false">
		/// Obtains the map control to which the OverviewMap is a buddy.
		/// </field>
		return this._map;
	},

	set_map : function(value)
	{
		if (this._map != value) {
			this._map = value;
			this.raisePropertyChanged('map');
		}
	},

	get_width : function ()
	{
		/// <field type="Number" integer="true">
		/// The width of the control.
		/// </field>
		return this._width;
	},

	set_width : function(value)
	{
		if (this._width != value) {
			this._width = value;
			this.raisePropertyChanged('width');
		}
	},

	get_height : function ()
	{
		/// <field type="Number" integer="true">
		/// The height of the control.
		/// </field>
		return this._height;
	},

	set_height : function(value)
	{
		if (this._height != value) {
			this._height = value;
			this.raisePropertyChanged('height');
		}
	},

	get_boxLeft : function ()
	{
		/// <field type="Number" integer="true">
		/// The left coordinate of the AOI box.
		/// </field>
		return this._boxLeft;
	},

	set_boxLeft : function(value)
	{
		if (this._boxLeft != value) {
			this._boxLeft = value;
			this.raisePropertyChanged('boxLeft');
		}
	},

	get_boxTop : function ()
	{
		/// <field type="Number" integer="true">
		/// The top coordinate of the AOI box.
		/// </field>
		return this._boxTop;
	},

	set_boxTop : function(value)
	{
		if (this._boxTop != value) {
			this._boxTop = value;
			this.raisePropertyChanged('boxTop');
		}
	},

	get_boxWidth : function ()
	{
		/// <field type="Number" integer="true">
		/// The width of the AOI box.
		/// </field>
		return this._boxWidth;
	},

	set_boxWidth : function(value)
	{
		if (this._boxWidth != value) {
			this._boxWidth = value;
			this.raisePropertyChanged('boxWidth');
		}
	},

	get_boxHeight : function ()
	{
		/// <field type="Number" integer="true">
		/// The height of the AOI box.
		/// </field>
		return this._boxHeight;
	},

	set_boxHeight : function(value)
	{
		if (this._boxHeight != value) {
			this._boxHeight = value;
			this.raisePropertyChanged('boxHeight');
		}
	},

	get_imageURL : function ()
	{
		/// <field type="String" mayBeNull="false">
		/// The image URL of the map to display in the control.
		/// </field>
		return this._imageURL;
	},

	set_imageURL : function(value)
	{
		if (this._imageURL != value) {
			this._imageURL = value;
			this.raisePropertyChanged('imageURL');
		}
	},

	get_blankURL : function ()
	{
		/// <field type="String" mayBeNull="false">
		/// The image URL of the blank image to display in the control.
		/// </field>
		return this._blankURL;
	},

	set_blankURL : function(value)
	{
		if (this._blankURL != value) {
			this._blankURL = value;
			this.raisePropertyChanged('blankURL');
		}
	},

	get_tooltip : function ()
	{
		/// <field type="String" mayBeNull="false">
		/// The tooltip text to display in the control.
		/// </field>
		return this._tooltip;
	},

	set_tooltip : function(value)
	{
		if (this._tooltip != value) {
			this._tooltip = value;
			this.raisePropertyChanged('tooltip');
		}
	},

	get_boxColor : function ()
	{
		/// <field type="String" mayBeNull="false">
		/// The color for the AOI box.
		/// </field>
		return this._boxColor;
	},

	set_boxColor : function(value)
	{
		if (this._boxColor != value) {
			this._boxColor = value;
			this.raisePropertyChanged('boxColor');
		}
	},

	get_lineWidth : function ()
	{
		/// <field type="Number" integer="true">
		/// The line width for the AOI box.
		/// </field>
		return this._lineWidth;
	},

	set_lineWidth : function(value)
	{
		if (this._lineWidth != value) {
			this._lineWidth = value;
			this.raisePropertyChanged('lineWidth');
		}
	},

	get_lineType : function ()
	{
		/// <field type="String" mayBeNull="false">
		/// The line width for the AOI box.
		/// </field>
		return this._lineType;
	},

	set_lineType : function(value)
	{
		if (this._lineType != value) {
			this._lineType = value;
			this.raisePropertyChanged('lineType');
		}
	},

	get_aoiResizable : function ()
	{
		/// <field type="Boolean" mayBeNull="false">
		/// Whether or not the AOI box is resizable.
		/// </field>
		return this._aoiResizable;
	},

	set_aoiResizable : function(value)
	{
		if (this._aoiResizable != value) {
			this._aoiResizable = value;
			this.raisePropertyChanged('aoiResizable');
		}
	},

	get_aoiDraggable : function ()
	{
		/// <field type="Boolean" mayBeNull="false">
		/// Whether or not the AOI box is draggable.
		/// </field>
		return this._aoiDraggable;
	},

	set_aoiDraggable : function(value)
	{
		if (this._aoiDraggable != value) {
			this._aoiDraggable = value;
			this.raisePropertyChanged('aoiDraggable');
		}
	},

	get_aoiMinWidth : function ()
	{
		/// <field type="Integer" mayBeNull="false">
		/// The minimum width of the aoi box.
		/// </field>
		return this._aoiMinWidth;
	},

	set_aoiMinWidth : function(value)
	{
		if (this._aoiMinWidth != value) {
			this._aoiMinWidth = value;
			this.raisePropertyChanged('aoiMinWidth');
		}
	},

	get_aoiMinHeight : function ()
	{
		/// <field type="Integer" mayBeNull="false">
		/// The minimum height of the aoi box.
		/// </field>
		return this._aoiMinHeight;
	},

	set_aoiMinHeight : function(value)
	{
		if (this._aoiMinHeight != value) {
			this._aoiMinHeight = value;
			this.raisePropertyChanged('aoiMinHeight');
		}
	}
};

Logis.OverviewMap.registerClass('Logis.OverviewMap', Sys.UI.Control);


//var m_OVDisplay = "OVDisplay";
//var m_OVToolbarId = "OVToolbar";
//var m_OVMouseUpSet = false;
//var m_OVToolbar = null;
//var m_OVCoords = "";
//var m_OVLastCoords = "";
//var m_OVMoveFunction = null;

//var m_OVToolbarImagePath = "images/";
//var m_OVToolbarImageExtension = ".gif";



//var m_OVXOffset = 0;
//var m_OVYOffset = 0;



//function startOV() {       
//		
//    var md;
//    if (m_OVDisplay!=null) {
//        md = $get(m_OVDisplay);
//        m_OVToolbar = $get(m_OVToolbarId);
//        m_OVToolbar.style.display = "";
//    }
//	
//	//if (!m_OVMouseUpSet) {
//	   // map.add_mouseUp(OVCoordsMouseUp);
//	   // m_OVMouseUpSet = true;
//	//}
//}

//function closeOV(id) {
//    hideOVToolbarTool(id);
//    map.remove_mouseUp(OVCoordsMouseUp);   
//    m_OVMouseUpSet = false; 
//    
// }

//function hideOV(id) {
//    m_OVToolbar = $get(m_OVToolbarId);
//    if (m_OVToolbar!=null) {
//        m_OVToolbar.style.display = "none";
//        removeOVGraphic();       
//   
//    }
//} 
//// event handler for starting to drag toolbar around... mouse down
//function dragOVToolbarStart(e) {
//    m_OVToolbar = $get("OVToolbar");
//    if (m_OVToolbar!=null) {
//        var box = calcElementPosition(m_OVToolbar.id);
//        m_OVXOffset =e.clientX - box.left;
//        m_OVYOffset = e.clientY - box.top;
//    }
//    $addHandler(document, "mousemove", dragOVToolbarMove);
//    $addHandler(document, "mouseup", dragOVToolbarStop);  
//    e.preventDefault();
//    e.stopPropagation();
//}

//// event handler for toolbar drag movement... mousemove
//function dragOVToolbarMove(e) {
//    m_OVToolbar.style.left = (e.clientX-m_OVXOffset) + "px";;
//    m_OVToolbar.style.top = (e.clientY-m_OVYOffset) + "px";
//    e.preventDefault();
//    e.stopPropagation();
//}

//// event handler for end of toolbar drag movement... mouseup
//function dragOVToolbarStop(e) {
//    $removeHandler(document, "mousemove", dragOVToolbarMove);
//    $removeHandler(document, "mouseup", dragOVToolbarStop);  
//    e.preventDefault();
//    e.stopPropagation();
//}
