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(d){for(var g in d){var e=d[g];
var f=new a.DialogDefinition();
for(var c in e){f[c]=e[c];
}this[g]=f;
}};
a.DialogDefinitionsDictionary.registerClass("Telerik.Web.UI.DialogDefinitionsDictionary",null);
a.DialogOpenEventArgs=function(d,c){a.DialogOpenEventArgs.initializeBase(this);
this._dialogName=d;
if(c){this._parameters=c;
}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(j,k,d,p,o,g,i,m,n,f,e,h){h="EXTERNAL_URL"+(h||"default");
var c=this._getDialogContainer(h);
c.set_width(d+"px");
c.set_height(p+"px");
c.set_behaviors(n||a.WindowBehaviors.Default);
c.set_modal(m==true);
c.set_visibleStatusbar(f==true);
c.set_visibleTitlebar(e==true);
c.set_title(i?i:"");
var l=new a.DialogOpenEventArgs(j,k);
this.raiseEvent("open",l);
c.ClientParameters=k;
c.set_clientCallBackFunction(o);
c.setUrl(j);
c.show();
c.center();
window.setTimeout(function(){c.setActive(true);
},100);
},open:function(d,i,j){if(!this._handlerChecked){this._checkDialogHandler(this.get_handlerUrl());
}var h=this._getDialogDefinition(d);
var k=new a.DialogOpenEventArgs(d,i);
this.raiseEvent("open",k);
var i=k.get_parameters();
if(!j){j=h.ClientCallbackFunction;
}if(this.get_useClassicDialogs()){var c=$create(a.ClassicDialog,{dialogOpener:this});
c.ClientParameters=i;
this._applyParameters(d,c);
if(j){c.set_clientCallBackFunction(j);
}window.__getCurrentRadEditorRadWindowReference=function(){return c;
};
var e="width="+parseInt(h.Width)+",height="+parseInt(h.Height);
e+=",resizable=0,scrollbars=0,status=0,toolbar=0,menubar=0,directories=0";
var g=c.open(e,d);
g.radWindow=c;
return g;
}else{var c=this._getDialogContainer(d);
var f=h.Height;
c.set_height(f);
c.set_width(h.Width);
c.set_behaviors(h.Behaviors);
c.set_modal(h.Modal);
c.set_visibleStatusbar(h.VisibleStatusbar);
c.set_visibleTitlebar(h.VisibleTitlebar);
if(h.ReloadOnShow!=null){c.set_reloadOnShow(h.ReloadOnShow);
}c.ClientParameters=i;
this._applyParameters(d,c);
if(j){c.set_clientCallBackFunction(j);
}c.show();
c.set_height(f);
c.center();
window.setTimeout(function(){c.setActive(true);
},100);
}},_applyParameters:function(g,f){var k=this._getDialogParameters(g);
if(!k){return;
}var n="&dp="+encodeURIComponent(k);
var d=this._getBaseDialogUrl(g);
var m=d.length+n.length;
var h=this._dialogParametersProviderTypeName=="";
var l=h&&m<=this.get_dialogUrlLengthLimit();
if(l){var i=f.get_navigateUrl();
var j=d+n;
if(i!=j){f.setUrl(j);
}else{var e=f.get_contentFrame();
if(e&&e.contentWindow&&e.contentWindow.$find){var c=e.contentWindow.initDialog;
if(c){e.contentWindow.setTimeout(function(){c();
},1);
}}}}else{f.setUrl(d);
f.DialogParameters=k;
}},_closeContainerDelegate:function(c){this.raiseEvent("close",c);
},_getDialogContainer:function(e){if(typeof(this._dialogContainers[e])=="undefined"){var d=$find(this.get_id()+e);
if(null!=d){d.dispose();
}this._dialogContainers[e]=this.get_container().clone(this.get_id()+e);
var c=this;
this._dialogContainers[e].get_dialogOpener=function(){return c;
};
this._dialogContainers[e].add_close(Function.createDelegate(this,this._closeContainerDelegate));
}return this._dialogContainers[e];
},_getBaseDialogUrl:function(d){var c=this.get_handlerUrl().indexOf("?")<0?"?":"&";
return this.get_handlerUrl()+c+"DialogName="+d+"&Skin="+this.get_skin()+"&Title="+encodeURIComponent(this._getDialogDefinition(d)["Title"])+"&doid="+this._dialogUniqueID+"&dpptn="+encodeURIComponent(this._dialogParametersProviderTypeName)+this.get_additionalQueryString();
},_getDialogDefinition:function(d){var c=this.get_dialogDefinitions()[d];
if(c){return c;
}else{throw Error.argumentNull("dialogName",String.format("Dialog Parameters for the {0} dialog do not exist",d));
}},_getDialogParameters:function(c){return this._getDialogDefinition(c)["SerializedParameters"];
},_checkDialogHandler:function(e){var d=e.indexOf("?")<0?"?":"&";
var c=e+d+"checkHandler=true";
var f=new Sys.Net.WebRequest();
f.set_url(c);
f.add_completed(Function.createDelegate(this,this._checkRequestCompleted));
var g=new Sys.Net.XMLHttpExecutor();
f.set_executor(g);
g.executeRequest();
},_checkRequestCompleted:function(f,e){if(f.get_responseAvailable()){var c=f.get_webRequest();
var d=f.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:"",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(d,c){a.ClassicDialog.initializeBase(this);
this.BrowserWindow=window;
this._dialogOpener=null;
this._clientCallBackFunction=null;
this._window=null;
this._url="";
this._closeEvent=[];
};
a.ClassicDialog.prototype={close:function(c){this.raise_close();
if(null!=c&&!(c instanceof Sys.UI.DomEvent)){var e=this.get_clientCallBackFunction();
if(e){e(this,c);
}}var d=this.get_contentFrame();
d.setTimeout(function(){d.close();
d.parent.focus();
},100);
},open:function(c,d){this._window=window.open(this.get_navigateUrl(),d,c);
this._window.focus();
return this._window;
},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._closeEvent=[];
a.ClassicDialog.callBaseMethod(this,"dispose");
},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;
},add_close:function(c){Array.add(this._closeEvent,c);
},remove_close:function(c){Array.remove(this._closeEvent,c);
},raise_close:function(e){var d=this._closeEvent;
if(!d||(d.length===0)){return;
}d=Array.clone(d);
if(!d._handler){d._handler=function(h,f){for(var g=0,j=d.length;
g<j;
g++){d[g](h,f);
}};
}var c=d._handler;
if(c){if(!e){e=Sys.EventArgs.Empty;
}c(this,e);
}}};
a.ClassicDialog.registerClass("Telerik.Web.UI.ClassicDialog",Sys.Component);
})();

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();