Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.DialogDefinition=function(){this.Width="600px";
this.Height="400px";
this.Title="";
this.Behaviors=36;
this.Modal=true;
this.VisibleStatusbar=false;
this.VisibleTitlebar=true;
this.ClientCallbackFunction=""
};
Telerik.Web.UI.DialogDefinition.registerClass("Telerik.Web.UI.DialogDefinition",null);
Telerik.Web.UI.DialogDefinitionsDictionary=function(j){for(var h in j){var f=j[h];
var g=new Telerik.Web.UI.DialogDefinition();
for(var i in f){g[i]=f[i]
}this[h]=g
}};
Telerik.Web.UI.DialogDefinitionsDictionary.registerClass("Telerik.Web.UI.DialogDefinitionsDictionary",null);
Telerik.Web.UI.DialogOpenEventArgs=function(d,c){Telerik.Web.UI.DialogOpenEventArgs.initializeBase(this);
this._dialogName=d;
if(c){this._parameters=c
}else{this._parameters={}
}};
Telerik.Web.UI.DialogOpenEventArgs.prototype={get_dialogName:function(){return this._dialogName
},set_parameters:function(b){this._parameters=b
},get_parameters:function(){return this._parameters
}};
Telerik.Web.UI.DialogOpenEventArgs.registerClass("Telerik.Web.UI.DialogOpenEventArgs",Sys.EventArgs);
Telerik.Web.UI.RadDialogOpener=function(b){Telerik.Web.UI.RadDialogOpener.initializeBase(this,[b]);
this._additionalQueryString="";
this._dialogDefinitions={};
this._handlerUrl="";
this._handlerChecked=false;
this._useClassicDialogs=false;
this._skin="";
this._dialogParametersProviderTypeName="";
this._dialogUrlLengthLimit=2000;
this._dialogUniqueID="";
this._dialogContainers={};
this._container=null
};
Telerik.Web.UI.RadDialogOpener.prototype={initialize:function(){Telerik.Web.UI.RadDialogOpener.callBaseMethod(this,"initialize");
this._dialogDefinitions=new Telerik.Web.UI.DialogDefinitionsDictionary(this.get_dialogDefinitions())
},dispose:function(){Telerik.Web.UI.RadDialogOpener.callBaseMethod(this,"dispose")
},get_container:function(){return this._container
},set_container:function(b){this._container=b
},get_dialogUrlLengthLimit:function(){return this._dialogUrlLengthLimit
},set_dialogUrlLengthLimit:function(b){this._dialogUrlLengthLimit=b
},get_additionalQueryString:function(){return this._additionalQueryString
},set_additionalQueryString:function(b){this._additionalQueryString=b
},get_dialogDefinitions:function(){return this._dialogDefinitions
},get_handlerUrl:function(){return this._handlerUrl
},set_handlerUrl:function(b){this._handlerUrl=b
},get_useClassicDialogs:function(){return this._useClassicDialogs
},set_useClassicDialogs:function(b){this._useClassicDialogs=b
},get_skin:function(){return this._skin
},set_skin:function(b){this._skin=b
},add_open:function(b){this.get_events().addHandler("open",b)
},remove_open:function(b){this.get_events().removeHandler("open",b)
},add_close:function(b){this.get_events().addHandler("close",b)
},remove_close:function(b){this.get_events().removeHandler("close",b)
},openUrl:function(u,v,r,p,o,w,t,A,B,y,s,x){x="EXTERNAL_URL"+(x||"default");
var q=this._getDialogContainer(x);
q.set_width(r+"px");
q.set_height(p+"px");
q.set_behaviors(B||Telerik.Web.UI.WindowBehaviors.Default);
q.set_modal(A==true);
q.set_visibleStatusbar(y==true);
q.set_visibleTitlebar(s==true);
q.set_title(t?t:"");
var z=new Telerik.Web.UI.DialogOpenEventArgs(u,v);
this.raiseEvent("open",z);
q.ClientParameters=v;
q.set_clientCallBackFunction(o);
q.setUrl(u);
q.show();
q.center();
window.setTimeout(function(){q.setActive(true)
},100)
},open:function(m,r,j){if(!this._handlerChecked){this._checkDialogHandler(this.get_handlerUrl())
}var q=this._getDialogDefinition(m);
var k=new Telerik.Web.UI.DialogOpenEventArgs(m,r);
this.raiseEvent("open",k);
var r=k.get_parameters();
if(!j){j=q.ClientCallbackFunction
}if(this.get_useClassicDialogs()){var l=$create(Telerik.Web.UI.ClassicDialog,{dialogOpener:this});
l.ClientParameters=r;
this._applyParameters(m,l);
if(j){l.set_clientCallBackFunction(j)
}window.__getCurrentRadEditorRadWindowReference=function(){return l
};
var n="width="+parseInt(q.Width)+",height="+parseInt(q.Height);
n+=",resizable=0,scrollbars=0,status=0,toolbar=0,menubar=0,directories=0";
var p=l.open(n,m);
p.radWindow=l;
return p
}else{var l=this._getDialogContainer(m);
var o=q.Height;
l.set_height(o);
l.set_width(q.Width);
l.set_behaviors(q.Behaviors);
l.set_modal(q.Modal);
l.set_visibleStatusbar(q.VisibleStatusbar);
l.set_visibleTitlebar(q.VisibleTitlebar);
if(q.ReloadOnShow!=null){l.set_reloadOnShow(q.ReloadOnShow)
}l.ClientParameters=r;
this._applyParameters(m,l);
if(j){l.set_clientCallBackFunction(j)
}l.show();
l.set_height(o);
l.center();
window.setTimeout(function(){l.setActive(true)
},100)
}},_applyParameters:function(n,m){var r=this._getDialogParameters(n);
if(!r){return
}var u="&dp="+encodeURIComponent(r);
var w=this._getBaseDialogUrl(n);
var t=w.length+u.length;
var o=this._dialogParametersProviderTypeName=="";
var s=o&&t<=this.get_dialogUrlLengthLimit();
if(s){var p=m.get_navigateUrl();
var q=w+u;
if(p!=q){m.setUrl(q)
}else{var x=m.get_contentFrame();
if(x&&x.contentWindow&&x.contentWindow.$find){var v=x.contentWindow.initDialog;
if(v){x.contentWindow.setTimeout(function(){v()
},1)
}}}}else{m.setUrl(w);
m.DialogParameters=r
}},_closeContainerDelegate:function(b){this.raiseEvent("close",b)
},_getDialogContainer:function(f){if(typeof(this._dialogContainers[f])=="undefined"){var e=$find(this.get_id()+f);
if(null!=e){e.dispose()
}this._dialogContainers[f]=this.get_container().clone(this.get_id()+f);
var d=this;
this._dialogContainers[f].get_dialogOpener=function(){return d
};
this._dialogContainers[f].add_close(Function.createDelegate(this,this._closeContainerDelegate))
}return this._dialogContainers[f]
},_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(b){return this._getDialogDefinition(b)["SerializedParameters"]
},_checkDialogHandler:function(f){var j=f.indexOf("?")<0?"?":"&";
var i=f+j+"checkHandler=true";
var g=new Sys.Net.WebRequest();
g.set_url(i);
g.add_completed(Function.createDelegate(this,this._checkRequestCompleted));
var h=new Sys.Net.XMLHttpExecutor();
g.set_executor(h);
h.executeRequest()
},_checkRequestCompleted:function(e,h){if(e.get_responseAvailable()){var f=e.get_webRequest();
var g=e.get_responseData();
if(g&&g.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")
}};
Telerik.Web.UI.RadDialogOpener.registerClass("Telerik.Web.UI.RadDialogOpener",Telerik.Web.UI.RadWebControl);
Telerik.Web.UI.ClassicDialog=function(d,c){Telerik.Web.UI.ClassicDialog.initializeBase(this);
this.BrowserWindow=window;
this._dialogOpener=null;
this._clientCallBackFunction=null;
this._window=null;
this._url="";
this._closeEvent=[]
};
Telerik.Web.UI.ClassicDialog.prototype={close:function(d){this.raise_close();
if(null!=d&&!(d instanceof Sys.UI.DomEvent)){var f=this.get_clientCallBackFunction();
if(f){f(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();
return this._window
},setUrl:function(b){this._url=b
},get_navigateUrl:function(){return this._url
},get_contentFrame:function(){return this._window
},set_title:function(b){if(this._window&&this._window.document){this._window.document.title=b
}},dispose:function(){this._window=null;
this._clientCallBackFunction=null;
this._dialogOpener=null;
this._closeEvent=[];
Telerik.Web.UI.ClassicDialog.callBaseMethod(this,"dispose")
},get_dialogOpener:function(){return this._dialogOpener
},set_dialogOpener:function(b){this._dialogOpener=b
},get_clientCallBackFunction:function(){return this._clientCallBackFunction
},set_clientCallBackFunction:function(b){this._clientCallBackFunction=b
},add_close:function(b){Array.add(this._closeEvent,b)
},remove_close:function(b){Array.remove(this._closeEvent,b)
},raise_close:function(f){var e=this._closeEvent;
if(!e||(e.length===0)){return
}e=Array.clone(e);
if(!e._handler){e._handler=function(h,b){for(var c=0,a=e.length;
c<a;
c++){e[c](h,b)
}}
}var d=e._handler;
if(d){if(!f){f=Sys.EventArgs.Empty
}d(this,f)
}}};
Telerik.Web.UI.ClassicDialog.registerClass("Telerik.Web.UI.ClassicDialog",Sys.Component);
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();