﻿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(g){for(var j in g){var h=g[j];
var i=new Telerik.Web.UI.DialogDefinition();
for(var f in h){i[f]=h[f]
}this[j]=i
}};
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(B,o,v,t,s,y,A,q,r,x,w,z){z="EXTERNAL_URL"+(z||"default");
var u=this._getDialogContainer(z);
u.set_width(v+"px");
u.set_height(t+"px");
u.set_behaviors(r||Telerik.Web.UI.WindowBehaviors.Default);
u.set_modal(q==true);
u.set_visibleStatusbar(x==true);
u.set_visibleTitlebar(w==true);
u.set_title(A?A:"");
var p=new Telerik.Web.UI.DialogOpenEventArgs(B,o);
this.raiseEvent("open",p);
u.ClientParameters=o;
u.set_clientCallBackFunction(s);
u.setUrl(B);
u.show();
u.center();
window.setTimeout(function(){u.setActive(true)
},100)
},open:function(l,q,r){if(!this._handlerChecked){this._checkDialogHandler(this.get_handlerUrl())
}var p=this._getDialogDefinition(l);
var j=new Telerik.Web.UI.DialogOpenEventArgs(l,q);
this.raiseEvent("open",j);
var q=j.get_parameters();
if(!r){r=p.ClientCallbackFunction
}if(this.get_useClassicDialogs()){var k=$create(Telerik.Web.UI.ClassicDialog,{dialogOpener:this});
k.ClientParameters=q;
this._applyParameters(l,k);
if(r){k.set_clientCallBackFunction(r)
}window.__getCurrentRadEditorRadWindowReference=function(){return k
};
var m="width="+parseInt(p.Width)+",height="+parseInt(p.Height);
m+=",resizable=0,scrollbars=0,status=0,toolbar=0,menubar=0,directories=0";
var o=k.open(m,l);
o.radWindow=k;
return o
}else{var k=this._getDialogContainer(l);
var n=p.Height;
k.set_height(n);
k.set_width(p.Width);
k.set_behaviors(p.Behaviors);
k.set_modal(p.Modal);
k.set_visibleStatusbar(p.VisibleStatusbar);
k.set_visibleTitlebar(p.VisibleTitlebar);
if(p.ReloadOnShow!=null){k.set_reloadOnShow(p.ReloadOnShow)
}k.ClientParameters=q;
this._applyParameters(l,k);
if(r){k.set_clientCallBackFunction(r)
}k.show();
k.set_height(n);
k.center();
window.setTimeout(function(){k.setActive(true)
},100)
}},_applyParameters:function(u,t){var m=this._getDialogParameters(u);
if(!m){return
}var p="&dp="+encodeURIComponent(m);
var r=this._getBaseDialogUrl(u);
var o=r.length+p.length;
var v=this._dialogParametersProviderTypeName=="";
var n=v&&o<=this.get_dialogUrlLengthLimit();
if(n){var w=t.get_navigateUrl();
var x=r+p;
if(w!=x){t.setUrl(x)
}else{var s=t.get_contentFrame();
if(s&&s.contentWindow&&s.contentWindow.$find){var q=s.contentWindow.initDialog;
if(q){s.contentWindow.setTimeout(function(){q()
},1)
}}}}else{t.setUrl(r);
t.DialogParameters=m
}},_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(h){var g=h.indexOf("?")<0?"?":"&";
var f=h+g+"checkHandler=true";
var i=new Sys.Net.WebRequest();
i.set_url(f);
i.add_completed(Function.createDelegate(this,this._checkRequestCompleted));
var j=new Sys.Net.XMLHttpExecutor();
i.set_executor(j);
j.executeRequest()
},_checkRequestCompleted:function(h,g){if(h.get_responseAvailable()){var e=h.get_webRequest();
var f=h.get_responseData();
if(f&&f.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(c,a){for(var b=0,h=e.length;
b<h;
b++){e[b](c,a)
}}
}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();