var CKFinder=function(b,d,c,a){this.BasePath=b||CKFinder.DEFAULT_BASEPATH;this.Width=d||"100%";this.Height=c||400;this.SelectFunction=a||null;this.SelectFunctionData=null;this.SelectThumbnailFunction=a||null;this.SelectThumbnailFunctionData=null;this.DisableThumbnailSelection=false;this.ClassName=null||"CKFinderFrame";this.StartupPath=null;this.ResourceType=null;this.StartupFolderExpanded=false;this.RememberLastFolder=true;this.Id=null;this.ConnectorLanguage="asp"};CKFinder.DEFAULT_BASEPATH="/ckfinder/";CKFinder.prototype={Create:function(){document.write(this.CreateHtml())},CreateHtml:function(){var a=this.ClassName;if(a&&a.length>0)a=' class="'+a+'"';var b=this.Id;if(b&&b.length>0)b=' id="'+b+'"';return'<iframe src="'+this._BuildUrl()+'" width="'+this.Width+'" height="'+this.Height+'"'+a+b+' frameborder="0" scrolling="no"></iframe>'},Popup:function(b,a){b=b||"80%";a=a||"70%";if(typeof b=="string"&&b.length>1&&b.substr(b.length-1,1)=="%")b=parseInt(window.screen.width*parseInt(b)/100);if(typeof a=="string"&&a.length>1&&a.substr(a.length-1,1)=="%")a=parseInt(window.screen.height*parseInt(a)/100);if(b<200)b=200;if(a<200)a=200;var f=parseInt((window.screen.height-a)/2),e=parseInt((window.screen.width-b)/2),d="location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,width="+b+",height="+a+",top="+f+",left="+e,c=window.open("","CKFinderPopup",d,true);if(!c)return false;var g=this._BuildUrl().replace(/&amp;/g,"&");try{c.moveTo(e,f);c.resizeTo(b,a);c.focus();c.location.href=g}catch(h){c=window.open(g,"CKFinderPopup",d,true)}return true},_BuildUrl:function(c){var c=c||this.BasePath,a="";if(!c||c.length==0)c=CKFinder.DEFAULT_BASEPATH;if(c.substr(c.length-1,1)!="/")if(this.SelectFunction){var b=this.SelectFunction;if(typeof b=="function")b=b.toString().match(/function ([^(]+)/)[1];a+="&action=js&amp;func="+b}if(this.SelectFunctionData){a+=a?"&amp;":"?";a+="data="+encodeURIComponent(this.SelectFunctionData)}if(this.ResourceType){a+=a?"&amp;":"?";a+="type="+encodeURIComponent(this.ResourceType)}if(this.DisableThumbnailSelection){a+=a?"&amp;":"?";a+="dts=1"}else if(this.SelectThumbnailFunction||this.SelectFunction){var b=this.SelectThumbnailFunction||this.SelectFunction;if(typeof b=="function")b=b.toString().match(/function ([^(]+)/)[1];a+=a?"&amp;":"?";a+="thumbFunc="+b;if(this.SelectThumbnailFunctionData)a+="&amp;tdata="+encodeURIComponent(this.SelectThumbnailFunctionData);else if(!this.SelectThumbnailFunction&&this.SelectFunctionData)a+="&amp;tdata="+encodeURIComponent(this.SelectFunctionData)}if(this.StartupPath){a+=a?"&amp;":"?";a+="start="+encodeURIComponent(this.StartupPath+(this.StartupFolderExpanded?":1":":0"))}if(!this.RememberLastFolder){a+=a?"&amp;":"?";a+="rlf=0"}if(this.Id){a+=a?"&amp;":"?";a+="id="+encodeURIComponent(this.Id)}return c+a}};CKFinder.Create=function(a,f,e,d){var b;if(a!=null&&typeof a=="object"){b=new CKFinder;for(var c in a)b[c]=a[c]}else b=new CKFinder(a,f,e,d);b.Create()};CKFinder.Popup=function(a,e,d,f){var b;if(a!=null&&typeof a=="object"){b=new CKFinder;for(var c in a)b[c]=a[c]}else b=new CKFinder(a,e,d,f);b.Popup(e,d)};CKFinder.SetupFCKeditor=function(b,g,j,i){var a;if(g!=null&&typeof g=="object"){a=new CKFinder;for(var f in g){a[f]=g[f];if(f=="Width"){var e=a[f]||800;if(typeof e=="string"&&e.length>1&&e.substr(e.length-1,1)=="%")e=parseInt(window.screen.width*parseInt(e)/100);b.Config.LinkBrowserWindowWidth=e;b.Config.ImageBrowserWindowWidth=e;b.Config.FlashBrowserWindowWidth=e}else if(f=="Height"){var d=a[f]||600;if(typeof d=="string"&&d.length>1&&d.substr(d.length-1,1)=="%")d=parseInt(window.screen.height*parseInt(d)/100);b.Config.LinkBrowserWindowHeight=d;b.Config.ImageBrowserWindowHeight=d;b.Config.FlashBrowserWindowHeight=d}}}else a=new CKFinder(g);var c=a.BasePath;if(c.substr(0,1)!="/"&&c.indexOf("://")==-1)c=document.location.pathname.substring(0,document.location.pathname.lastIndexOf("/")+1)+c;c=a._BuildUrl(c);var k=c.indexOf("?")!==-1?"&amp;":"?";b.Config.LinkBrowserURL=c;b.Config.ImageBrowserURL=c+k+"type="+(j||"Images");b.Config.FlashBrowserURL=c+k+"type="+(i||"Flash");var h=c.substring(0,1+c.lastIndexOf("/"));b.Config.LinkUploadURL=h+"core/connector/"+a.ConnectorLanguage+"/connector."+a.ConnectorLanguage+"?command=QuickUpload&type=Files";b.Config.ImageUploadURL=h+"core/connector/"+a.ConnectorLanguage+"/connector."+a.ConnectorLanguage+"?command=QuickUpload&type="+(j||"Images");b.Config.FlashUploadURL=h+"core/connector/"+a.ConnectorLanguage+"/connector."+a.ConnectorLanguage+"?command=QuickUpload&type="+(i||"Flash")};CKFinder.SetupCKEditor=function(c,e,i,h){if(c===null){for(var l in CKEDITOR.instances)CKFinder.SetupCKEditor(CKEDITOR.instances[l],e,i,h);CKEDITOR.on("instanceCreated",function(a){CKFinder.SetupCKEditor(a.editor,e,i,h)});return}var a;if(e!=null&&typeof e=="object"){a=new CKFinder;for(var f in e){a[f]=e[f];if(f=="Width"){var d=a[f]||800;if(typeof d=="string"&&d.length>1&&d.substr(d.length-1,1)=="%")d=parseInt(window.screen.width*parseInt(d)/100);c.config.filebrowserWindowWidth=d}else if(f=="Height"){var g=a[f]||600;if(typeof g=="string"&&g.length>1&&g.substr(g.length-1,1)=="%")g=parseInt(window.screen.height*parseInt(g)/100);c.config.filebrowserWindowHeight=d}}}else a=new CKFinder(e);var b=a.BasePath;if(b.substr(0,1)!="/"&&b.indexOf("://")==-1)b=document.location.pathname.substring(0,document.location.pathname.lastIndexOf("/")+1)+b;b=a._BuildUrl(b);var k=b.indexOf("?")!==-1?"&amp;":"?";c.config.filebrowserBrowseUrl=b;c.config.filebrowserImageBrowseUrl=b+k+"type="+(i||"Images");c.config.filebrowserFlashBrowseUrl=b+k+"type="+(h||"Flash");var j=b.substring(0,1+b.lastIndexOf("/"));c.config.filebrowserUploadUrl=j+"core/connector/"+a.ConnectorLanguage+"/connector."+a.ConnectorLanguage+"?command=QuickUpload&type=Files";c.config.filebrowserImageUploadUrl=j+"core/connector/"+a.ConnectorLanguage+"/connector."+a.ConnectorLanguage+"?command=QuickUpload&type="+(i||"Images");c.config.filebrowserFlashUploadUrl=j+"core/connector/"+a.ConnectorLanguage+"/connector."+a.ConnectorLanguage+"?command=QuickUpload&type="+(h||"Flash")};var CKFinderpath="http://"+location.hostname+":"+window.location.port,editedField;function BrowseServer(b,a){editedField=b;CKFinder.Popup(CKFinderpath+"/scripts/ckfinder/ckfinder.html?type="+a,null,null,SetFileField)}function BrowseServer2(b,a){editedField=b;CKFinder.Popup(CKFinderpath+"/scripts/ckfinder/ckfinder.html?type="+a,null,null,SetFileField)}function SetFileField(a){document.getElementById(editedField).value=a}
