CKEDITOR.DIALOG_RESIZE_NONE=0;CKEDITOR.DIALOG_RESIZE_WIDTH=1;CKEDITOR.DIALOG_RESIZE_HEIGHT=2;CKEDITOR.DIALOG_RESIZE_BOTH=3;(function(){var a=CKEDITOR.tools.cssLength;function b(E){return!!this._.tabs[E][0].$.offsetHeight;};function c(){var I=this;var E=I._.currentTabId,F=I._.tabIdList.length,G=CKEDITOR.tools.indexOf(I._.tabIdList,E)+F;for(var H=G-1;H>G-F;H--){if(b.call(I,I._.tabIdList[H%F]))return I._.tabIdList[H%F];}return null;};function d(){var I=this;var E=I._.currentTabId,F=I._.tabIdList.length,G=CKEDITOR.tools.indexOf(I._.tabIdList,E);for(var H=G+1;H<G+F;H++){if(b.call(I,I._.tabIdList[H%F]))return I._.tabIdList[H%F];}return null;};function e(E,F){var G=E.$.getElementsByTagName('input');for(var H=0,I=G.length;H<I;H++){var J=new CKEDITOR.dom.element(G[H]);if(J.getAttribute('type').toLowerCase()=='text')if(F){J.setAttribute('value',J.getCustomData('fake_value')||'');J.removeCustomData('fake_value');}else{J.setCustomData('fake_value',J.getAttribute('value'));J.setAttribute('value','');}}};CKEDITOR.dialog=function(E,F){var G=CKEDITOR.dialog._.dialogDefinitions[F],H=CKEDITOR.tools.clone(g),I=E.config.dialog_buttonsOrder||'OS',J=E.lang.dir;if(I=='OS'&&CKEDITOR.env.mac||I=='rtl'&&J=='ltr'||I=='ltr'&&J=='rtl')H.buttons.reverse();G=CKEDITOR.tools.extend(G(E),H);G=CKEDITOR.tools.clone(G);G=new k(this,G);var K=CKEDITOR.document,L=E.theme.buildDialog(E);this._={editor:E,element:L.element,name:F,contentSize:{width:0,height:0},size:{width:0,height:0},contents:{},buttons:{},accessKeyMap:{},tabs:{},tabIdList:[],currentTabId:null,currentTabIndex:null,pageCount:0,lastTab:null,tabBarMode:false,focusList:[],currentFocusIndex:0,hasFocus:false};this.parts=L.parts;CKEDITOR.tools.setTimeout(function(){E.fire('ariaWidget',this.parts.contents);},0,this);var M={position:CKEDITOR.env.ie6Compat?'absolute':'fixed',top:0,visibility:'hidden'};M[J=='rtl'?'right':'left']=0;this.parts.dialog.setStyles(M);CKEDITOR.event.call(this);this.definition=G=CKEDITOR.fire('dialogDefinition',{name:F,definition:G},E).definition;var N={};if(!('removeDialogTabs' in E._)&&E.config.removeDialogTabs){var O=E.config.removeDialogTabs.split(';');for(i=0;i<O.length;i++){var P=O[i].split(':');if(P.length==2){var Q=P[0];if(!N[Q])N[Q]=[];N[Q].push(P[1]);}}E._.removeDialogTabs=N;}if(E._.removeDialogTabs&&(N=E._.removeDialogTabs[F]))for(i=0;i<N.length;i++)G.removeContents(N[i]);if(G.onLoad)this.on('load',G.onLoad);if(G.onShow)this.on('show',G.onShow);if(G.onHide)this.on('hide',G.onHide);if(G.onOk)this.on('ok',function(ad){E.fire('saveSnapshot');
setTimeout(function(){E.fire('saveSnapshot');},0);if(G.onOk.call(this,ad)===false)ad.data.hide=false;});if(G.onCancel)this.on('cancel',function(ad){if(G.onCancel.call(this,ad)===false)ad.data.hide=false;});var R=this,S=function(ad){var ae=R._.contents,af=false;for(var ag in ae)for(var ah in ae[ag]){af=ad.call(this,ae[ag][ah]);if(af)return;}};this.on('ok',function(ad){S(function(ae){if(ae.validate){var af=ae.validate(this);if(typeof af=='string'){alert(af);af=false;}if(af===false){if(ae.select)ae.select();else ae.focus();ad.data.hide=false;ad.stop();return true;}}});},this,null,0);this.on('cancel',function(ad){S(function(ae){if(ae.isChanged()){if(!confirm(E.lang.common.confirmCancel))ad.data.hide=false;return true;}});},this,null,0);this.parts.close.on('click',function(ad){if(this.fire('cancel',{hide:true}).hide!==false)this.hide();ad.data.preventDefault();},this);function T(){var ad=R._.focusList;ad.sort(function(ag,ah){if(ag.tabIndex!=ah.tabIndex)return ah.tabIndex-ag.tabIndex;else return ag.focusIndex-ah.focusIndex;});var ae=ad.length;for(var af=0;af<ae;af++)ad[af].focusIndex=af;};function U(ad){var ae=R._.focusList,af=ad?1:-1;if(ae.length<1)return;var ag=R._.currentFocusIndex;try{ae[ag].getInputElement().$.blur();}catch(aj){}var ah=(ag+af+ae.length)%ae.length,ai=ah;while(!ae[ai].isFocusable()){ai=(ai+af+ae.length)%ae.length;if(ai==ah)break;}ae[ai].focus();if(ae[ai].type=='text')ae[ai].select();};this.changeFocus=U;var V;function W(ad){var ai=this;if(R!=CKEDITOR.dialog._.currentTop)return;var ae=ad.data.getKeystroke(),af=E.lang.dir=='rtl';V=0;if(ae==9||ae==CKEDITOR.SHIFT+9){var ag=ae==CKEDITOR.SHIFT+9;if(R._.tabBarMode){var ah=ag?c.call(R):d.call(R);R.selectPage(ah);R._.tabs[ah][0].focus();}else U(!ag);V=1;}else if(ae==CKEDITOR.ALT+121&&!R._.tabBarMode&&R.getPageCount()>1){R._.tabBarMode=true;R._.tabs[R._.currentTabId][0].focus();V=1;}else if((ae==37||ae==39)&&R._.tabBarMode){ah=ae==(af?39:37)?c.call(R):d.call(R);R.selectPage(ah);R._.tabs[ah][0].focus();V=1;}else if((ae==13||ae==32)&&R._.tabBarMode){ai.selectPage(ai._.currentTabId);ai._.tabBarMode=false;ai._.currentFocusIndex=-1;U(true);V=1;}if(V){ad.stop();ad.data.preventDefault();}};function X(ad){V&&ad.data.preventDefault();};var Y=this._.element;this.on('show',function(){Y.on('keydown',W,this,null,0);if(CKEDITOR.env.opera||CKEDITOR.env.gecko&&CKEDITOR.env.mac)Y.on('keypress',X,this);});this.on('hide',function(){Y.removeListener('keydown',W);if(CKEDITOR.env.opera||CKEDITOR.env.gecko&&CKEDITOR.env.mac)Y.removeListener('keypress',X);
});this.on('iframeAdded',function(ad){var ae=new CKEDITOR.dom.document(ad.data.iframe.$.contentWindow.document);ae.on('keydown',W,this,null,0);});this.on('show',function(){var ah=this;T();if(E.config.dialog_startupFocusTab&&R._.pageCount>1){R._.tabBarMode=true;R._.tabs[R._.currentTabId][0].focus();}else if(!ah._.hasFocus){ah._.currentFocusIndex=-1;if(G.onFocus){var ad=G.onFocus.call(ah);ad&&ad.focus();}else U(true);if(ah._.editor.mode=='wysiwyg'&&CKEDITOR.env.ie){var ae=E.document.$.selection,af=ae.createRange();if(af)if(af.parentElement&&af.parentElement().ownerDocument==E.document.$||af.item&&af.item(0).ownerDocument==E.document.$){var ag=document.body.createTextRange();ag.moveToElementText(ah.getElement().getFirst().$);ag.collapse(true);ag.select();}}}},this,null,4294967295);if(CKEDITOR.env.ie6Compat)this.on('load',function(ad){var ae=this.getElement(),af=ae.getFirst();af.remove();af.appendTo(ae);},this);m(this);n(this);new CKEDITOR.dom.text(G.title,CKEDITOR.document).appendTo(this.parts.title);for(var Z=0;Z<G.contents.length;Z++){var aa=G.contents[Z];aa&&this.addPage(aa);}this.parts.tabs.on('click',function(ad){var ag=this;var ae=ad.data.getTarget();if(ae.hasClass('cke_dialog_tab')){var af=ae.$.id;ag.selectPage(af.substring(4,af.lastIndexOf('_')));if(ag._.tabBarMode){ag._.tabBarMode=false;ag._.currentFocusIndex=-1;U(true);}ad.data.preventDefault();}},this);var ab=[],ac=CKEDITOR.dialog._.uiElementBuilders.hbox.build(this,{type:'hbox',className:'cke_dialog_footer_buttons',widths:[],children:G.buttons},ab).getChild();this.parts.footer.setHtml(ab.join(''));for(Z=0;Z<ac.length;Z++)this._.buttons[ac[Z].id]=ac[Z];};function f(E,F,G){this.element=F;this.focusIndex=G;this.tabIndex=0;this.isFocusable=function(){return!F.getAttribute('disabled')&&F.isVisible();};this.focus=function(){E._.currentFocusIndex=this.focusIndex;this.element.focus();};F.on('keydown',function(H){if(H.data.getKeystroke() in {32:1,13:1})this.fire('click');});F.on('focus',function(){this.fire('mouseover');});F.on('blur',function(){this.fire('mouseout');});};CKEDITOR.dialog.prototype={destroy:function(){this.hide();this._.element.remove();},resize:(function(){return function(E,F){var G=this;if(G._.contentSize&&G._.contentSize.width==E&&G._.contentSize.height==F)return;CKEDITOR.dialog.fire('resize',{dialog:G,skin:G._.editor.skinName,width:E,height:F},G._.editor);G.fire('resize',{skin:G._.editor.skinName,width:E,height:F},G._.editor);if(G._.editor.lang.dir=='rtl'&&G._.position)G._.position.x=CKEDITOR.document.getWindow().getViewPaneSize().width-G._.contentSize.width-parseInt(G._.element.getFirst().getStyle('right'),10);
G._.contentSize={width:E,height:F};};})(),getSize:function(){var E=this._.element.getFirst();return{width:E.$.offsetWidth||0,height:E.$.offsetHeight||0};},move:(function(){var E;return function(F,G,H){var O=this;var I=O._.element.getFirst(),J=O._.editor.lang.dir=='rtl';if(E===undefined)E=I.getComputedStyle('position')=='fixed';if(E&&O._.position&&O._.position.x==F&&O._.position.y==G)return;O._.position={x:F,y:G};if(!E){var K=CKEDITOR.document.getWindow().getScrollPosition();F+=K.x;G+=K.y;}if(J){var L=O.getSize(),M=CKEDITOR.document.getWindow().getViewPaneSize();F=M.width-L.width-F;}var N={top:(G>0?G:0)+'px'};N[J?'right':'left']=(F>0?F:0)+'px';I.setStyles(N);H&&(O._.moved=1);};})(),getPosition:function(){return CKEDITOR.tools.extend({},this._.position);},show:function(){var E=this._.element,F=this.definition;if(!(E.getParent()&&E.getParent().equals(CKEDITOR.document.getBody())))E.appendTo(CKEDITOR.document.getBody());else E.setStyle('display','block');if(CKEDITOR.env.gecko&&CKEDITOR.env.version<10900){var G=this.parts.dialog;G.setStyle('position','absolute');setTimeout(function(){G.setStyle('position','fixed');},0);}this.resize(this._.contentSize&&this._.contentSize.width||F.width||F.minWidth,this._.contentSize&&this._.contentSize.height||F.height||F.minHeight);this.reset();this.selectPage(this.definition.contents[0].id);if(CKEDITOR.dialog._.currentZIndex===null)CKEDITOR.dialog._.currentZIndex=this._.editor.config.baseFloatZIndex;this._.element.getFirst().setStyle('z-index',CKEDITOR.dialog._.currentZIndex+=10);if(CKEDITOR.dialog._.currentTop===null){CKEDITOR.dialog._.currentTop=this;this._.parentDialog=null;s(this._.editor);E.on('keydown',w);E.on(CKEDITOR.env.opera?'keypress':'keyup',x);for(var H in {keyup:1,keydown:1,keypress:1})E.on(H,D);}else{this._.parentDialog=CKEDITOR.dialog._.currentTop;var I=this._.parentDialog.getElement().getFirst();I.$.style.zIndex-=Math.floor(this._.editor.config.baseFloatZIndex/2);CKEDITOR.dialog._.currentTop=this;}y(this,this,'\x1b',null,function(){this.getButton('cancel')&&this.getButton('cancel').click();});this._.hasFocus=false;CKEDITOR.tools.setTimeout(function(){this.layout();this.parts.dialog.setStyle('visibility','');this.fireOnce('load',{});CKEDITOR.ui.fire('ready',this);this.fire('show',{});this._.editor.fire('dialogShow',this);this.foreach(function(J){J.setInitValue&&J.setInitValue();});},100,this);},layout:function(){var G=this;var E=CKEDITOR.document.getWindow().getViewPaneSize(),F=G.getSize();G.move(G._.moved?G._.position.x:(E.width-F.width)/2,G._.moved?G._.position.y:(E.height-F.height)/2);
},foreach:function(E){var H=this;for(var F in H._.contents)for(var G in H._.contents[F])E(H._.contents[F][G]);return H;},reset:(function(){var E=function(F){if(F.reset)F.reset(1);};return function(){this.foreach(E);return this;};})(),setupContent:function(){var E=arguments;this.foreach(function(F){if(F.setup)F.setup.apply(F,E);});},commitContent:function(){var E=arguments;this.foreach(function(F){if(F.commit)F.commit.apply(F,E);});},hide:function(){if(!this.parts.dialog.isVisible())return;this.fire('hide',{});this._.editor.fire('dialogHide',this);var E=this._.element;E.setStyle('display','none');this.parts.dialog.setStyle('visibility','hidden');z(this);while(CKEDITOR.dialog._.currentTop!=this)CKEDITOR.dialog._.currentTop.hide();if(!this._.parentDialog)t();else{var F=this._.parentDialog.getElement().getFirst();F.setStyle('z-index',parseInt(F.$.style.zIndex,10)+Math.floor(this._.editor.config.baseFloatZIndex/2));}CKEDITOR.dialog._.currentTop=this._.parentDialog;if(!this._.parentDialog){CKEDITOR.dialog._.currentZIndex=null;E.removeListener('keydown',w);E.removeListener(CKEDITOR.env.opera?'keypress':'keyup',x);for(var G in {keyup:1,keydown:1,keypress:1})E.removeListener(G,D);var H=this._.editor;H.focus();if(H.mode=='wysiwyg'&&CKEDITOR.env.ie){var I=H.getSelection();I&&I.unlock(true);}}else CKEDITOR.dialog._.currentZIndex-=10;delete this._.parentDialog;this.foreach(function(J){J.resetInitValue&&J.resetInitValue();});},addPage:function(E){var Q=this;var F=[],G=E.label?' title="'+CKEDITOR.tools.htmlEncode(E.label)+'"':'',H=E.elements,I=CKEDITOR.dialog._.uiElementBuilders.vbox.build(Q,{type:'vbox',className:'cke_dialog_page_contents',children:E.elements,expand:!!E.expand,padding:E.padding,style:E.style||'width: 100%;height:100%'},F),J=CKEDITOR.dom.element.createFromHtml(F.join(''));J.setAttribute('role','tabpanel');var K=CKEDITOR.env,L='cke_'+E.id+'_'+CKEDITOR.tools.getNextNumber(),M=CKEDITOR.dom.element.createFromHtml(['<a class="cke_dialog_tab"',Q._.pageCount>0?' cke_last':'cke_first',G,!!E.hidden?' style="display:none"':'',' id="',L,'"',K.gecko&&K.version>=10900&&!K.hc?'':' href="javascript:void(0)"',' tabIndex="-1"',' hidefocus="true"',' role="tab">',E.label,'</a>'].join(''));J.setAttribute('aria-labelledby',L);Q._.tabs[E.id]=[M,J];Q._.tabIdList.push(E.id);!E.hidden&&Q._.pageCount++;Q._.lastTab=M;Q.updateStyle();var N=Q._.contents[E.id]={},O,P=I.getChild();while(O=P.shift()){N[O.id]=O;if(typeof O.getChild=='function')P.push.apply(P,O.getChild());}J.setAttribute('name',E.id);
J.appendTo(Q.parts.contents);M.unselectable();Q.parts.tabs.append(M);if(E.accessKey){y(Q,Q,'CTRL+'+E.accessKey,B,A);Q._.accessKeyMap['CTRL+'+E.accessKey]=E.id;}},selectPage:function(E){if(this._.currentTabId==E)return;if(this.fire('selectPage',{page:E,currentPage:this._.currentTabId})===true)return;for(var F in this._.tabs){var G=this._.tabs[F][0],H=this._.tabs[F][1];if(F!=E){G.removeClass('cke_dialog_tab_selected');H.hide();}H.setAttribute('aria-hidden',F!=E);}var I=this._.tabs[E];I[0].addClass('cke_dialog_tab_selected');if(CKEDITOR.env.ie6Compat||CKEDITOR.env.ie7Compat){e(I[1]);I[1].show();setTimeout(function(){e(I[1],1);},0);}else I[1].show();this._.currentTabId=E;this._.currentTabIndex=CKEDITOR.tools.indexOf(this._.tabIdList,E);},updateStyle:function(){this.parts.dialog[(this._.pageCount===1?'add':'remove')+'Class']('cke_single_page');},hidePage:function(E){var G=this;var F=G._.tabs[E]&&G._.tabs[E][0];if(!F||G._.pageCount==1||!F.isVisible())return;else if(E==G._.currentTabId)G.selectPage(c.call(G));F.hide();G._.pageCount--;G.updateStyle();},showPage:function(E){var G=this;var F=G._.tabs[E]&&G._.tabs[E][0];if(!F)return;F.show();G._.pageCount++;G.updateStyle();},getElement:function(){return this._.element;},getName:function(){return this._.name;},getContentElement:function(E,F){var G=this._.contents[E];return G&&G[F];},getValueOf:function(E,F){return this.getContentElement(E,F).getValue();},setValueOf:function(E,F,G){return this.getContentElement(E,F).setValue(G);},getButton:function(E){return this._.buttons[E];},click:function(E){return this._.buttons[E].click();},disableButton:function(E){return this._.buttons[E].disable();},enableButton:function(E){return this._.buttons[E].enable();},getPageCount:function(){return this._.pageCount;},getParentEditor:function(){return this._.editor;},getSelectedElement:function(){return this.getParentEditor().getSelection().getSelectedElement();},addFocusable:function(E,F){var H=this;if(typeof F=='undefined'){F=H._.focusList.length;H._.focusList.push(new f(H,E,F));}else{H._.focusList.splice(F,0,new f(H,E,F));for(var G=F+1;G<H._.focusList.length;G++)H._.focusList[G].focusIndex++;}}};CKEDITOR.tools.extend(CKEDITOR.dialog,{add:function(E,F){if(!this._.dialogDefinitions[E]||typeof F=='function')this._.dialogDefinitions[E]=F;},exists:function(E){return!!this._.dialogDefinitions[E];},getCurrent:function(){return CKEDITOR.dialog._.currentTop;},okButton:(function(){var E=function(F,G){G=G||{};return CKEDITOR.tools.extend({id:'ok',type:'button',label:F.lang.common.ok,'class':'cke_dialog_ui_button_ok',onClick:function(H){var I=H.data.dialog;
if(I.fire('ok',{hide:true}).hide!==false)I.hide();}},G,true);};E.type='button';E.override=function(F){return CKEDITOR.tools.extend(function(G){return E(G,F);},{type:'button'},true);};return E;})(),cancelButton:(function(){var E=function(F,G){G=G||{};return CKEDITOR.tools.extend({id:'cancel',type:'button',label:F.lang.common.cancel,'class':'cke_dialog_ui_button_cancel',onClick:function(H){var I=H.data.dialog;if(I.fire('cancel',{hide:true}).hide!==false)I.hide();}},G,true);};E.type='button';E.override=function(F){return CKEDITOR.tools.extend(function(G){return E(G,F);},{type:'button'},true);};return E;})(),addUIElement:function(E,F){this._.uiElementBuilders[E]=F;}});CKEDITOR.dialog._={uiElementBuilders:{},dialogDefinitions:{},currentTop:null,currentZIndex:null};CKEDITOR.event.implementOn(CKEDITOR.dialog);CKEDITOR.event.implementOn(CKEDITOR.dialog.prototype,true);var g={resizable:CKEDITOR.DIALOG_RESIZE_BOTH,minWidth:600,minHeight:400,buttons:[CKEDITOR.dialog.okButton,CKEDITOR.dialog.cancelButton]},h=function(E,F,G){for(var H=0,I;I=E[H];H++){if(I.id==F)return I;if(G&&I[G]){var J=h(I[G],F,G);if(J)return J;}}return null;},i=function(E,F,G,H,I){if(G){for(var J=0,K;K=E[J];J++){if(K.id==G){E.splice(J,0,F);return F;}if(H&&K[H]){var L=i(K[H],F,G,H,true);if(L)return L;}}if(I)return null;}E.push(F);return F;},j=function(E,F,G){for(var H=0,I;I=E[H];H++){if(I.id==F)return E.splice(H,1);if(G&&I[G]){var J=j(I[G],F,G);if(J)return J;}}return null;},k=function(E,F){this.dialog=E;var G=F.contents;for(var H=0,I;I=G[H];H++)G[H]=I&&new l(E,I);CKEDITOR.tools.extend(this,F);};k.prototype={getContents:function(E){return h(this.contents,E);},getButton:function(E){return h(this.buttons,E);},addContents:function(E,F){return i(this.contents,E,F);},addButton:function(E,F){return i(this.buttons,E,F);},removeContents:function(E){j(this.contents,E);},removeButton:function(E){j(this.buttons,E);}};function l(E,F){this._={dialog:E};CKEDITOR.tools.extend(this,F);};l.prototype={get:function(E){return h(this.elements,E,'children');},add:function(E,F){return i(this.elements,E,F,'children');},remove:function(E){j(this.elements,E,'children');}};function m(E){var F=null,G=null,H=E.getElement().getFirst(),I=E.getParentEditor(),J=I.config.dialog_magnetDistance,K=I.skin.margins||[0,0,0,0];if(typeof J=='undefined')J=20;function L(N){var O=E.getSize(),P=CKEDITOR.document.getWindow().getViewPaneSize(),Q=N.data.$.screenX,R=N.data.$.screenY,S=Q-F.x,T=R-F.y,U,V;F={x:Q,y:R};G.x+=S;G.y+=T;if(G.x+K[3]<J)U=-K[3];else if(G.x-K[1]>P.width-O.width-J)U=P.width-O.width+(I.lang.dir=='rtl'?0:K[1]);
else U=G.x;if(G.y+K[0]<J)V=-K[0];else if(G.y-K[2]>P.height-O.height-J)V=P.height-O.height+K[2];else V=G.y;E.move(U,V,1);N.data.preventDefault();};function M(N){CKEDITOR.document.removeListener('mousemove',L);CKEDITOR.document.removeListener('mouseup',M);if(CKEDITOR.env.ie6Compat){var O=q.getChild(0).getFrameDocument();O.removeListener('mousemove',L);O.removeListener('mouseup',M);}};E.parts.title.on('mousedown',function(N){F={x:N.data.$.screenX,y:N.data.$.screenY};CKEDITOR.document.on('mousemove',L);CKEDITOR.document.on('mouseup',M);G=E.getPosition();if(CKEDITOR.env.ie6Compat){var O=q.getChild(0).getFrameDocument();O.on('mousemove',L);O.on('mouseup',M);}N.data.preventDefault();},E);};function n(E){var F=E.definition,G=F.resizable;if(G==CKEDITOR.DIALOG_RESIZE_NONE)return;var H=E.getParentEditor(),I,J,K,L,M,N,O=CKEDITOR.tools.addFunction(function(R){M=E.getSize();var S=E.parts.contents,T=S.$.getElementsByTagName('iframe').length;if(T){N=CKEDITOR.dom.element.createFromHtml('<div class="cke_dialog_resize_cover" style="height: 100%; position: absolute; width: 100%;"></div>');S.append(N);}J=M.height-E.parts.contents.getSize('height',!(CKEDITOR.env.gecko||CKEDITOR.env.opera||CKEDITOR.env.ie&&CKEDITOR.env.quirks));I=M.width-E.parts.contents.getSize('width',1);L={x:R.screenX,y:R.screenY};K=CKEDITOR.document.getWindow().getViewPaneSize();CKEDITOR.document.on('mousemove',P);CKEDITOR.document.on('mouseup',Q);if(CKEDITOR.env.ie6Compat){var U=q.getChild(0).getFrameDocument();U.on('mousemove',P);U.on('mouseup',Q);}R.preventDefault&&R.preventDefault();});E.on('load',function(){var R='';if(G==CKEDITOR.DIALOG_RESIZE_WIDTH)R=' cke_resizer_horizontal';else if(G==CKEDITOR.DIALOG_RESIZE_HEIGHT)R=' cke_resizer_vertical';var S=CKEDITOR.dom.element.createFromHtml('<div class="cke_resizer'+R+' cke_resizer_'+H.lang.dir+'"'+' title="'+CKEDITOR.tools.htmlEncode(H.lang.resize)+'"'+' onmousedown="CKEDITOR.tools.callFunction('+O+', event )"></div>');E.parts.footer.append(S,1);});H.on('destroy',function(){CKEDITOR.tools.removeFunction(O);});function P(R){var S=H.lang.dir=='rtl',T=(R.data.$.screenX-L.x)*(S?-1:1),U=R.data.$.screenY-L.y,V=M.width,W=M.height,X=V+T*(E._.moved?1:2),Y=W+U*(E._.moved?1:2),Z=E._.element.getFirst(),aa=S&&Z.getComputedStyle('right'),ab=E.getPosition();if(ab.y+Y>K.height)Y=K.height-ab.y;if((S?aa:ab.x)+X>K.width)X=K.width-(S?aa:ab.x);if(G==CKEDITOR.DIALOG_RESIZE_WIDTH||G==CKEDITOR.DIALOG_RESIZE_BOTH)V=Math.max(F.minWidth||0,X-I);if(G==CKEDITOR.DIALOG_RESIZE_HEIGHT||G==CKEDITOR.DIALOG_RESIZE_BOTH)W=Math.max(F.minHeight||0,Y-J);
E.resize(V,W);if(!E._.moved)E.layout();R.data.preventDefault();};function Q(){CKEDITOR.document.removeListener('mouseup',Q);CKEDITOR.document.removeListener('mousemove',P);if(N){N.remove();N=null;}if(CKEDITOR.env.ie6Compat){var R=q.getChild(0).getFrameDocument();R.removeListener('mouseup',Q);R.removeListener('mousemove',P);}};};var o,p={},q;function r(E){E.data.preventDefault(1);};function s(E){var F=CKEDITOR.document.getWindow(),G=E.config,H=G.dialog_backgroundCoverColor||'white',I=G.dialog_backgroundCoverOpacity,J=G.baseFloatZIndex,K=CKEDITOR.tools.genKey(H,I,J),L=p[K];if(!L){var M=['<div tabIndex="-1" style="position: ',CKEDITOR.env.ie6Compat?'absolute':'fixed','; z-index: ',J,'; top: 0px; left: 0px; ',!CKEDITOR.env.ie6Compat?'background-color: '+H:'','" class="cke_dialog_background_cover">'];if(CKEDITOR.env.ie6Compat){var N=CKEDITOR.env.isCustomDomain(),O="<html><body style=\\'background-color:"+H+";\\'></body></html>";M.push('<iframe hidefocus="true" frameborder="0" id="cke_dialog_background_iframe" src="javascript:');M.push('void((function(){document.open();'+(N?"document.domain='"+document.domain+"';":'')+"document.write( '"+O+"' );"+'document.close();'+'})())');M.push('" style="position:absolute;left:0;top:0;width:100%;height: 100%;progid:DXImageTransform.Microsoft.Alpha(opacity=0)"></iframe>');}M.push('</div>');L=CKEDITOR.dom.element.createFromHtml(M.join(''));L.setOpacity(I!=undefined?I:0.5);L.on('keydown',r);L.on('keypress',r);L.on('keyup',r);L.appendTo(CKEDITOR.document.getBody());p[K]=L;}else L.show();q=L;var P=function(){var S=F.getViewPaneSize();L.setStyles({width:S.width+'px',height:S.height+'px'});},Q=function(){var S=F.getScrollPosition(),T=CKEDITOR.dialog._.currentTop;L.setStyles({left:S.x+'px',top:S.y+'px'});if(T)do{var U=T.getPosition();T.move(U.x,U.y);}while(T=T._.parentDialog)};o=P;F.on('resize',P);P();if(!(CKEDITOR.env.mac&&CKEDITOR.env.webkit))L.focus();if(CKEDITOR.env.ie6Compat){var R=function(){Q();arguments.callee.prevScrollHandler.apply(this,arguments);};F.$.setTimeout(function(){R.prevScrollHandler=window.onscroll||(function(){});window.onscroll=R;},0);Q();}};function t(){if(!q)return;var E=CKEDITOR.document.getWindow();q.hide();E.removeListener('resize',o);if(CKEDITOR.env.ie6Compat)E.$.setTimeout(function(){var F=window.onscroll&&window.onscroll.prevScrollHandler;window.onscroll=F||null;},0);o=null;};function u(){for(var E in p)p[E].remove();p={};};var v={},w=function(E){var F=E.data.$.ctrlKey||E.data.$.metaKey,G=E.data.$.altKey,H=E.data.$.shiftKey,I=String.fromCharCode(E.data.$.keyCode),J=v[(F?'CTRL+':'')+(G?'ALT+':'')+(H?'SHIFT+':'')+I];
if(!J||!J.length)return;J=J[J.length-1];J.keydown&&J.keydown.call(J.uiElement,J.dialog,J.key);E.data.preventDefault();},x=function(E){var F=E.data.$.ctrlKey||E.data.$.metaKey,G=E.data.$.altKey,H=E.data.$.shiftKey,I=String.fromCharCode(E.data.$.keyCode),J=v[(F?'CTRL+':'')+(G?'ALT+':'')+(H?'SHIFT+':'')+I];if(!J||!J.length)return;J=J[J.length-1];if(J.keyup){J.keyup.call(J.uiElement,J.dialog,J.key);E.data.preventDefault();}},y=function(E,F,G,H,I){var J=v[G]||(v[G]=[]);J.push({uiElement:E,dialog:F,key:G,keyup:I||E.accessKeyUp,keydown:H||E.accessKeyDown});},z=function(E){for(var F in v){var G=v[F];for(var H=G.length-1;H>=0;H--){if(G[H].dialog==E||G[H].uiElement==E)G.splice(H,1);}if(G.length===0)delete v[F];}},A=function(E,F){if(E._.accessKeyMap[F])E.selectPage(E._.accessKeyMap[F]);},B=function(E,F){},C={27:1,13:1},D=function(E){if(E.data.getKeystroke() in C)E.data.stopPropagation();};(function(){CKEDITOR.ui.dialog={uiElement:function(E,F,G,H,I,J,K){if(arguments.length<4)return;var L=(H.call?H(F):H)||'div',M=['<',L,' '],N=(I&&I.call?I(F):I)||{},O=(J&&J.call?J(F):J)||{},P=(K&&K.call?K.call(this,E,F):K)||'',Q=this.domId=O.id||CKEDITOR.tools.getNextId()+'_uiElement',R=this.id=F.id,S;O.id=Q;var T={};if(F.type)T['cke_dialog_ui_'+F.type]=1;if(F.className)T[F.className]=1;if(F.disabled)T.cke_disabled=1;var U=O['class']&&O['class'].split?O['class'].split(' '):[];for(S=0;S<U.length;S++){if(U[S])T[U[S]]=1;}var V=[];for(S in T)V.push(S);O['class']=V.join(' ');if(F.title)O.title=F.title;var W=(F.style||'').split(';');for(S in N)W.push(S+':'+N[S]);if(F.hidden)W.push('display:none');for(S=W.length-1;S>=0;S--){if(W[S]==='')W.splice(S,1);}if(W.length>0)O.style=(O.style?O.style+'; ':'')+W.join('; ');for(S in O)M.push(S+'="'+CKEDITOR.tools.htmlEncode(O[S])+'" ');M.push('>',P,'</',L,'>');G.push(M.join(''));(this._||(this._={})).dialog=E;if(typeof F.isChanged=='boolean')this.isChanged=function(){return F.isChanged;};if(typeof F.isChanged=='function')this.isChanged=F.isChanged;CKEDITOR.event.implementOn(this);this.registerEvents(F);if(this.accessKeyUp&&this.accessKeyDown&&F.accessKey)y(this,E,'CTRL+'+F.accessKey);var X=this;E.on('load',function(){if(X.getInputElement())X.getInputElement().on('focus',function(){E._.tabBarMode=false;E._.hasFocus=true;X.fire('focus');},X);});if(this.keyboardFocusable){this.tabIndex=F.tabIndex||0;this.focusIndex=E._.focusList.push(this)-1;this.on('focus',function(){E._.currentFocusIndex=X.focusIndex;});}CKEDITOR.tools.extend(this,F);},hbox:function(E,F,G,H,I){if(arguments.length<4)return;
this._||(this._={});var J=this._.children=F,K=I&&I.widths||null,L=I&&I.height||null,M={},N,O=function(){var Q=['<tbody><tr class="cke_dialog_ui_hbox">'];for(N=0;N<G.length;N++){var R='cke_dialog_ui_hbox_child',S=[];if(N===0)R='cke_dialog_ui_hbox_first';if(N==G.length-1)R='cke_dialog_ui_hbox_last';Q.push('<td class="',R,'" role="presentation" ');if(K){if(K[N])S.push('width:'+a(K[N]));}else S.push('width:'+Math.floor(100/G.length)+'%');if(L)S.push('height:'+a(L));if(I&&I.padding!=undefined)S.push('padding:'+a(I.padding));if(S.length>0)Q.push('style="'+S.join('; ')+'" ');Q.push('>',G[N],'</td>');}Q.push('</tr></tbody>');return Q.join('');},P={role:'presentation'};I&&I.align&&(P.align=I.align);CKEDITOR.ui.dialog.uiElement.call(this,E,I||{type:'hbox'},H,'table',M,P,O);},vbox:function(E,F,G,H,I){if(arguments.length<3)return;this._||(this._={});var J=this._.children=F,K=I&&I.width||null,L=I&&I.heights||null,M=function(){var N=['<table role="presentation" cellspacing="0" border="0" '];N.push('style="');if(I&&I.expand)N.push('height:100%;');N.push('width:'+a(K||'100%'),';');N.push('"');N.push('align="',CKEDITOR.tools.htmlEncode(I&&I.align||(E.getParentEditor().lang.dir=='ltr'?'left':'right')),'" ');N.push('><tbody>');for(var O=0;O<G.length;O++){var P=[];N.push('<tr><td role="presentation" ');if(K)P.push('width:'+a(K||'100%'));if(L)P.push('height:'+a(L[O]));else if(I&&I.expand)P.push('height:'+Math.floor(100/G.length)+'%');if(I&&I.padding!=undefined)P.push('padding:'+a(I.padding));if(P.length>0)N.push('style="',P.join('; '),'" ');N.push(' class="cke_dialog_ui_vbox_child">',G[O],'</td></tr>');}N.push('</tbody></table>');return N.join('');};CKEDITOR.ui.dialog.uiElement.call(this,E,I||{type:'vbox'},H,'div',null,{role:'presentation'},M);}};})();CKEDITOR.ui.dialog.uiElement.prototype={getElement:function(){return CKEDITOR.document.getById(this.domId);},getInputElement:function(){return this.getElement();},getDialog:function(){return this._.dialog;},setValue:function(E,F){this.getInputElement().setValue(E);!F&&this.fire('change',{value:E});return this;},getValue:function(){return this.getInputElement().getValue();},isChanged:function(){return false;},selectParentTab:function(){var H=this;var E=H.getInputElement(),F=E,G;while((F=F.getParent())&&F.$.className.search('cke_dialog_page_contents')==-1){}if(!F)return H;G=F.getAttribute('name');if(H._.dialog._.currentTabId!=G)H._.dialog.selectPage(G);return H;},focus:function(){this.selectParentTab().getInputElement().focus();return this;
},registerEvents:function(E){var F=/^on([A-Z]\w+)/,G,H=function(J,K,L,M){K.on('load',function(){J.getInputElement().on(L,M,J);});};for(var I in E){if(!(G=I.match(F)))continue;if(this.eventProcessors[I])this.eventProcessors[I].call(this,this._.dialog,E[I]);else H(this,this._.dialog,G[1].toLowerCase(),E[I]);}return this;},eventProcessors:{onLoad:function(E,F){E.on('load',F,this);},onShow:function(E,F){E.on('show',F,this);},onHide:function(E,F){E.on('hide',F,this);}},accessKeyDown:function(E,F){this.focus();},accessKeyUp:function(E,F){},disable:function(){var E=this.getElement();E.setAttribute('disabled','true');E.addClass('cke_disabled');},enable:function(){var E=this.getElement();E.removeAttribute('disabled');E.removeClass('cke_disabled');},isEnabled:function(){return!this.getInputElement().getAttribute('disabled');},isVisible:function(){return this.getInputElement().isVisible();},isFocusable:function(){if(!this.isEnabled()||!this.isVisible())return false;return true;}};CKEDITOR.ui.dialog.hbox.prototype=CKEDITOR.tools.extend(new CKEDITOR.ui.dialog.uiElement(),{getChild:function(E){var F=this;if(arguments.length<1)return F._.children.concat();if(!E.splice)E=[E];if(E.length<2)return F._.children[E[0]];else return F._.children[E[0]]&&F._.children[E[0]].getChild?F._.children[E[0]].getChild(E.slice(1,E.length)):null;}},true);CKEDITOR.ui.dialog.vbox.prototype=new CKEDITOR.ui.dialog.hbox();(function(){var E={build:function(F,G,H){var I=G.children,J,K=[],L=[];for(var M=0;M<I.length&&(J=I[M]);M++){var N=[];K.push(N);L.push(CKEDITOR.dialog._.uiElementBuilders[J.type].build(F,J,N));}return new CKEDITOR.ui.dialog[G.type](F,L,K,H,G);}};CKEDITOR.dialog.addUIElement('hbox',E);CKEDITOR.dialog.addUIElement('vbox',E);})();CKEDITOR.dialogCommand=function(E){this.dialogName=E;};CKEDITOR.dialogCommand.prototype={exec:function(E){E.openDialog(this.dialogName);},canUndo:false,editorFocus:CKEDITOR.env.ie||CKEDITOR.env.webkit};(function(){var E=/^([a]|[^a])+$/,F=/^\d*$/,G=/^\d*(?:\.\d+)?$/;CKEDITOR.VALIDATE_OR=1;CKEDITOR.VALIDATE_AND=2;CKEDITOR.dialog.validate={functions:function(){return function(){var N=this;var H=N&&N.getValue?N.getValue():arguments[0],I=undefined,J=CKEDITOR.VALIDATE_AND,K=[],L;for(L=0;L<arguments.length;L++){if(typeof arguments[L]=='function')K.push(arguments[L]);else break;}if(L<arguments.length&&typeof arguments[L]=='string'){I=arguments[L];L++;}if(L<arguments.length&&typeof arguments[L]=='number')J=arguments[L];var M=J==CKEDITOR.VALIDATE_AND?true:false;for(L=0;
L<K.length;L++){if(J==CKEDITOR.VALIDATE_AND)M=M&&K[L](H);else M=M||K[L](H);}if(!M){if(I!==undefined)alert(I);if(N&&(N.select||N.focus))N.select||N.focus();return false;}return true;};},regex:function(H,I){return function(){var K=this;var J=K&&K.getValue?K.getValue():arguments[0];if(!H.test(J)){if(I!==undefined)alert(I);if(K&&(K.select||K.focus))if(K.select)K.select();else K.focus();return false;}return true;};},notEmpty:function(H){return this.regex(E,H);},integer:function(H){return this.regex(F,H);},number:function(H){return this.regex(G,H);},equals:function(H,I){return this.functions(function(J){return J==H;},I);},notEqual:function(H,I){return this.functions(function(J){return J!=H;},I);}};CKEDITOR.on('instanceDestroyed',function(H){if(CKEDITOR.tools.isEmpty(CKEDITOR.instances)){var I;while(I=CKEDITOR.dialog._.currentTop)I.hide();u();}var J=H.editor._.storedDialogs;for(var K in J)J[K].destroy();});})();CKEDITOR.tools.extend(CKEDITOR.editor.prototype,{openDialog:function(E,F){if(this.mode=='wysiwyg'&&CKEDITOR.env.ie){var G=this.getSelection();G&&G.lock();}var H=CKEDITOR.dialog._.dialogDefinitions[E],I=this.skin.dialog;if(CKEDITOR.dialog._.currentTop===null)s(this);if(typeof H=='function'&&I._isLoaded){var J=this._.storedDialogs||(this._.storedDialogs={}),K=J[E]||(J[E]=new CKEDITOR.dialog(this,E));F&&F.call(K,K);K.show();return K;}else if(H=='failed'){t();throw new Error('[CKEDITOR.dialog.openDialog] Dialog "'+E+'" failed when loading definition.');}var L=this;function M(O){var P=CKEDITOR.dialog._.dialogDefinitions[E],Q=L.skin.dialog;if(!Q._isLoaded||N&&typeof O=='undefined')return;if(typeof P!='function')CKEDITOR.dialog._.dialogDefinitions[E]='failed';L.openDialog(E,F);};if(typeof H=='string'){var N=1;CKEDITOR.scriptLoader.load(CKEDITOR.getUrl(H),M,null,0,1);}CKEDITOR.skins.load(this,'dialog',M);return null;}});})();CKEDITOR.plugins.add('dialog',{requires:['dialogui']});
