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