if ("undefined" == typeof(RadDockNamespace))
{
	RadDockNamespace = new Object();
}

/*************************************************
 *
 * RadRectangle object
 *
 *************************************************/
RadDockNamespace.RadRectangle = function (left, top, width, height)
{
	this.left   = (null != left ? left : 0);
	this.top    = (null != top ? top : 0);
	this.width  = (null != width ? width : 0);
	this.height = (null != height ? height : 0);
	
	this.right  = left + width;
	this.bottom = top + height;
};

/*
 * Clone - Creates a shallow copy of the RadRectangle
 */
RadDockNamespace.RadRectangle.prototype.Clone = function()
{
	return new RadRectangle(this.left, this.top, this.width, this.height);
}

/*
 * PointInRect - Determines if the specified point is contained within the rectangular region defined by this RadRectangle.
 */
RadDockNamespace.RadRectangle.prototype.PointInRect = function(x, y)
{
	return (this.left <= x && x <= (this.left + this.width)
			&& this.top <= y && y <= (this.top + this.height));
};

/*
 * Intersects - Determines if this RadRectangle intersects with rect.
 */
RadDockNamespace.RadRectangle.prototype.Intersects = function(rect)
{
	if (null == rect)
		return false;
		
	if (this == rect)
		return true;		
	
	return (rect.left < this.right
			&& rect.top < this.bottom
			&& rect.right > this.left
			&& rect.bottom > this.top);
};

/*
 * Converts the attributes of this RadRectangle to a human-readable string.
 */
RadDockNamespace.RadRectangle.prototype.ToString = function()
{
	return	"left:" + this.left + " "
			+ "right:" + this.right + " "
			+ "top:" + this.top + " "
			+ "bottom:" + this.bottom + " "
			 + "(" + this.width + " x " + this.height + ")";			
};

/*
 * Intersection - Returns RadRectangle that is the intersection of itself and the specified RadRectangle rect.
 */
RadDockNamespace.RadRectangle.prototype.Intersection = function(rect)
{
	if (null == rect)
		return false;
		
	if (this == rect)
		return this.Clone();
		
	if (!this.Intersects(rect))
		return new RadRectangle();
		
	var left = Math.max(this.left, rect.left);
	var top = Math.max(this.top, rect.top);
	var right = Math.min(this.right, rect.right);
	var bottom = Math.min(this.bottom, rect.bottom);
	
	return new RadRectangle(left, right, right - left, bottom - top);
};

/*************************************************
 *
 * RadGetElementRect
 *
 *************************************************/
function RadGetElementRect(element)
{
	if (!element)
	{
		element = this;
	}

	var left = 0;
	var top  = 0;

	var width = element.offsetWidth;
	var height = element.offsetHeight;

	if (element.x) {// FF
		left = element.x;
		top = element.y;
	
	} else { // IE

		var _tmpElement = element;
		while (_tmpElement != null)
		{
			left += _tmpElement.offsetLeft - _tmpElement.scrollLeft;
			top += _tmpElement.offsetTop - _tmpElement.scrollTop;

			_tmpElement = _tmpElement.offsetParent;
		}
	}

	left   = RadDockNamespace.ParseInt(left, 0);
	top    = RadDockNamespace.ParseInt(top, 0);
	width  = RadDockNamespace.ParseInt(width, 0);
	height = RadDockNamespace.ParseInt(height, 0);

	return new RadDockNamespace.RadRectangle(left, top, width, height);
}

RadDockNamespace.RadGetCurrentStyle = function(element)
{
	if (element.currentStyle)
	{
		return element.currentStyle;
	}
	else
	{
		return document.defaultView.getComputedStyle(element, null);	
	}
};

//BEGIN_ATLAS_NOTIFY
if (typeof(Sys) != "undefined")
{
    if (Sys.Application != null && Sys.Application.notifyScriptLoaded != null)
    {
        Sys.Application.notifyScriptLoaded();
    }
}
//END_ATLAS_NOTIFY
