﻿Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadDockZone=function(_1){
Telerik.Web.UI.RadDockZone.initializeBase(this,[_1]);
this._clientID=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()){
}else{
this._fitWidth(_9.get_element());
}
}
_9._resetPosition();
_9._setDockedCommandsVisibility();
_9._setCommandsContainerWidth();
this._resetDockIndices();
},_fitWidth:function(_d){
_d.style.width="100%";
},_fitHeight:function(_e){
_e.style.height="100%";
},_resetDockIndices:function(){
var _f=this.get_Docks();
for(var i=0;i<_f.length;i++){
_f[i].set_Index(i);
_f[i].updateClientState();
}
},get_IsHorizontal:function(){
return Telerik.Web.DomElement.containsCssClass(this.get_element(),"rdHorizontal");
},_lastFoundItem:null,_lastFoundItemBounds:null,_findItemAt:function(_11,_12){
var el=this.get_element();
if(!(this._lastFoundItem&&this._isInside(_11,this._lastFoundItemBounds))){
this._lastFoundItem=null;
this._lastFoundItemBounds=null;
var _14=el.firstChild;
while(_14!=null){
if(_14!=this._placeholder&&_14!=_12&&_14.nodeType!=3){
var _15=this._getMarginBox(_12);
var _16=this._getBorderBox(_12);
var _17=Telerik.Web.DomElement.getBounds(_14);
var loc=$telerikCommon.getLocationWithScrollOffset(_14);
_17.x=loc.x;
_17.y=loc.y;
_17.x-=(_15.left+_16.left+2);
_17.y-=(_15.top+_16.top+2);
_17.width+=(_15.right+_16.right+2);
_17.height+=(_15.bottom+_16.bottom+2);
if(this._isInside(_11,_17)){
this._lastFoundItem=_14;
this._lastFoundItemBounds=_17;
break;
}
}
_14=_14.nextSibling;
}
}
return this._lastFoundItem;
},_isInside:function(_19,_1a){
return (_19.x>_1a.x&&_19.x<(_1a.x+_1a.width)&&_19.y>_1a.y&&_19.y<(_1a.y+_1a.height));
},_showPlaceholder:function(_1b){
this._repositionPlaceholder(_1b);
var _1c=Sys.UI.DomElement.getBounds(_1b);
var _1d=this._getMarginBox(_1b);
var _1e=this._getBorderBox(_1b);
var _1f=this._getMarginBox(this._placeholder);
var _20=this._getBorderBox(this._placeholder);
var _21=this.get_IsHorizontal();
this._placeholder.style.height=(_1c.height+_1d.vertical+_1e.vertical-_1f.vertical-_20.vertical)+"px";
this._placeholder.style.width=this.get_FitDocks()&&!_21?"100%":(_1c.width+_1d.horizontal+_1e.horizontal-_1f.horizontal-_20.horizontal)+"px";
this._placeholder.style.display="block";
},_getMarginBox:function(_22){
return Telerik.Web.CommonScripts.getMarginBox(_22);
},_getBorderBox:function(_23){
return Telerik.Web.CommonScripts.getBorderBox(_23);
},_hidePlaceholder:function(){
this._placeholder.style.display="none";
this._lastFoundItem=null;
this._lastFoundItemBounds=null;
},_addPoints:function(p1,p2){
return {x:p1.x+p2.x,y:p1.y+p2.y};
},_getScrollOffset:function(_26,_27){
var _28=_26.scrollLeft;
var top=_26.scrollTop;
if(_27){
var _2a=_26.parentNode;
while(_2a!=null&&_2a.scrollLeft!=null){
_28+=_2a.scrollLeft;
top+=_2a.scrollTop;
if(_2a==document.body&&(_28!=0&&top!=0)){
break;
}
_2a=_2a.parentNode;
}
}
return {x:_28,y:top};
},_repositionPlaceholder:function(_2b){
var _2c=this._getScrollOffset(_2b,true);
var _2d=new Sys.UI.Point(window._event.clientX,window._event.clientY);
_2d=this._addPoints(_2d,_2c);
var _2e=this._findItemAt(_2d,_2b);
var _2f=this.get_element();
if(null==_2e){
_2f.insertBefore(this._placeholder,this._clearElement);
}else{
if(_2e.previousSibling!=this._placeholder){
_2f.insertBefore(this._placeholder,_2e);
}
}
},get_dropTargetElement:function(){
return this.get_element();
},canDrop:function(_30,_31,_32){
return (_31===Telerik.Web.UI.RadDock.DragDataType&&(_32.get_DockMode()&Telerik.Web.UI.DockMode.Docked)>0&&Array.indexOf(_32.get_ForbiddenZones(),this.get_UniqueName())<0);
},drop:function(_33,_34,_35){
var _36=new Sys.CancelEventArgs();
_35.raise_DockPositionChanging(_36);
this._hidePlaceholder();
if(_36.get_cancel()){
_35._restorePosition();
}else{
this._dockBefore(_35,this._placeholder);
_35.raise_DockPositionChanged(new Sys.EventArgs());
}
},onDragEnterTarget:function(_37,_38,_39){
this._showPlaceholder(_39.get_element());
},onDragLeaveTarget:function(_3a,_3b,_3c){
this._hidePlaceholder();
},onDragInTarget:function(_3d,_3e,_3f){
this._repositionPlaceholder(_3f.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(_40){
this._clientID=_40;
},get_FitDocks:function(){
return this._fitDocks;
},set_FitDocks:function(_41){
this._fitDocks=_41;
},get_LayoutID:function(){
return this._layoutID;
},set_LayoutID:function(_42){
this._layoutID=_42;
},get_UniqueName:function(){
return this._uniqueName;
},set_UniqueName:function(_43){
this._uniqueName=_43;
}};
Telerik.Web.UI.RadDockZone.registerClass("Telerik.Web.UI.RadDockZone",Telerik.Web.UI.RadWebControl,Telerik.Web.IDropTarget);


if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();