﻿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(o,t){var r=this.get_element();
if(!(this._lastFoundItem&&this._isInside(o,this._lastFoundItemBounds))){this._lastFoundItem=null;
this._lastFoundItemBounds=null;
var m=r.firstChild;
while(m!=null){if(m!=t&&m.nodeType!=3&&m.nodeType!=8){var p=this.get_isHorizontal();
var v=this._getMarginBox(t);
var q=this._getBorderBox(t);
var s=$telerik.getBounds(m);
var u=$telerik.getLocation(m);
s.x=u.x;
s.y=u.y;
s.x-=(($telerik.isSafari?0:v.left)+q.left+2);
s.y-=(v.top+q.top+2);
s.width+=(($telerik.isSafari?0:v.right)+q.right+2);
s.height+=(v.bottom+q.bottom+2);
var l={x:s.x,y:s.y,width:(p?s.width/2:s.width),height:(p?s.height:s.height/2)};
if(this._isInside(o,l)){this._lastFoundItem=m;
this._lastFoundItemBounds=l;
break
}var n={x:s.x+(p?s.width/2:0),y:s.y+(p?0:s.height/2),width:(p?s.width/2:s.width),height:(p?s.height:s.height/2)};
if(this._isInside(o,n)){if(m.nextSibling){this._lastFoundItem=m.nextSibling;
this._lastFoundItemBounds=n;
break
}}}m=m.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(o,n){this._repositionPlaceholder(o.get_element(),n);
var m=this.get_docks();
if(m.length>0){for(var k=0;
k<m.length;
k++){if(m[k].get_closed()==false){var p=o._getBoundsWithBorderAndMargin();
var r=o._getMarginBox(this._placeholder);
var l=o._getBorderBox(this._placeholder);
var q=this.get_isHorizontal();
var i=this._placeholder.style;
i.height=p.height-(r.vertical+l.vertical)+"px";
i.width=this.get_fitDocks()&&!q?"100%":p.width-(r.horizontal+l.horizontal)+"px";
i.display="block";
return
}}}if(this.get_highlightedCssClass()==null){Sys.UI.DomElement.addCssClass(this.get_element(),"rdPlaceHolder")
}},_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(){Sys.UI.DomElement.removeCssClass(this.get_element(),"rdPlaceHolder");
this._placeholder.style.display="none";
this._lastFoundItem=null;
this._lastFoundItemBounds=null
},hidePlaceholder:function(){this._hidePlaceholder()
},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(e,h,g){if(!this.canDrop(e)){return false
}if(g==null){g=true
}if(this.pointInZone(h)){if(g){var f=$telerik.getDocumentRelativeCursorPosition(h);
loc={x:f.left,y:f.top};
this.dragEnterTarget(e,loc)
}return true
}else{this.dragLeaveTarget(e);
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();