(function(){var a=function(f,i){var e=1,n=2,o=4,C=8,r=/^\s*(\d+)((px)|\%)?\s*$/i,B=/(^\s*(\d+)((px)|\%)?\s*$)|^$/i,m=/^\d+px$/;var z=function(){var F=this.getValue(),E=this.getDialog(),D=F.match(r);if(D){if(D[2]=="%"){w(E,false)}F=D[1]}if(E.lockRatio){var G=E.originalElement;if(G.getCustomData("isReady")=="true"){if(this.id=="txtHeight"){if(F&&F!="0"){F=Math.round(G.$.width*(F/G.$.height))}if(!isNaN(F)){E.setValueOf("info","txtWidth",F)}}else{if(F&&F!="0"){F=Math.round(G.$.height*(F/G.$.width))}if(!isNaN(F)){E.setValueOf("info","txtHeight",F)}}}}t(E)};var j=function(I,G){if(G=="onOk"){var E=I.getValueOf("info","txtWidth");var K=I.getValueOf("info","txtHeight");var L="/"+E+"-"+K+"/";var J=I.getValueOf("info","txtUrl");if(J.search(/\/[0-9]+-[0-9]+\//)!=-1){J=J.replace(/\/[0-9]+-[0-9]+\//,L)}else{var F=J.search(/\/[0-9]+\//);var D=J.match(/\/[0-9]+\//);var H=J.substring(F+D[0].length);var J=J.substring(0,F)+D+L.substring(1)+H}}if(G=="onResetSize"){var J=I.getValueOf("info","txtUrl");if(J.search(/\/[0-9]+-[0-9]+\//)!=-1){J=J.replace(/\/[0-9]+-[0-9]+\//,"/")}else{return false}}I.setValueOf("info","txtUrl",J)};var t=function(D){if(!D.originalElement||!D.preview){return 1}D.commitContent(o,D.preview);return 0};function v(){var E=arguments;var D=this.getContentElement("advanced","txtdlgGenStyle");D&&D.commit.apply(D,E);this.foreach(function(F){if(F.commit&&F.id!="txtdlgGenStyle"){F.commit.apply(F,E)}})}var q;function A(D){if(q){return}q=1;var G=this.getDialog(),F=G.imageElement;if(F){this.commit(e,F);D=[].concat(D);var H=D.length,I;for(var E=0;E0){F=this.getDialog();var E=F.originalElement;F.preview.removeStyle("display");E.setCustomData("isReady","false");var D=CKEDITOR.document.getById(u);if(D){D.setStyle("display","")}E.on("load",y,F);E.on("error",h,F);E.on("abort",h,F);E.setAttribute("src",G);c.setAttribute("src",G);F.preview.setAttribute("src",c.$.src);t(F)}else{if(F.preview){F.preview.removeAttribute("src");F.preview.setStyle("display","none")}}},setup:function(F,E){if(F==e){var D=E.data("cke-saved-src")||E.getAttribute("src");var G=this;this.getDialog().dontResetSize=true;G.setValue(D);G.setInitValue()}},commit:function(E,D){if(E==e&&(this.getValue()||this.isChanged())){D.data("cke-saved-src",this.getValue());D.setAttribute("src",this.getValue())}else{if(E==C){D.setAttribute("src","");D.removeAttribute("src")}}},validate:CKEDITOR.dialog.validate.notEmpty(f.lang.image.urlMissing)},{type:"button",id:"browse",style:"display:inline-block;margin-top:10px;",align:"center",label:f.lang.esp_image.browseServer,hidden:true,filebrowser:{action:"Browse",target:"info:txtUrl",url:f.config.filebrowserImageBrowseUrl}}]}]},{id:"txtAlt",type:"text",label:f.lang.image.alt,accessKey:"T","default":"",onChange:function(){t(this.getDialog())},setup:function(E,D){if(E==e){this.setValue(D.getAttribute("alt"))}},commit:function(E,D){if(E==e){if(this.getValue()||this.isChanged()){D.setAttribute("alt",this.getValue())}}else{if(E==o){D.setAttribute("alt",this.getValue())}else{if(E==C){D.removeAttribute("alt")}}}}},{type:"hbox",children:[{id:"basic",type:"vbox",children:[{type:"hbox",widths:["50%","50%"],children:[{type:"vbox",padding:1,children:[{type:"text",width:"40px",id:"txtWidth",label:f.lang.common.width,onKeyUp:z,onChange:function(){A.call(this,"advanced:txtdlgGenStyle")},validate:function(){var D=this.getValue().match(B),E=!!(D&&parseInt(D[1],10)!==0);if(!E){alert(f.lang.common.invalidWidth)}return E},setup:p,commit:function(G,F,E){var H=this.getValue();if(G==e){if(H){F.setStyle("width",CKEDITOR.tools.cssLength(H))}else{F.removeStyle("width")}!E&&F.removeAttribute("width")}else{if(G==o){var D=H.match(r);if(!D){var I=this.getDialog().originalElement;if(I.getCustomData("isReady")=="true"){F.setStyle("width",I.$.width+"px")}}else{F.setStyle("width",CKEDITOR.tools.cssLength(H))}}else{if(G==C){F.removeAttribute("width");F.removeStyle("width")}}}}},{type:"text",id:"txtHeight",width:"40px",label:f.lang.common.height,onKeyUp:z,onChange:function(){A.call(this,"advanced:txtdlgGenStyle")},validate:function(){var D=this.getValue().match(B),E=!!(D&&parseInt(D[1],10)!==0);if(!E){alert(f.lang.common.invalidHeight)}return E},setup:p,commit:function(G,F,E){var H=this.getValue();if(G==e){if(H){F.setStyle("height",CKEDITOR.tools.cssLength(H))}else{F.removeStyle("height")}!E&&F.removeAttribute("height")}else{if(G==o){var D=H.match(r);if(!D){var I=this.getDialog().originalElement;if(I.getCustomData("isReady")=="true"){F.setStyle("height",I.$.height+"px")}}else{F.setStyle("height",CKEDITOR.tools.cssLength(H))}}else{if(G==C){F.removeAttribute("height");F.removeStyle("height")}}}}}]},{id:"ratioLock",type:"html",style:"margin-top:30px;width:40px;height:40px;",onLoad:function(){var D=CKEDITOR.document.getById(s),E=CKEDITOR.document.getById(l);if(D){D.on("click",function(F){k(this);F.data&&F.data.preventDefault()},this.getDialog());D.on("mouseover",function(){this.addClass("cke_btn_over")},D);D.on("mouseout",function(){this.removeClass("cke_btn_over")},D)}if(E){E.on("click",function(G){var H=w(this),J=this.originalElement,I=this.getValueOf("info","txtWidth");if(J.getCustomData("isReady")=="true"&&I){var F=J.$.height/J.$.width*I;if(!isNaN(F)){this.setValueOf("info","txtHeight",Math.round(F));t(this)}}G.data&&G.data.preventDefault()},this.getDialog());E.on("mouseover",function(){this.addClass("cke_btn_over")},E);E.on("mouseout",function(){this.removeClass("cke_btn_over")},E)}},html:'
'+f.lang.image.lockRatio+''+f.lang.image.resetSize+"
"}]},{type:"vbox",padding:1,children:[{type:"text",id:"txtBorder",width:"60px",label:f.lang.image.border,"default":"",onKeyUp:function(){t(this.getDialog())},onChange:function(){A.call(this,"advanced:txtdlgGenStyle")},validate:CKEDITOR.dialog.validate.integer(f.lang.image.validateBorder),setup:function(F,E){if(F==e){var G,D=E.getStyle("border-width");D=D&&D.match(/^(\d+px)(?: \1 \1 \1)?$/);G=D&&parseInt(D[1],10);isNaN(parseInt(G,10))&&(G=E.getAttribute("border"));this.setValue(G)}},commit:function(F,E,D){var G=parseInt(this.getValue(),10);if(F==e||F==o){if(!isNaN(G)){E.setStyle("border-width",CKEDITOR.tools.cssLength(G));E.setStyle("border-style","solid")}else{if(!G&&this.isChanged()){E.removeStyle("border-width");E.removeStyle("border-style");E.removeStyle("border-color")}}if(!D&&F==e){E.removeAttribute("border")}}else{if(F==C){E.removeAttribute("border");E.removeStyle("border-width");E.removeStyle("border-style");E.removeStyle("border-color")}}}},{type:"text",id:"txtHSpace",width:"60px",label:f.lang.image.hSpace,"default":"",onKeyUp:function(){t(this.getDialog())},onChange:function(){A.call(this,"advanced:txtdlgGenStyle")},validate:CKEDITOR.dialog.validate.integer(f.lang.image.validateHSpace),setup:function(F,E){if(F==e){var H,G,J,D=E.getStyle("margin-left"),I=E.getStyle("margin-right");D=D&&D.match(m);I=I&&I.match(m);G=parseInt(D,10);J=parseInt(I,10);H=(G==J)&&G;isNaN(parseInt(H,10))&&(H=E.getAttribute("hspace"));this.setValue(H)}},commit:function(F,E,D){var G=parseInt(this.getValue(),10);if(F==e||F==o){if(!isNaN(G)){E.setStyle("margin-left",CKEDITOR.tools.cssLength(G));E.setStyle("margin-right",CKEDITOR.tools.cssLength(G))}else{if(!G&&this.isChanged()){E.removeStyle("margin-left");E.removeStyle("margin-right")}}if(!D&&F==e){E.removeAttribute("hspace")}}else{if(F==C){E.removeAttribute("hspace");E.removeStyle("margin-left");E.removeStyle("margin-right")}}}},{type:"text",id:"txtVSpace",width:"60px",label:f.lang.image.vSpace,"default":"",onKeyUp:function(){t(this.getDialog())},onChange:function(){A.call(this,"advanced:txtdlgGenStyle")},validate:CKEDITOR.dialog.validate.integer(f.lang.image.validateVSpace),setup:function(I,H){if(I==e){var J,D,F,E=H.getStyle("margin-top"),G=H.getStyle("margin-bottom");E=E&&E.match(m);G=G&&G.match(m);D=parseInt(E,10);F=parseInt(G,10);J=(D==F)&&D;isNaN(parseInt(J,10))&&(J=H.getAttribute("vspace"));this.setValue(J)}},commit:function(F,E,D){var G=parseInt(this.getValue(),10);if(F==e||F==o){if(!isNaN(G)){E.setStyle("margin-top",CKEDITOR.tools.cssLength(G));E.setStyle("margin-bottom",CKEDITOR.tools.cssLength(G))}else{if(!G&&this.isChanged()){E.removeStyle("margin-top");E.removeStyle("margin-bottom")}}if(!D&&F==e){E.removeAttribute("vspace")}}else{if(F==C){E.removeAttribute("vspace");E.removeStyle("margin-top");E.removeStyle("margin-bottom")}}}},{id:"cmbAlign",type:"select",widths:["35%","65%"],style:"width:90px",label:f.lang.common.align,"default":"",items:[[f.lang.common.notSet,""],[f.lang.common.alignLeft,"left"],[f.lang.common.alignRight,"right"]],onChange:function(){t(this.getDialog());A.call(this,"advanced:txtdlgGenStyle")},setup:function(E,D){if(E==e){var F=D.getStyle("float");switch(F){case"inherit":case"none":F=""}!F&&(F=(D.getAttribute("align")||"").toLowerCase());this.setValue(F)}},commit:function(F,E,D){var G=this.getValue();if(F==e||F==o){if(G){E.setStyle("float",G)}else{E.removeStyle("float")}if(!D&&F==e){G=(E.getAttribute("align")||"").toLowerCase();switch(G){case"left":case"right":E.removeAttribute("align")}}}else{if(F==C){E.removeStyle("float")}}}}]}]},{type:"vbox",height:"250px",children:[{type:"html",id:"htmlPreview",style:"width:95%;",html:"
"+CKEDITOR.tools.htmlEncode(f.lang.common.preview)+'
'+(f.config.image_previewText||"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.")+"
"}]}]}]},{id:"Link",label:f.lang.link.title,padding:0,elements:[{id:"txtUrl",type:"text",label:f.lang.common.url,style:"width: 100%","default":"",setup:function(F,E){if(F==n){var D=E.data("cke-saved-href");if(!D){D=E.getAttribute("href")}this.setValue(D)}},commit:function(F,E){if(F==n){if(this.getValue()||this.isChanged()){var D=decodeURI(this.getValue());E.data("cke-saved-href",D);E.setAttribute("href",D);if(this.getValue()||!f.config.image_removeLinkByEmptyURL){this.getDialog().addLink=true}}}}},{type:"button",id:"browse",filebrowser:{action:"Browse",target:"Link:txtUrl",url:f.config.filebrowserImageBrowseUrl},style:"float:right",hidden:true,label:f.lang.esp_image.browseServer},{id:"cmbTarget",type:"select",label:f.lang.common.target,"default":"",items:[[f.lang.common.notSet,""],[f.lang.common.targetNew,"_blank"],[f.lang.common.targetTop,"_top"],[f.lang.common.targetSelf,"_self"],[f.lang.common.targetParent,"_parent"]],setup:function(E,D){if(E==n){this.setValue(D.getAttribute("target")||"")}},commit:function(E,D){if(E==n){if(this.getValue()||this.isChanged()){D.setAttribute("target",this.getValue())}}}}]},{id:"advanced",label:f.lang.common.advancedTab,elements:[{type:"hbox",widths:["50%","25%","25%"],children:[{type:"text",id:"linkId",label:f.lang.common.id,setup:function(E,D){if(E==e){this.setValue(D.getAttribute("id"))}},commit:function(E,D){if(E==e){if(this.getValue()||this.isChanged()){D.setAttribute("id",this.getValue())}}}},{id:"cmbLangDir",type:"select",style:"width : 100px;",label:f.lang.common.langDir,"default":"",items:[[f.lang.common.notSet,""],[f.lang.common.langDirLtr,"ltr"],[f.lang.common.langDirRtl,"rtl"]],setup:function(E,D){if(E==e){this.setValue(D.getAttribute("dir"))}},commit:function(E,D){if(E==e){if(this.getValue()||this.isChanged()){D.setAttribute("dir",this.getValue())}}}},{type:"text",id:"txtLangCode",label:f.lang.common.langCode,"default":"",setup:function(E,D){if(E==e){this.setValue(D.getAttribute("lang"))}},commit:function(E,D){if(E==e){if(this.getValue()||this.isChanged()){D.setAttribute("lang",this.getValue())}}}}]},{type:"text",id:"txtGenLongDescr",label:f.lang.common.longDescr,setup:function(E,D){if(E==e){this.setValue(D.getAttribute("longDesc"))}},commit:function(E,D){if(E==e){if(this.getValue()||this.isChanged()){D.setAttribute("longDesc",this.getValue())}}}},{type:"hbox",widths:["50%","50%"],children:[{type:"text",id:"txtGenClass",label:f.lang.common.cssClass,"default":"",setup:function(E,D){if(E==e){this.setValue(D.getAttribute("class"))}},commit:function(E,D){if(E==e){if(this.getValue()||this.isChanged()){D.setAttribute("class",this.getValue())}}}},{type:"text",id:"txtGenTitle",label:f.lang.common.advisoryTitle,"default":"",onChange:function(){t(this.getDialog())},setup:function(E,D){if(E==e){this.setValue(D.getAttribute("title"))}},commit:function(E,D){if(E==e){if(this.getValue()||this.isChanged()){D.setAttribute("title",this.getValue())}}else{if(E==o){D.setAttribute("title",this.getValue())}else{if(E==C){D.removeAttribute("title")}}}}}]},{type:"text",id:"txtdlgGenStyle",label:f.lang.common.cssStyle,validate:CKEDITOR.dialog.validate.inlineStyle(f.lang.common.invalidInlineStyle),"default":"",setup:function(H,F){if(H==e){var I=F.getAttribute("style");if(!I&&F.$.style.cssText){I=F.$.style.cssText}this.setValue(I);var D=F.$.style.height,G=F.$.style.width,J=(D?D:"").match(r),E=(G?G:"").match(r);this.attributesInStyle={height:!!J,width:!!E}}},onChange:function(){A.call(this,["info:cmbFloat","info:cmbAlign","info:txtVSpace","info:txtHSpace","info:txtBorder","info:txtWidth","info:txtHeight"]);t(this)},commit:function(E,D){if(E==e&&(this.getValue()||this.isChanged())){D.setAttribute("style",this.getValue())}}}]}]}};CKEDITOR.dialog.add("esp_image",function(b){return a(b,"image")});CKEDITOR.dialog.add("esp_imagebutton",function(b){return a(b,"imagebutton")})})();