Type.registerNamespace("Telerik.Web.UI");
(function(){var a=$telerik.$;
var b=Telerik.Web.UI;
b.DialogDefinition=function(){this.Width="600px";
this.Height="400px";
this.Title="";
this.Behaviors=36;
this.Modal=true;
this.VisibleStatusbar=false;
this.VisibleTitlebar=true;
this.ClientCallbackFunction="";
};
b.DialogDefinition.registerClass("Telerik.Web.UI.DialogDefinition",null);
b.DialogDefinitionsDictionary=function(f){for(var e in f){var d=f[e];
var c=new b.DialogDefinition();
for(var g in d){c[g]=d[g];
}this[e]=c;
}};
b.DialogDefinitionsDictionary.registerClass("Telerik.Web.UI.DialogDefinitionsDictionary",null);
b.DialogOpenEventArgs=function(c,d){b.DialogOpenEventArgs.initializeBase(this);
this._dialogName=c;
if(d){this._parameters=d;
}else{this._parameters={};
}};
b.DialogOpenEventArgs.prototype={get_dialogName:function(){return this._dialogName;
},set_parameters:function(c){this._parameters=c;
},get_parameters:function(){return this._parameters;
}};
b.DialogOpenEventArgs.registerClass("Telerik.Web.UI.DialogOpenEventArgs",Sys.EventArgs);
b.RadDialogOpener=function(c){b.RadDialogOpener.initializeBase(this,[c]);
this._dialogDefinitions={};
this._handlerChecked=false;
this._dialogParametersProviderTypeName="";
this._dialogUniqueID="";
this._dialogContainers={};
};
b.RadDialogOpener.prototype={initialize:function(){b.RadDialogOpener.callBaseMethod(this,"initialize");
this._dialogDefinitions=new b.DialogDefinitionsDictionary(this.get_dialogDefinitions());
},get_dialogDefinitions:function(){return this._dialogDefinitions;
},openUrl:function(j,o,e,m,d,h,g,f,p,l,i,c){c="EXTERNAL_URL"+(c||"default");
var k=this._getDialogContainer(c);
k.set_width(e+"px");
k.set_height(m+"px");
k.set_behaviors(p||b.WindowBehaviors.Default);
k.set_modal(f==true);
k.set_visibleStatusbar(l==true);
k.set_visibleTitlebar(i==true);
k.set_title(g?g:"");
k.set_keepInScreenBounds(true);
var n=new b.DialogOpenEventArgs(j,o);
this.raiseEvent("open",n);
k.ClientParameters=o;
k.set_clientCallBackFunction(d);
k.setUrl(j);
k.show();
k.center();
window.setTimeout(function(){k.setActive(true);
},100);
},open:function(h,g,c){if(!this._handlerChecked){this._checkDialogHandler(this.get_handlerUrl());
}var j=this._getDialogDefinition(h);
var i=new b.DialogOpenEventArgs(h,g);
this.raiseEvent("open",i);
var g=i.get_parameters();
if(!c){c=j.ClientCallbackFunction;
}if(this.get_useClassicDialogs()){var k=$create(b.ClassicDialog,{dialogOpener:this});
k.ClientParameters=g;
this._applyParameters(h,k);
if(c){k.set_clientCallBackFunction(c);
}window.__getCurrentRadEditorRadWindowReference=function(){return k;
};
var f="width="+parseInt(j.Width)+",height="+parseInt(j.Height);
f+=",resizable=0,scrollbars=0,status=0,toolbar=0,menubar=0,directories=0";
var e=k.open(f,h);
e.radWindow=k;
return e;
}else{var k=this._getDialogContainer(h);
var d=j.Height;
k.set_height(d);
k.set_width(j.Width);
k.set_behaviors(j.Behaviors);
k.set_modal(j.Modal);
k.set_visibleStatusbar(j.VisibleStatusbar);
k.set_visibleTitlebar(j.VisibleTitlebar);
k.set_keepInScreenBounds(true);
if(j.ReloadOnShow!=null){k.set_reloadOnShow(j.ReloadOnShow);
}k.ClientParameters=g;
this._applyParameters(h,k);
if(c){k.set_clientCallBackFunction(c);
}k.show();
k.set_height(d);
k.center();
window.setTimeout(function(){k.setActive(true);
},100);
}},openLight:function(g,f,c){var h=new b.DialogOpenEventArgs(g,f);
this.raiseEvent("open",h);
var f=h.get_parameters();
var i=this._getDialogContainer(g);
var d=195;
var e=350;
i.set_height(d);
i.set_width(e);
i.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move+Telerik.Web.UI.WindowBehaviors.Close);
i.set_modal(true);
i.set_visibleStatusbar(false);
i.set_visibleTitlebar(true);
if(c){i.set_clientCallBackFunction(c);
}i.ClientParameters=f;
Telerik.Web.UI.LightDialogsControllerClass.initializeLightDialog(i);
i.show();
i.set_height(d);
i.center();
window.setTimeout(function(){i.setActive(true);
},100);
},_applyParameters:function(j,n){var g=this._getDialogParameters(j);
if(!g){return;
}var h="&dp="+encodeURIComponent(g);
var c=this._getBaseDialogUrl(j);
var i=c.length+h.length;
var l=this._dialogParametersProviderTypeName=="";
var e=l&&i<=this.get_dialogUrlLengthLimit();
if(e){var k=n.get_navigateUrl();
var d=c+h;
if(k!=d){n.setUrl(d);
}else{var m=n.get_contentFrame();
if(m&&m.contentWindow&&m.contentWindow.$find){var f=m.contentWindow.initDialog;
if(f){m.contentWindow.setTimeout(function(){f();
},1);
}}}}else{n.setUrl(c);
n.DialogParameters=g;
}},_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 c=this.get_handlerUrl().indexOf("?")<0?"?":"&";
var d=this.get_handlerUrl()+c+"DialogName="+e;
if(this.get_enableTelerikManagers()){d+="&UseRSM=true";
}d+="&Skin="+this.get_skin()+"&Title="+encodeURIComponent(this._getDialogDefinition(e)["Title"])+"&doid="+this._dialogUniqueID+"&dpptn="+encodeURIComponent(this._dialogParametersProviderTypeName)+this.get_additionalQueryString();
return d;
},_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(f){var e=f.indexOf("?")<0?"?":"&";
var d=f+e+"checkHandler=true";
var g=new Sys.Net.WebRequest();
g.set_url(d);
g.add_completed(Function.createDelegate(this,this._checkRequestCompleted));
var c=new Sys.Net.XMLHttpExecutor();
g.set_executor(c);
c.executeRequest();
},_checkRequestCompleted:function(d,f){if(d.get_responseAvailable()){var c=d.get_webRequest();
var e=d.get_responseData();
if(e&&e.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");
}};
a.registerControlProperties(b.RadDialogOpener,{additionalQueryString:"",enableTelerikManagers:false,handlerUrl:"",container:null,dialogUrlLengthLimit:2000,useClassicDialogs:false,skin:""});
a.registerControlEvents(b.RadDialogOpener,["open","close"]);
b.RadDialogOpener.registerClass("Telerik.Web.UI.RadDialogOpener",b.RadWebControl);
b.ClassicDialog=function(c,d){b.ClassicDialog.initializeBase(this);
this.BrowserWindow=window;
this._dialogOpener=null;
this._clientCallBackFunction=null;
this._window=null;
this._url="";
this._events={close:[],beforeClose:[],show:[]};
};
b.ClassicDialog.prototype={close:function(d){this.raiseEvent("beforeClose");
this.raiseEvent("close");
if(null!=d&&!(d instanceof Sys.UI.DomEvent)){var c=this.get_clientCallBackFunction();
if(typeof(c)=="string"){c=eval(c);
}if(c){c(this,d);
}}var e=this.get_contentFrame();
e.setTimeout(function(){e.close();
e.parent.focus();
},100);
},open:function(c,d){this._window=window.open(this.get_navigateUrl(),d,c);
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;
b.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(c,e){if(!c||(c.length===0)){return;
}c=Array.clone(c);
if(!c._handler){c._handler=function(f,h){for(var g=0,j=c.length;
g<j;
g++){c[g](f,h);
}};
}var d=c._handler;
if(d){if(!e){e=Sys.EventArgs.Empty;
}d(this,e);
}}};
b.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,a,b){Telerik.Web.UI.EditorCommandEventArgs.initializeBase(this);
this._name=this._commandName=c;
this._tool=a;
this._value=b;
this.value=b;
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();
