enyo.kind({
	name: "Ares.PopupTitle",
	handlers: {
		ondragstart: "_dragstartAction",
		ondragend: "_dragendAction",
		ondrag: "_dragAction"
	},
	/** @private */
	_initialPosition: "",
	/** @private */
	_isDragging: false,
	published: {
		draggable: true
	},
	create: function(inSender, inEvent) {
		this.inherited(arguments);
	},
	resizeHandler: function(inSender, inEvent) {
		this.inherited(arguments);
		var cn = Ares.instance.hasNode();
		this.containerBounds = cn ? {width: cn.clientWidth, height: cn.clientHeight} : {};
	},
	/** @private */
	_dragAction: function(inSender, inEvent) {
		if(this.draggable && this._isDragging) {
			var leftP = this._isOutOfXDrag(inSender, inEvent);
			var topP = this._isOutOfYDrag(inSender, inEvent);
			if(leftP !== null){
				this.owner.applyStyle("left", leftP+"px");
			} else {
				this.owner.applyStyle("left", (this._initialPosition.left+inEvent.dx)+"px");
			}
			if(topP !== null){
				this.owner.applyStyle("top", topP+"px");
			} else {
				this.owner.applyStyle("top", (this._initialPosition.top+inEvent.dy)+"px");
			}
		}
		return true;
	},
	/** @private */
	_dragstartAction: function(inSender, inEvent) {
		if(this.draggable){
			this._initialPosition = this.owner.getBounds();
			this._isDragging = this._isInDraggable(inSender, inEvent);
		}
		return true;
	},
	/** @private */
	_dragendAction: function(inSender, inEvent) {
		if(this.draggable){
			this._isDragging = false;
		}
		return true;
	},
	/** @private */
	_isInDraggable: function(inSender, inEvent) {
		var pX, pY, minX, minY, maxX, maxY;
		pX = inEvent.clientX;
		pY = inEvent.clientY;
		minX = this._initialPosition.left;
		minY = this._initialPosition.top;
		maxX = minX + this._initialPosition.width;
		maxY = minY + this._initialPosition.height;
		return (pX >= minX && pX <= maxX && pY >= minY && pY <= maxY);
	},
	/** @private */
	_isOutOfXDrag:function(inSender, inEvent) {
		var xPosition = null;
		var e = inEvent;
		var leftP = this._initialPosition.left + e.dx;
		if(leftP < 0){
			xPosition = 0;
		} else if(this.containerBounds.width < (leftP+this._initialPosition.width)){
			xPosition = this.containerBounds.width - this._initialPosition.width;
		}
		return xPosition;
	},
	/** @private */
	_isOutOfYDrag:function(inSender, inEvent) {
		var yPosition = null;
		var e = inEvent;
		var topP = this._initialPosition.top + e.dy;
		if(topP < 0){
			yPosition = 0;
		} else if(this.containerBounds.height < (topP+this._initialPosition.height)){
			yPosition = this.containerBounds.height - this._initialPosition.height;
		}
		return yPosition;
	}
});


@@ -759,34 +759,38 @@
 null)%7B%0A%09%09%09%09this.
-ow
+contai
 ner.applyStyle(%22
@@ -822,34 +822,38 @@
 else %7B%0A%09%09%09%09this.
-ow
+contai
 ner.applyStyle(%22
@@ -934,34 +934,38 @@
 null)%7B%0A%09%09%09%09this.
-ow
+contai
 ner.applyStyle(%22
@@ -999,26 +999,30 @@
  %7B%0A%09%09%09%09this.
-ow
+contai
 ner.applySty
@@ -1229,10 +1229,14 @@
 his.
-ow
+contai
 ner.

use container instead owner on draggable popup title