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