﻿Type.registerNamespace("Telerik.Web.UI");
(function(){var b=$telerik.$;
var a=Telerik.Web.UI;
a.DialogDefinition=function(){this.Width="600px";
this.Height="400px";
this.Title="";
this.Behaviors=36;
this.Modal=true;
this.VisibleStatusbar=false;
this.VisibleTitlebar=true;
this.ClientCallbackFunction="";
};
a.DialogDefinition.registerClass("Telerik.Web.UI.DialogDefinition",null);
a.DialogDefinitionsDictionary=function(g){for(var f in g){var d=g[f];
var e=new a.DialogDefinition();
for(var c in d){e[c]=d[c];
}this[f]=e;
}};
a.DialogDefinitionsDictionary.registerClass("Telerik.Web.UI.DialogDefinitionsDictionary",null);
a.DialogOpenEventArgs=function(c,d){a.DialogOpenEventArgs.initializeBase(this);
this._dialogName=c;
if(d){this._parameters=d;
}else{this._parameters={};
}};
a.DialogOpenEventArgs.prototype={get_dialogName:function(){return this._dialogName;
},set_parameters:function(c){this._parameters=c;
},get_parameters:function(){return this._parameters;
}};
a.DialogOpenEventArgs.registerClass("Telerik.Web.UI.DialogOpenEventArgs",Sys.EventArgs);
a.RadDialogOpener=function(c){a.RadDialogOpener.initializeBase(this,[c]);
this._dialogDefinitions={};
this._handlerChecked=false;
this._dialogParametersProviderTypeName="";
this._dialogUniqueID="";
this._dialogContainers={};
};
a.RadDialogOpener.prototype={initialize:function(){a.RadDialogOpener.callBaseMethod(this,"initialize");
this._dialogDefinitions=new a.DialogDefinitionsDictionary(this.get_dialogDefinitions());
},get_dialogDefinitions:function(){return this._dialogDefinitions;
},openUrl:function(l,o,p,d,f,g,k,i,e,h,j,n){n="EXTERNAL_URL"+(n||"default");
var m=this._getDialogContainer(n);
m.set_width(p+"px");
m.set_height(d+"px");
m.set_behaviors(e||a.WindowBehaviors.Default);
m.set_modal(i==true);
m.set_visibleStatusbar(h==true);
m.set_visibleTitlebar(j==true);
m.set_title(k?k:"");
var c=new a.DialogOpenEventArgs(l,o);
this.raiseEvent("open",c);
m.ClientParameters=o;
m.set_clientCallBackFunction(f);
m.setUrl(l);
m.show();
m.center();
window.setTimeout(function(){m.setActive(true);
},100);
},open:function(c,h,k){if(!this._handlerChecked){this._checkDialogHandler(this.get_handlerUrl());
}var d=this._getDialogDefinition(c);
var j=new a.DialogOpenEventArgs(c,h);
this.raiseEvent("open",j);
var h=j.get_parameters();
if(!k){k=d.ClientCallbackFunction;
}if(this.get_useClassicDialogs()){var i=$create(a.ClassicDialog,{dialogOpener:this});
i.ClientParameters=h;
this._applyParameters(c,i);
if(k){i.set_clientCallBackFunction(k);
}window.__getCurrentRadEditorRadWindowReference=function(){return i;
};
var g="width="+parseInt(d.Width)+",height="+parseInt(d.Height);
g+=",resizable=0,scrollbars=0,status=0,toolbar=0,menubar=0,directories=0";
var f=i.open(g,c);
f.radWindow=i;
return f;
}else{var i=this._getDialogContainer(c);
var e=d.Height;
i.set_height(e);
i.set_width(d.Width);
i.set_behaviors(d.Behaviors);
i.set_modal(d.Modal);
i.set_visibleStatusbar(d.VisibleStatusbar);
i.set_visibleTitlebar(d.VisibleTitlebar);
if(d.ReloadOnShow!=null){i.set_reloadOnShow(d.ReloadOnShow);
}i.ClientParameters=h;
this._applyParameters(c,i);
if(k){i.set_clientCallBackFunction(k);
}i.show();
i.set_height(e);
i.center();
window.setTimeout(function(){i.setActive(true);
},100);
}},openLight:function(c,f,i){var h=new a.DialogOpenEventArgs(c,f);
this.raiseEvent("open",h);
var f=h.get_parameters();
var g=this._getDialogContainer(c);
var d=195;
var e=350;
g.set_height(d);
g.set_width(e);
g.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move+Telerik.Web.UI.WindowBehaviors.Close);
g.set_modal(true);
g.set_visibleStatusbar(false);
g.set_visibleTitlebar(true);
if(i){g.set_clientCallBackFunction(i);
}g.ClientParameters=f;
Telerik.Web.UI.LightDialogsControllerClass.initializeLightDialog(g);
g.show();
g.set_height(d);
g.center();
window.setTimeout(function(){g.setActive(true);
},100);
},_applyParameters:function(c,j){var n=this._getDialogParameters(c);
if(!n){return;
}var k="&dp="+encodeURIComponent(n);
var e=this._getBaseDialogUrl(c);
var d=e.length+k.length;
var m=this._dialogParametersProviderTypeName=="";
var g=m&&d<=this.get_dialogUrlLengthLimit();
if(g){var h=j.get_navigateUrl();
var i=e+k;
if(h!=i){j.setUrl(i);
}else{var l=j.get_contentFrame();
if(l&&l.contentWindow&&l.contentWindow.$find){var f=l.contentWindow.initDialog;
if(f){l.contentWindow.setTimeout(function(){f();
},1);
}}}}else{j.setUrl(e);
j.DialogParameters=n;
}},_closeContainerDelegate:function(c){this.raiseEvent("close",c);
},_getDialogContainer:function(d){if(typeof(this._dialogContainers[d])=="undefined"){var c=$find(this.get_id()+d);
if(null!=c){c.dispose();
}this._dialogContainers[d]=this.get_container().clone(this.get_id()+d);
var e=this;
this._dialogContainers[d].get_dialogOpener=function(){return e;
};
this._dialogContainers[d].add_close(Function.createDelegate(this,this._closeContainerDelegate));
}return this._dialogContainers[d];
},_getBaseDialogUrl:function(e){var d=this.get_handlerUrl().indexOf("?")<0?"?":"&";
var c=this.get_handlerUrl()+d+"DialogName="+e;
if(this.get_enableTelerikManagers()){c+="&UseRSM=true";
}c+="&Skin="+this.get_skin()+"&Title="+encodeURIComponent(this._getDialogDefinition(e)["Title"])+"&doid="+this._dialogUniqueID+"&dpptn="+encodeURIComponent(this._dialogParametersProviderTypeName)+this.get_additionalQueryString();
return c;
},_getDialogDefinition:function(c){var d=this.get_dialogDefinitions()[c];
if(d){return d;
}else{throw Error.argumentNull("dialogName",String.format("Dialog Parameters for the {0} dialog do not exist",c));
}},_getDialogParameters:function(c){return this._getDialogDefinition(c)["SerializedParameters"];
},_checkDialogHandler:function(c){var e=c.indexOf("?")<0?"?":"&";
var g=c+e+"checkHandler=true";
var f=new Sys.Net.WebRequest();
f.set_url(g);
f.add_completed(Function.createDelegate(this,this._checkRequestCompleted));
var d=new Sys.Net.XMLHttpExecutor();
f.set_executor(d);
d.executeRequest();
},_checkRequestCompleted:function(c,e){if(c.get_responseAvailable()){var f=c.get_webRequest();
var d=c.get_responseData();
if(d&&d.indexOf("HandlerCheckOK")>0){this._handlerChecked=true;
return;
}}window.alert("Web.config registration missing!\n The Telerik dialogs require a HttpHandler registration in the web.config file. Please, use the control's Smart Tag to add the handler automatically, or see the help for more information: Controls > RadEditor > Dialogs > Introduction");
}};
b.registerControlProperties(a.RadDialogOpener,{additionalQueryString:"",enableTelerikManagers:false,handlerUrl:"",container:null,dialogUrlLengthLimit:2000,useClassicDialogs:false,skin:""});
b.registerControlEvents(a.RadDialogOpener,["open","close"]);
a.RadDialogOpener.registerClass("Telerik.Web.UI.RadDialogOpener",a.RadWebControl);
a.ClassicDialog=function(c,d){a.ClassicDialog.initializeBase(this);
this.BrowserWindow=window;
this._dialogOpener=null;
this._clientCallBackFunction=null;
this._window=null;
this._url="";
this._events={close:[],beforeClose:[],show:[]};
};
a.ClassicDialog.prototype={close:function(e){this.raiseEvent("beforeClose");
this.raiseEvent("close");
if(null!=e&&!(e instanceof Sys.UI.DomEvent)){var d=this.get_clientCallBackFunction();
if(d){d(this,e);
}}var c=this.get_contentFrame();
c.setTimeout(function(){c.close();
c.parent.focus();
},100);
},open:function(d,c){this._window=window.open(this.get_navigateUrl(),c,d);
this._window.focus();
if(!this._window.contentWindow){this._window.contentWindow=this._window;
}this.raiseEvent("show");
return this._window;
},get_dialogOpener:function(){return this._dialogOpener;
},set_dialogOpener:function(c){this._dialogOpener=c;
},get_clientCallBackFunction:function(){return this._clientCallBackFunction;
},set_clientCallBackFunction:function(c){this._clientCallBackFunction=c;
},setUrl:function(c){this._url=c;
},get_navigateUrl:function(){return this._url;
},get_contentFrame:function(){return this._window;
},set_title:function(c){if(this._window&&this._window.document){this._window.document.title=c;
}},dispose:function(){this._window=null;
this._clientCallBackFunction=null;
this._dialogOpener=null;
this._events=null;
a.ClassicDialog.callBaseMethod(this,"dispose");
},add_close:function(c){Array.add(this._events.close,c);
},remove_close:function(c){Array.remove(this._events.close,c);
},add_show:function(c){Array.add(this._events.show,c);
},remove_show:function(c){Array.remove(this._events.show,c);
},add_beforeClose:function(c){Array.add(this._events.beforeClose,c);
},remove_beforeClose:function(c){Array.remove(this._events.beforeClose,c);
},raiseEvent:function(c,e){var d=this._events[c];
this._raiseEvent(d,e);
},_raiseEvent:function(e,d){if(!e||(e.length===0)){return;
}e=Array.clone(e);
if(!e._handler){e._handler=function(f,h){for(var g=0,j=e.length;
g<j;
g++){e[g](f,h);
}};
}var c=e._handler;
if(c){if(!d){d=Sys.EventArgs.Empty;
}c(this,d);
}}};
a.ClassicDialog.registerClass("Telerik.Web.UI.ClassicDialog",Sys.Component);
})();
Type.registerNamespace("Telerik.Web.UI");
if(typeof(Telerik.Web.UI.EditorCommandEventArgs)=="undefined"){Telerik.Web.UI.EditorCommandEventArgs=function(c,b,a){Telerik.Web.UI.EditorCommandEventArgs.initializeBase(this);
this._name=this._commandName=c;
this._tool=b;
this._value=a;
this.value=a;
this._callbackFunction=null;
};
Telerik.Web.UI.EditorCommandEventArgs.prototype={get_name:function(){return this._name;
},get_commandName:function(){return this._commandName;
},get_tool:function(){return this._tool;
},get_value:function(){return this._value;
},set_value:function(a){this.value=a;
this._value=a;
},set_callbackFunction:function(a){this._callbackFunction=a;
}};
Telerik.Web.UI.EditorCommandEventArgs.registerClass("Telerik.Web.UI.EditorCommandEventArgs",Sys.CancelEventArgs);
}
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();