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.toDockZone=function(a){return a;
};
$telerik.findDockZone=$find;
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;
this._dropDownTouchScroll=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");
if(Telerik.Web.UI.TouchScrollExtender._getNeedsScrollExtender()&&!this._dropDownTouchScroll){this._createTouchScrollExtender(true);
}Telerik.Web.UI.registerRadDockZone(this);
},dispose:function(){this._createTouchScrollExtender(false);
Telerik.Web.UI.unregisterRadDockZone(this);
Telerik.Web.UI.RadDockZone.callBaseMethod(this,"dispose");
},_createTouchScrollExtender:function(c){var a=this.get_element();
if(a){var b=this._dropDownTouchScroll;
if(b){if(!c){b.dispose();
this._dropDownTouchScroll=null;
}}else{if(c){var d=$telerik.$(a).css("overflowY");
if(d=="auto"){this._dropDownTouchScroll=new Telerik.Web.UI.TouchScrollExtender(a);
this._dropDownTouchScroll.initialize();
}}}}},dock:function(a,b){var c=this.get_docks();
var d=null;
if(c.length>b){d=c[b].get_element();
}this._dockBefore(a,d,false);
a._hitZone=null;
},get_docks:function(){var c=[];
var a=this.get_element().firstChild;
while(a!=null){if(a!=this._placeholder&&a.id){var b=$find(a.id);
if(b&&Telerik.Web.UI.RadDock&&Telerik.Web.UI.RadDock.isInstanceOfType(b)){Array.add(c,b);
}}a=a.nextSibling;
}return c;
},_dockBefore:function(i,a,f,n){n=n?n:false;
var h=i.get_element();
var b=this.get_element();
var l=i.get_enableAnimation()?i.get_animationDuration():0;
var e={};
var j;
if(a){if(a!=this._placeholder){b.insertBefore(this._placeholder,a);
a=this._placeholder;
}j=a;
j.style.display="";
var k=$telerik.getLocation(j);
var g=$telerik.getBounds(j);
e.left=k.x;
e.top=k.y;
var m=g.width>5?g.width:parseInt(i.get_width());
e.width=m;
}else{j=this._clearElement;
l=0;
}var d=i.get_titleElement();
if(d!=null){d.style.display="none";
}if(!n||l==0){this._onDockBeforeAnimationEnd(i,j,f);
return;
}var c=this;
$telerik.$(h).animate(e,l,function(){c._onDockBeforeAnimationEnd(i,j,f);
});
},_onDockBeforeAnimationEnd:function(a,b,c){var d=a.get_element();
var f=this.get_element();
if(b){if(b.className.indexOf("rdPlaceHolder")!=-1){b.style.display="none";
}}var g=a.get_titleElement();
if(g!=null){g.style.display="block";
}if(a._closed){d.style.display="none";
}f.insertBefore(d,b);
var e=$find(a.get_dockZoneID());
if(e){e._resetDockIndices();
}a.set_dockZone(this);
a.set_dockZoneID(f.id);
if(this.get_fitDocks()){if(!this.get_isHorizontal()){a._fitWidth();
}}else{if(!this.get_isHorizontal()){a._unfitWidth();
}}a._resetPosition();
a._setPinUnpinVisibility();
this._resetDockIndices();
if(c){a.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(j,g){var c=this.get_element();
if(!(this._lastFoundItem&&this._isInside(j,this._lastFoundItemBounds))){this._lastFoundItem=null;
this._lastFoundItemBounds=null;
var b=c.firstChild;
while(b!=null){if(b!=g&&b.nodeType!=3&&b.nodeType!=8){var d=this.get_isHorizontal();
var k=this._getMarginBox(g);
var f=this._getBorderBox(g);
var i=$telerik.getBounds(b);
var h=$telerik.getLocation(b);
i.x=h.x;
i.y=h.y;
i.x-=(($telerik.isSafari?0:k.left)+f.left+2);
i.y-=(k.top+f.top+2);
i.width+=(($telerik.isSafari?0:k.right)+f.right+2);
i.height+=(k.bottom+f.bottom+2);
var a={x:i.x,y:i.y,width:(d?i.width/2:i.width),height:(d?i.height:i.height/2)};
if(this._isInside(j,a)){this._lastFoundItem=b;
this._lastFoundItemBounds=a;
break;
}var e={x:i.x+(d?i.width/2:0),y:i.y+(d?0:i.height/2),width:(d?i.width/2:i.width),height:(d?i.height:i.height/2)};
if(this._isInside(j,e)){if(b.nextSibling){this._lastFoundItem=b.nextSibling;
this._lastFoundItemBounds=e;
break;
}}}b=b.nextSibling;
}}return this._lastFoundItem;
},_isInside:function(a,b){return(a.x>b.x&&a.x<(b.x+b.width)&&a.y>b.y&&a.y<(b.y+b.height));
},_showPlaceholder:function(g,b){this._repositionPlaceholder(g.get_element(),b);
var d=this.get_docks();
if(d.length>0){for(var h=0;
h<d.length;
h++){if(d[h].get_closed()==false){var j=g._getBounds();
var a=g._getMarginBox(this._placeholder);
var c=g._getBorderBox(this._placeholder);
var e=this.get_isHorizontal();
var f=this._placeholder.style;
f.height=j.height-(a.vertical+c.vertical)+"px";
f.width=this.get_fitDocks()&&!e?"100%":j.width-(a.horizontal+c.horizontal)+"px";
f.display="block";
return;
}}}if(this.get_highlightedCssClass()==null){Sys.UI.DomElement.addCssClass(this.get_element(),"rdPlaceHolder");
}},_repositionPlaceholder:function(a,b){var d=this._findItemAt(b,a);
var c=this.get_element();
if(null==d){c.insertBefore(this._placeholder,this._clearElement);
}else{if(d.previousSibling!=this._placeholder){c.insertBefore(this._placeholder,d);
}}},_getMarginBox:function(a){return $telerik.getMarginBox(a);
},_getBorderBox:function(a){return $telerik.getBorderBox(a);
},_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(a){var b=a.get_allowedZones();
var c=this.get_uniqueName();
return((a.get_dockMode()&Telerik.Web.UI.DockMode.Docked)>0&&Array.indexOf(a.get_forbiddenZones(),c)<0&&(b.length==0||Array.indexOf(b,c)>=0));
},drop:function(b){var a=new Sys.CancelEventArgs();
b.raise_dockPositionChanging(a);
this._hidePlaceholder();
if(this.get_highlightedCssClass()!=null){this.removeCssClass(this.get_highlightedCssClass());
}if(a.get_cancel()){b._restorePosition();
}else{this._dockBefore(b,this._placeholder,true,true);
}},dragEnterTarget:function(b,a){this._showPlaceholder(b,a);
if(this.get_highlightedCssClass()!=null){this.addCssClass(this.get_highlightedCssClass());
}},onDragInTarget:function(b,a){this._repositionPlaceholder(b.get_element(),a);
},dragLeaveTarget:function(a){this._hidePlaceholder();
if(this.get_highlightedCssClass()!=null){this.removeCssClass(this.get_highlightedCssClass());
}},hitTest:function(a,b,d){if(!this.canDrop(a)){return false;
}if(d==null){d=true;
}var f=$telerik.getDocumentRelativeCursorPosition(b);
var c=$telerik.isTouchDevice?$telerik.getTouchEventLocation(b):{x:f.left,y:f.top};
if($telerik.containsPoint($telerik.getBounds(this.get_element()),c.x,c.y)){if(d){this.dragEnterTarget(a,c);
}return true;
}else{this.dragLeaveTarget(a);
return false;
}},getScrollOffset:function(a,e){var c=a.scrollLeft;
var d=a.scrollTop;
if(e){var b=a.parentNode;
while(b!=null&&b.scrollLeft!=null){c+=b.scrollLeft;
d+=b.scrollTop;
if(b==document.body&&(c!=0&&d!=0)){break;
}b=b.parentNode;
}}return{x:c,y:d};
},clone:function(a){if(!a){a="RadDockZoneClone_"+(new Date()-100);
}var f=this.get_element();
var g=f.cloneNode(true);
g.setAttribute("id",a);
g.removeAttribute("control");
g.innerHTML="";
var e=this._placeholder.cloneNode(true);
e.setAttribute("id",a+"_D");
g.appendChild(e);
var c=$get(this._clientStateFieldID).cloneNode(true);
c.setAttribute("id",a+"_ClientState");
g.appendChild(c);
var b;
if(this._clearElement){b=this._clearElement.cloneNode(true);
b.setAttribute("id",a+"_C");
g.appendChild(b);
}f.parentNode.insertBefore(g,f.nextSibling);
var d=$telerik.cloneControl(this,Telerik.Web.UI.RadDockZone,g);
d._uniqueName=a;
d._placeholder=e;
if(b){d._clearElement=b;
}return d;
},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();
