﻿Telerik.Web.UI.RadContextMenuEventArgs=function(a){Telerik.Web.UI.RadContextMenuEventArgs.initializeBase(this);
this._domEvent=a||null;
};
Telerik.Web.UI.RadContextMenuEventArgs.prototype={get_domEvent:function(){return this._domEvent;
}};
Telerik.Web.UI.RadContextMenuEventArgs.registerClass("Telerik.Web.UI.RadContextMenuEventArgs",Sys.EventArgs);
Telerik.Web.UI.RadContextMenuShownEventArgs=function(b,a){Telerik.Web.UI.RadContextMenuShownEventArgs.initializeBase(this);
this._targetElement=b;
this._domEvent=a||null;
};
Telerik.Web.UI.RadContextMenuShownEventArgs.prototype={get_targetElement:function(){return this._targetElement;
},get_domEvent:function(){return this._domEvent;
}};
Telerik.Web.UI.RadContextMenuShownEventArgs.registerClass("Telerik.Web.UI.RadContextMenuShownEventArgs",Sys.EventArgs);
Telerik.Web.UI.RadContextMenuCancelEventArgs=function(b,a){Telerik.Web.UI.RadContextMenuCancelEventArgs.initializeBase(this);
this._targetElement=b;
this._domEvent=a;
};
Telerik.Web.UI.RadContextMenuCancelEventArgs.prototype={get_targetElement:function(){return this._targetElement;
},get_domEvent:function(){return this._domEvent;
}};
Telerik.Web.UI.RadContextMenuCancelEventArgs.registerClass("Telerik.Web.UI.RadContextMenuCancelEventArgs",Sys.CancelEventArgs);
Telerik.Web.UI.RadContextMenuShowingEventArgs=function(b,a){Telerik.Web.UI.RadContextMenuShowingEventArgs.initializeBase(this,[b,a]);
};
Telerik.Web.UI.RadContextMenuShowingEventArgs.registerClass("Telerik.Web.UI.RadContextMenuShowingEventArgs",Telerik.Web.UI.RadContextMenuCancelEventArgs);
Telerik.Web.UI.RadContextMenuItemEventArgs=function(c,b,a){Telerik.Web.UI.RadContextMenuItemEventArgs.initializeBase(this,[c,a]);
this._targetElement=b;
};
Telerik.Web.UI.RadContextMenuItemEventArgs.prototype={get_targetElement:function(){return this._targetElement;
}};
Telerik.Web.UI.RadContextMenuItemEventArgs.registerClass("Telerik.Web.UI.RadContextMenuItemEventArgs",Telerik.Web.UI.RadMenuItemEventArgs);
Telerik.Web.UI.RadContextMenuItemCancelEventArgs=function(c,b,a){Telerik.Web.UI.RadContextMenuItemCancelEventArgs.initializeBase(this,[c,a]);
this._targetElement=b;
};
Telerik.Web.UI.RadContextMenuItemCancelEventArgs.prototype={get_targetElement:function(){return this._targetElement;
}};
Telerik.Web.UI.RadContextMenuItemCancelEventArgs.registerClass("Telerik.Web.UI.RadContextMenuItemCancelEventArgs",Telerik.Web.UI.RadMenuItemCancelEventArgs);
(function(){var a=Telerik.Web.UI;
Type.registerNamespace("Telerik.Web.UI");
a.ContextMenuTargetType=function(){throw Error.notImplemented();
};
a.ContextMenuTargetType.prototype={Control:0,Element:1,TagName:2,Document:3};
a.ContextMenuTargetType.registerEnum("Telerik.Web.UI.ContextMenuTargetType");
a.RadContextMenu=function(b){a.RadContextMenu.initializeBase(this,[b]);
this._enableSelection=false;
this._targets=[];
this._targetElements=null;
this._shown=false;
this._scrollWrapElement=null;
this._scroller=null;
this._animatedElement=null;
this._slide=null;
this._collapseAnimationEndedDelegate=null;
this._detached=false;
this._currentTarget=null;
this._flow=a.ItemFlow.Vertical;
};
a.RadContextMenu.contextMenus={};
a.RadContextMenu.hideAll=function(){for(var b in a.RadContextMenu.contextMenus){a.RadContextMenu.contextMenus[b].hide();
}};
a.RadContextMenu._getAllHidden=function(){for(var b in a.RadContextMenu.contextMenus){if(a.RadContextMenu.contextMenus[b]._shown){return false;
}}return true;
};
a.RadContextMenu.prototype={initialize:function(){this.get_element().style.display="block";
this.get_element().style.visibility="hidden";
this._getContextMenuElement().style.display="block";
this._getContextMenuElement().style.visibility="hidden";
a.RadContextMenu.callBaseMethod(this,"initialize");
this._getContextMenuElement().style.display="none";
this._getContextMenuElement().style.visibility="visible";
this._getContextMenuElement().id=this.get_id()+"_detached";
this.get_element().style.display="none";
this.get_element().style.visibility="visible";
this._getContextMenuElement().style.zIndex=this._originalZIndex;
this.get_childListElement().style.cssFloat="left";
a.RadContextMenu.contextMenus[this.get_id()]=this;
this._elementContextMenu=Function.createDelegate(this,this._elementContextMenu);
this._attachShowHandlers();
this._documentClickHandler=Function.createDelegate(this,this._documentClickHandler);
$addHandler(document,"click",this._documentClickHandler);
this._itemClickedHandler=Function.createDelegate(this,this._itemClickedHandler);
this.add_itemClicked(this._itemClickedHandler);
this._initializeAnimation();
this._initializeScroller();
},dispose:function(){if(this._detached){this.attachContextMenu();
}$removeHandler(document,"click",this._documentClickHandler);
this._detachShowHandlers();
this._targetElements=null;
this._contextMenuElement=null;
if(this._collapseAnimationEndedDelegate){if(this._slide){this._slide.remove_collapseAnimationEnded(this._collapseAnimationEndedDelegate);
}this._collapseAnimationEndedDelegate=null;
}if(this._slide){this._slide.dispose();
this._slide=null;
}if(this._scroller){this._scroller.dispose();
this._scroller=null;
}delete Telerik.Web.UI.RadContextMenu.contextMenus[this.get_id()];
a.RadContextMenu.callBaseMethod(this,"dispose");
},repaint:function(){a.RadMenu._adjustRootItemWidth(this.get_id(),this.get_childListElement());
},addTargetElement:function(b){if(b){this._addTargetElement(b);
var c=$telerik.isOpera?"mousedown":"contextmenu";
$addHandler(b,c,this._elementContextMenu);
}},removeTargetElement:function(b){if(!b){return;
}var c=$telerik.isOpera?"mousedown":"contextmenu";
if(Array.remove(this._targetElements,b)){$removeHandler(b,c,this._elementContextMenu);
}},_initializeEventMap:function(){this._eventMap.initialize(this,this._getContextMenuElement());
},_childInserted:function(c,d,b){a.RadContextMenu.callBaseMethod(this,"_childInserted",[c,d,b]);
if(b._shown){if(d._getWidth()>0||d.get_isSeparator()){a.RadMenu._adjustChildrenWidth(b);
}}},_attachShowHandlers:function(){var b=$telerik.isOpera?"mousedown":"contextmenu";
var c=this._getTargetElements();
for(var d=0;
d<c.length;
d++){$addHandler(c[d],b,this._elementContextMenu);
}$addHandler(this._getContextMenuElement(),b,this._elementContextMenu);
},_detachShowHandlers:function(){var b=$telerik.isOpera?"mousedown":"contextmenu";
var d=this._getTargetElements();
for(var f=0;
f<d.length;
f++){var c=d[f];
try{$removeHandler(c,b,this._elementContextMenu);
}catch(e){}}try{$removeHandler(this._getContextMenuElement(),b,this._elementContextMenu);
}catch(e){}},_documentClickHandler:function(c){var b=this._getContextMenuElement();
if(!$telerik.isDescendant(b,c.target)){this.close();
this._clicked=false;
this._hide(c);
}},_itemClickedHandler:function(b,c){if(!this.get_clickToOpen()){this._hide(c.get_domEvent());
}},_initializeAnimation:function(){this._determineExpandDirection();
var b=this._getAnimatedElement();
if(b){this._slide=new a.jSlide(b,this.get_expandAnimation(),this.get_collapseAnimation(),this.get_enableOverlay());
this._slide.initialize();
this._slide.set_direction(this._getSlideDirection());
this._collapseAnimationEndedDelegate=Function.createDelegate(this,this._onCollapseAnimationEnded);
this._slide.add_collapseAnimationEnded(this._collapseAnimationEndedDelegate);
this._expandAnimationStartedDelegate=Function.createDelegate(this,this._onExpandAnimationStarted);
this._slide.add_expandAnimationStarted(this._expandAnimationStartedDelegate);
this._expandAnimationEndedDelegate=Function.createDelegate(this,this._onExpandAnimationEnded);
this._slide.add_expandAnimationEnded(this._expandAnimationEndedDelegate);
}},_getRtlClassName:function(){var b=a.RadContextMenu.callBaseMethod(this,"_getRtlClassName");
return b+" RadMenu_Context_rtl";
},_getMainElement:function(){return this._getContextMenuElement();
},_getSlideDirection:function(){var b=this.get_defaultGroupSettings().get_expandDirection();
if(b==a.ExpandDirection.Auto){return null;
}return b;
},_getScrollWrapElement:function(){var b=this._getContextMenuElement();
if(!this._scrollWrapElement){if(this.get_defaultGroupSettings().get_height()||this.get_defaultGroupSettings().get_width()){this._scrollWrapElement=$telerik.getFirstChildByTagName(b,"div",0);
}}return this._scrollWrapElement;
},_getAnimatedElement:function(){if(!this._animatedElement){this._animatedElement=this._getScrollWrapElement()||this.get_childListElement();
}return this._animatedElement;
},_determineExpandDirection:function(){var b=this.get_defaultGroupSettings();
if(b.get_expandDirection()!=a.ExpandDirection.Auto){return;
}b.set_expandDirection(a.ExpandDirection.Down);
},_onExpandAnimationEnded:function(){},_onExpandAnimationStarted:function(){},_onCollapseAnimationEnded:function(){this._restoreZIndex();
},_getTargetElements:function(){if(this._targetElements==null){this._targetElements=[];
for(var b=0;
b<this._targets.length;
b++){this._addTargetElements(this._targets[b]);
}}return this._targetElements;
},_addTargetElements:function(b){switch(b.type){case a.ContextMenuTargetType.Document:this._addTargetElement(document);
break;
case a.ContextMenuTargetType.Control:case a.ContextMenuTargetType.Element:this._addTargetElement($get(b.id));
break;
case a.ContextMenuTargetType.TagName:var d=document.getElementsByTagName(b.tagName);
for(var c=0;
c<d.length;
c++){this._addTargetElement(d[c]);
}break;
}},_addTargetElement:function(b){if(b){this._targetElements[this._targetElements.length]=b;
}},_adjustPositionForScreenBoundaries:function(b,d){var c=a.RadMenu._getViewPortSize();
var e=this._getContextMenuElement();
d=Math.min(d,c.height-e.offsetHeight);
if(this.get_rightToLeft()){b=Math.max(0,b);
}else{b=Math.min(b,c.width-e.offsetWidth);
}if(isNaN(b)){b=0;
}if(isNaN(d)){d=0;
}this._getContextMenuElement().style.left=b+"px";
this._getContextMenuElement().style.top=d+"px";
},_detach:function(){if(!$telerik.isIE||document.readyState=="complete"||document.readyState=="interactive"){this._getContextMenuElement().parentNode.removeChild(this._getContextMenuElement());
var b=theForm||document.body;
b.insertBefore(this._getContextMenuElement(),b.firstChild);
this._detached=true;
}},_getContextMenuElement:function(){if(!this._contextMenuElement){this._contextMenuElement=$telerik.getFirstChildByTagName(this.get_element(),"div",0);
}return this._contextMenuElement;
},_isMainElementDescendant:function(b){return $telerik.isDescendant(this._getContextMenuElement(),b);
},attachContextMenu:function(){if(!this._detached){return;
}this._getContextMenuElement().parentNode.removeChild(this._getContextMenuElement());
this.get_element().insertBefore(this._getContextMenuElement(),$get(this.get_clientStateFieldID()));
this._detached=false;
},_getExtendedItemClickingEventArgs:function(b){return new a.RadContextMenuItemCancelEventArgs(b.get_item(),this._targetElement,b.get_domEvent());
},_getExtendedItemClickedEventArgs:function(b){return new a.RadContextMenuItemEventArgs(b.get_item(),this._targetElement,b.get_domEvent());
},_updateScrollWrapSize:function(){var b=this._getScrollWrapElement();
var c=this.get_childListElement();
if(!b){return;
}if(!b.style.height){b.style.height=c.offsetHeight+"px";
}b.style.width=c.offsetWidth+"px";
},_getAnimationContainer:function(){return this._getContextMenuElement();
},_initializeScroller:function(){var b=this._getScrollWrapElement();
if(b){this._scroller=new a.MenuItemScroller(this.get_childListElement(),a.ItemFlow.Vertical);
this._scroller.initialize();
}},_adjustRootItemsWidthOnShow:function(){var e=this.get_items();
var c=e.get_count();
for(var b=0;
b<c;
b++){var d=e.getItem(b);
if(d._adjustSiblingsWidthOnShow){d._adjustSiblingsWidth();
d._adjustSiblingsWidthOnShow=false;
return;
}}},_onTopArrowMouseDown:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseDown",[b]);
return;
}this._onScrollArrowMouseDown(a.ArrowPosition.Top);
},_onTopArrowMouseUp:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseDown",[b]);
return;
}this._onScrollArrowMouseUp(a.ArrowPosition.Top);
},_onTopArrowMouseOver:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseOver",[b]);
return;
}this._onScrollArrowMouseOver(a.ArrowPosition.Top);
},_onTopArrowMouseOut:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onTopArrowMouseOut",[b]);
return;
}this._onScrollArrowMouseOut(a.ArrowPosition.Top);
},_onBottomArrowMouseDown:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseDown",[b]);
return;
}this._onScrollArrowMouseDown(a.ArrowPosition.Bottom);
},_onBottomArrowMouseUp:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseUp",[b]);
return;
}this._onScrollArrowMouseUp(a.ArrowPosition.Bottom);
},_onBottomArrowMouseOver:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseOver",[b]);
return;
}this._onScrollArrowMouseOver(a.ArrowPosition.Bottom);
},_onBottomArrowMouseOut:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onBottomArrowMouseOut",[b]);
return;
}this._onScrollArrowMouseOut(a.ArrowPosition.Bottom);
},_onLeftArrowMouseDown:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseDown",[b]);
return;
}this._onScrollArrowMouseDown(a.ArrowPosition.Left);
},_onLeftArrowMouseUp:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseUp",[b]);
return;
}this._onScrollArrowMouseUp(a.ArrowPosition.Left);
},_onLeftArrowMouseOver:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseOver",[b]);
return;
}this._onScrollArrowMouseOver(a.ArrowPosition.Left);
},_onLeftArrowMouseOut:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onLeftArrowMouseOut",[b]);
return;
}this._onScrollArrowMouseOut(a.ArrowPosition.Left);
},_onRightArrowMouseDown:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseDown",[b]);
return;
}this._onScrollArrowMouseDown(a.ArrowPosition.Right);
},_onRightArrowMouseUp:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseUp",[b]);
return;
}this._onScrollArrowMouseUp(a.ArrowPosition.Right);
},_onRightArrowMouseOver:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseOver",[b]);
return;
}this._onScrollArrowMouseOver(a.ArrowPosition.Right);
},_onRightArrowMouseOut:function(b){var c=this._extractItemFromDomElement(b.eventMapTarget);
if(c!=null){a.RadContextMenu.callBaseMethod(this,"_onRightArrowMouseOut",[b]);
return;
}this._onScrollArrowMouseOut(a.ArrowPosition.Right);
},_onScrollArrowMouseDown:function(){if(!this._scroller){return;
}this._scroller.changeScrollSpeed(a.ScrollerSpeed.Fast);
},_onScrollArrowMouseUp:function(){if(!this._scroller){return;
}this._scroller.changeScrollSpeed(a.ScrollerSpeed.Slow);
},_onScrollArrowMouseOver:function(b){if(!this._scroller){return;
}var c=1;
if(b==a.ArrowPosition.Top||b==a.ArrowPosition.Left){c=-1;
}this._scroller.startScroll(a.ScrollerSpeed.Slow,c);
},_onScrollArrowMouseOut:function(){if(!this._scroller){return;
}this._scroller.stopScroll();
},_elementContextMenu:function(b){if($telerik.isDescendantOrSelf(this._getContextMenuElement(),b.target)){$telerik.cancelRawEvent(b);
return false;
}if($telerik.isOpera){if(b.button!=2){return;
}}this.show(b);
},_showAt:function(b,c,d){a.RadContextMenu.hideAll();
if(!a.RadContextMenu._getAllHidden()){return;
}this._shown=true;
if(!this._detached){this._detach();
if(this._rightToLeft&&$telerik.isIE6){this._getContextMenuElement().dir="rtl";
}this._getContextMenuElement().style.visibility="hidden";
this._getContextMenuElement().style.display="block";
this.repaint();
}this._slide.show();
this._adjustRootItemsWidthOnShow();
this._updateScrollWrapSize();
this._slide.updateSize();
if(this._rightToLeft){b-=this._getContextMenuElement().offsetWidth;
}this._getContextMenuElement().style.left=b+"px";
this._getContextMenuElement().style.top=c+"px";
if(this.get_enableScreenBoundaryDetection()){this._adjustPositionForScreenBoundaries(b,c);
}if(this._scroller){this._scroller.updateState();
}this._getContextMenuElement().style.visibility="visible";
this._slide.expand();
this.raise_shown(new a.RadContextMenuShownEventArgs(this._targetElement,d||null));
},_hide:function(c){if(!this._shown){return;
}var d=new a.RadContextMenuCancelEventArgs(this._targetElement,c||null);
this.raise_hiding(d);
if(d.get_cancel()){return;
}this._shown=false;
this._slide.collapse();
this.raise_hidden(new a.RadContextMenuEventArgs(c||null));
this._targetElement=null;
this._clicked=false;
if(this._focusedItem){this._focusedItem._doBlur();
}var b=this.get_openedItem();
if(b){b.close();
}},get_childListElement:function(){if(this._getScrollWrapElement()){this._childListElement=$telerik.getFirstChildByTagName(this._getScrollWrapElement(),"ul",0);
}if(!this._childListElement){this._childListElement=$telerik.getFirstChildByTagName(this._getContextMenuElement(),"ul",0);
}return this._childListElement;
},set_targets:function(b){this._targets=b;
},get_targets:function(){return this._targets;
},get_contextMenuElement:function(){return this._getContextMenuElement();
},_adjustRootItemWidth:function(){},show:function(c){if(this._shown){this._hide();
}this._targetElement=c.target;
var d=new a.RadContextMenuShowingEventArgs(this._targetElement,c||null);
this.raise_showing(d);
if(d.get_cancel()){return;
}var b=$telerik.getDocumentRelativeCursorPosition(c);
this._showAt(b.left,b.top,c);
$telerik.cancelRawEvent(c);
},showAt:function(b,c){var d=new a.RadContextMenuShowingEventArgs();
this.raise_showing(d);
if(d.get_cancel()){return;
}this._showAt(b,c,null);
},hide:function(){this._hide(null);
},add_showing:function(b){this.get_events().addHandler("showing",b);
},remove_showing:function(b){this.get_events().removeHandler("showing",b);
},raise_showing:function(b){if(this._fireEvents){this.raiseEvent("showing",b);
}},raise_hiding:function(b){if(this._fireEvents){this.raiseEvent("hiding",b);
}},add_shown:function(b){this.get_events().addHandler("shown",b);
},remove_shown:function(b){this.get_events().removeHandler("shown",b);
},raise_shown:function(b){if(this._fireEvents){this.raiseEvent("shown",b);
}},add_hiding:function(b){this.get_events().addHandler("hiding",b);
},remove_hiding:function(b){this.get_events().removeHandler("hiding",b);
},add_hidden:function(b){this.get_events().addHandler("hidden",b);
},remove_hidden:function(b){this.get_events().removeHandler("hidden",b);
},raise_hidden:function(b){if(this._fireEvents){this.raiseEvent("hidden",b);
}}};
a.RadContextMenu.registerClass("Telerik.Web.UI.RadContextMenu",a.RadMenu);
})();

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();