Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadDockZone=function(_1){
Telerik.Web.UI.RadDockZone.initializeBase(this,[_1]);
this._clientID=null;
this._highlightedCssClass=null;
this._fitDocks=true;
this._uniqueName=null;
this._layoutID=null;
};
Telerik.Web.UI.RadDockZone.prototype={dock:function(_2,_3){
var _4=this.get_docks();
var _5=null;
if(_4.length>_3){
_5=_4[_3].get_element();
}
this._dockBefore(_2,_5);
},get_docks:function(){
var _6=[];
var _7=this.get_element().firstChild;
while(_7!=null){
if(_7!=this._placeholder&&_7.id){
var _8=$find(_7.id);
if(_8&&Telerik.Web.UI.RadDock&&Telerik.Web.UI.RadDock.isInstanceOfType(_8)){
Array.add(_6,_8);
}
}
_7=_7.nextSibling;
}
return _6;
},_dockBefore:function(_9,_a){
var _b=_9.get_element();
var _c=this.get_element();
if(_a){
_c.insertBefore(_b,_a);
}else{
_c.insertBefore(_b,this._clearElement);
}
_9.set_dockZoneID(_c.id);
if(this.get_fitDocks()){
if(!this.get_isHorizontal()){
_9._fitWidth();
}
}else{
if(!this.get_isHorizontal()){
_9._unfitWidth();
}
}
_9._resetPosition();
if(_9._tableElement){
_9._setSize();
}
_9._setPinUnpinVisibility();
this._resetDockIndices();
},_resetDockIndices:function(){
var _d=this.get_docks();
for(var i=0;i<_d.length;i++){
_d[i].set_index(i);
_d[i].updateClientState();
}
},get_isHorizontal:function(){
return Sys.UI.DomElement.containsCssClass(this.get_element(),"rdHorizontal");
},_lastFoundItem:null,_lastFoundItemBounds:null,_findItemAt:function(_f,_10){
var el=this.get_element();
if(!(this._lastFoundItem&&this._isInside(_f,this._lastFoundItemBounds))){
this._lastFoundItem=null;
this._lastFoundItemBounds=null;
var _12=el.firstChild;
while(_12!=null){
if(_12!=this._placeholder&&_12!=_10&&_12.nodeType!=3&&_12.nodeType!=8){
var _13=this._getMarginBox(_10);
var _14=this._getBorderBox(_10);
var _15=$telerik.getBounds(_12);
var loc=$telerik.getLocation(_12);
_15.x=loc.x;
_15.y=loc.y;
_15.x-=(_13.left+_14.left+2);
_15.y-=(_13.top+_14.top+2);
_15.width+=(_13.right+_14.right+2);
_15.height+=(_13.bottom+_14.bottom+2);
if(this._isInside(_f,_15)){
this._lastFoundItem=_12;
this._lastFoundItemBounds=_15;
break;
}
}
_12=_12.nextSibling;
}
}
return this._lastFoundItem;
},_isInside:function(_17,_18){
return (_17.x>_18.x&&_17.x<(_18.x+_18.width)&&_17.y>_18.y&&_17.y<(_18.y+_18.height));
},_showPlaceholder:function(_19){
this._repositionPlaceholder(_19.get_element());
var _1a=_19._getBoundsWithBorderAndMargin();
var _1b=_19._getMarginBox(this._placeholder);
var _1c=_19._getBorderBox(this._placeholder);
var _1d=this.get_isHorizontal();
var _1e=this._placeholder.style;
_1e.height=_1a.height-(_1b.vertical+_1c.vertical)+"px";
_1e.width=this.get_fitDocks()&&!_1d?"100%":_1a.width-(_1b.horizontal+_1c.horizontal)+"px";
_1e.display="block";
},_getMarginBox:function(_1f){
return $telerik.getMarginBox(_1f);
},_getBorderBox:function(_20){
return $telerik.getBorderBox(_20);
},_hidePlaceholder:function(){
this._placeholder.style.display="none";
this._lastFoundItem=null;
this._lastFoundItemBounds=null;
},_repositionPlaceholder:function(_21){
var ddm=Telerik.Web.DragDropManager._getInstance();
var _23=ddm.getScrollOffset(_21,true);
var _24=new Sys.UI.Point(window._event.clientX,window._event.clientY);
_24=ddm.addPoints(_24,_23);
var _25=this._findItemAt(_24,_21);
var _26=this.get_element();
if(null==_25){
_26.insertBefore(this._placeholder,this._clearElement);
}else{
if(_25.previousSibling!=this._placeholder){
_26.insertBefore(this._placeholder,_25);
}
}
},get_dropTargetElement:function(){
return this.get_element();
},canDrop:function(_27,_28,_29){
return (Telerik.Web.UI.RadDock&&_28===Telerik.Web.UI.RadDock.DragDataType&&(_29.get_dockMode()&Telerik.Web.UI.DockMode.Docked)>0&&Array.indexOf(_29.get_forbiddenZones(),this.get_uniqueName())<0);
},drop:function(_2a,_2b,_2c){
var _2d=new Sys.CancelEventArgs();
_2c.raise_dockPositionChanging(_2d);
this._hidePlaceholder();
if(this.get_highlightedCssClass()!=null){
this.removeCssClass(this.get_highlightedCssClass());
}
if(_2d.get_cancel()){
_2c._restorePosition();
}else{
this._dockBefore(_2c,this._placeholder);
_2c.raise_dockPositionChanged(new Sys.EventArgs());
}
},onDragEnterTarget:function(_2e,_2f,_30){
this._showPlaceholder(_30);
if(this.get_highlightedCssClass()!=null){
this.addCssClass(this.get_highlightedCssClass());
}
},onDragLeaveTarget:function(_31,_32,_33){
this._hidePlaceholder();
if(this.get_highlightedCssClass()!=null){
this.removeCssClass(this.get_highlightedCssClass());
}
},onDragInTarget:function(_34,_35,_36){
this._repositionPlaceholder(_36.get_element());
},initialize:function(){
Telerik.Web.UI.RadDockZone.callBaseMethod(this,"initialize");
Telerik.Web.DragDropManager.registerDropTarget(this);
this._resetDockIndices();
this._placeholder=$get(this.get_clientID()+"_D");
this._clearElement=$get(this.get_clientID()+"_C");
},dispose:function(){
Telerik.Web.DragDropManager.unregisterDropTarget(this);
Telerik.Web.UI.RadDockZone.callBaseMethod(this,"dispose");
},get_clientID:function(){
return this._clientID;
},set_clientID:function(_37){
this._clientID=_37;
},get_fitDocks:function(){
return this._fitDocks;
},set_fitDocks:function(_38){
this._fitDocks=_38;
},get_highlightedCssClass:function(){
return this._highlightedCssClass;
},set_highlightedCssClass:function(_39){
this._highlightedCssClass=_39;
},get_layoutID:function(){
return this._layoutID;
},set_layoutID:function(_3a){
this._layoutID=_3a;
},get_uniqueName:function(){
return this._uniqueName;
},set_uniqueName:function(_3b){
this._uniqueName=_3b;
}};
Telerik.Web.UI.RadDockZone.registerClass("Telerik.Web.UI.RadDockZone",Telerik.Web.UI.RadWebControl,Telerik.Web.IDropTarget);

