﻿Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadDockZonesGlobalArray=[];
Telerik.Web.UI.registerRadDockZone=function(a){if(!Array.contains(this.RadDockZonesGlobalArray,a)){Array.add(this.RadDockZonesGlobalArray,a)
}};
Telerik.Web.UI.unregisterRadDockZone=function(a){Array.remove(this.RadDockZonesGlobalArray,a)
};
Telerik.Web.UI.RadDockZone=function(a){Telerik.Web.UI.RadDockZone.initializeBase(this,[a]);
this._clientID=null;
this._highlightedCssClass=null;
this._fitDocks=true;
this._uniqueName=null;
this._layoutID=null
};
Telerik.Web.UI.RadDockZone.prototype={initialize:function(){Telerik.Web.UI.RadDockZone.callBaseMethod(this,"initialize");
this._resetDockIndices();
this._placeholder=$get(this.get_clientID()+"_D");
if($telerik.isRightToLeft(this.get_element())){Sys.UI.DomElement.addCssClass(this._placeholder,"rdRtl")
}this._clearElement=$get(this.get_clientID()+"_C");
Telerik.Web.UI.registerRadDockZone(this)
},dispose:function(){Telerik.Web.UI.unregisterRadDockZone(this);
Telerik.Web.UI.RadDockZone.callBaseMethod(this,"dispose")
},dock:function(c,d){var b=this.get_docks();
var a=null;
if(b.length>d){a=b[d].get_element()
}this._dockBefore(c,a,false)
},get_docks:function(){var c=[];
var b=this.get_element().firstChild;
while(b!=null){if(b!=this._placeholder&&b.id){var a=$find(b.id);
if(a&&Telerik.Web.UI.RadDock&&Telerik.Web.UI.RadDock.isInstanceOfType(a)){Array.add(c,a)
}}b=b.nextSibling
}return c
},_dockBefore:function(k,c,a,d){d=d?d:false;
var i=k.get_element();
var j=this.get_element();
var f=k.get_enableAnimation()?k.get_animationDuration():0;
var b={};
var h;
if(c){h=c;
h.style.display="";
var l=$telerik.getLocation(h);
var g=$telerik.getBounds(h);
b.left=l.x;
b.top=l.y;
b.width=g.width
}else{h=this._clearElement;
f=0
}if(!d||f==0){this._onDockBeforeAnimationEnd(k,h,a);
return
}var e=this;
$telerik.$(i).animate(b,f,function(){e._onDockBeforeAnimationEnd(k,h,a)
})
},_onDockBeforeAnimationEnd:function(e,f,b){var d=e.get_element();
var c=this.get_element();
if(f){if(f.className.indexOf("rdPlaceHolder")!=-1){f.style.display="none"
}}if(e._closed){d.style.display="none"
}c.insertBefore(d,f);
var a=$find(e.get_dockZoneID());
if(a){a._resetDockIndices()
}e.set_dockZone(this);
e.set_dockZoneID(c.id);
if(this.get_fitDocks()){if(!this.get_isHorizontal()){e._fitWidth()
}}else{if(!this.get_isHorizontal()){e._unfitWidth()
}}e._resetPosition();
if(e._tableElement){e._setSize()
}e._setPinUnpinVisibility();
this._resetDockIndices();
if(b){e.raise_dockPositionChanged(new Sys.EventArgs())
}},_resetDockIndices:function(){var b=this.get_docks();
for(var a=0;
a<b.length;
a++){b[a].set_index(a);
b[a].updateClientState()
}},get_isHorizontal:function(){return Sys.UI.DomElement.containsCssClass(this.get_element(),"rdHorizontal")
},_lastFoundItem:null,_lastFoundItemBounds:null,_findItemAt:function(a,e){var c=this.get_element();
if(!(this._lastFoundItem&&this._isInside(a,this._lastFoundItemBounds))){this._lastFoundItem=null;
this._lastFoundItemBounds=null;
var h=c.firstChild;
while(h!=null){if(h!=this._placeholder&&h!=e&&h.nodeType!=3&&h.nodeType!=8){var g=this._getMarginBox(e);
var b=this._getBorderBox(e);
var d=$telerik.getBounds(h);
var f=$telerik.getLocation(h);
d.x=f.x;
d.y=f.y;
d.x-=(($telerik.isSafari?0:g.left)+b.left+2);
d.y-=(g.top+b.top+2);
d.width+=(($telerik.isSafari?0:g.right)+b.right+2);
d.height+=(g.bottom+b.bottom+2);
if(this._isInside(a,d)){this._lastFoundItem=h;
this._lastFoundItemBounds=d;
break
}}h=h.nextSibling
}}return this._lastFoundItem
},_isInside:function(b,a){return(b.x>a.x&&b.x<(a.x+a.width)&&b.y>a.y&&b.y<(a.y+a.height))
},_showPlaceholder:function(b,c){this._repositionPlaceholder(b.get_element(),c);
var d=b._getBoundsWithBorderAndMargin();
var f=b._getMarginBox(this._placeholder);
var e=b._getBorderBox(this._placeholder);
var a=this.get_isHorizontal();
var g=this._placeholder.style;
g.height=d.height-(f.vertical+e.vertical)+"px";
g.width=this.get_fitDocks()&&!a?"100%":d.width-(f.horizontal+e.horizontal)+"px";
g.display="block"
},_repositionPlaceholder:function(c,b){var d=this._findItemAt(b,c);
var a=this.get_element();
if(null==d){a.insertBefore(this._placeholder,this._clearElement)
}else{if(d.previousSibling!=this._placeholder){a.insertBefore(this._placeholder,d)
}}},_getMarginBox:function(a){return $telerik.getMarginBox(a)
},_getBorderBox:function(a){return $telerik.getBorderBox(a)
},_hidePlaceholder:function(){this._placeholder.style.display="none";
this._lastFoundItem=null;
this._lastFoundItemBounds=null
},canDrop:function(a){return((a.get_dockMode()&Telerik.Web.UI.DockMode.Docked)>0&&Array.indexOf(a.get_forbiddenZones(),this.get_uniqueName())<0)
},drop:function(a){var b=new Sys.CancelEventArgs();
a.raise_dockPositionChanging(b);
this._hidePlaceholder();
if(this.get_highlightedCssClass()!=null){this.removeCssClass(this.get_highlightedCssClass())
}if(b.get_cancel()){a._restorePosition()
}else{this._dockBefore(a,this._placeholder,true,true)
}},dragEnterTarget:function(a,b){this._showPlaceholder(a,b);
if(this.get_highlightedCssClass()!=null){this.addCssClass(this.get_highlightedCssClass())
}},onDragInTarget:function(a,b){this._repositionPlaceholder(a.get_element(),b)
},dragLeaveTarget:function(a){this._hidePlaceholder();
if(this.get_highlightedCssClass()!=null){this.removeCssClass(this.get_highlightedCssClass())
}},pointInZone:function(a){return $telerik.isMouseOverElement(this.get_element(),a)
},hitTest:function(a,c){if(!this.canDrop(a)){return false
}if(this.pointInZone(c)){var b=$telerik.getDocumentRelativeCursorPosition(c);
loc={x:b.left,y:b.top};
this.dragEnterTarget(a,loc);
return true
}else{this.dragLeaveTarget(a);
return false
}},getScrollOffset:function(d,e){var c=d.scrollLeft;
var a=d.scrollTop;
if(e){var b=d.parentNode;
while(b!=null&&b.scrollLeft!=null){c+=b.scrollLeft;
a+=b.scrollTop;
if(b==document.body&&(c!=0&&a!=0)){break
}b=b.parentNode
}}return{x:c,y:a}
},addPoints:function(b,a){return{x:b.x+a.x,y:b.y+a.y}
},get_clientID:function(){return this._clientID
},set_clientID:function(a){this._clientID=a
},get_fitDocks:function(){return this._fitDocks
},set_fitDocks:function(a){this._fitDocks=a
},get_highlightedCssClass:function(){return this._highlightedCssClass
},set_highlightedCssClass:function(a){this._highlightedCssClass=a
},get_layoutID:function(){return this._layoutID
},set_layoutID:function(a){this._layoutID=a
},get_uniqueName:function(){return this._uniqueName
},set_uniqueName:function(a){this._uniqueName=a
}};
Telerik.Web.UI.RadDockZone.registerClass("Telerik.Web.UI.RadDockZone",Telerik.Web.UI.RadWebControl);
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();