text: ﻿/*
   * MindTouch Deki - enterprise collaboration and integration platform
   * Copyright (C) 2006-2009 MindTouch, Inc.
   * www.mindtouch.com  oss@mindtouch.com
   *
   * For community documentation and downloads visit www.opengarden.org;
   * please review the licensing section.
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation; either version 2 of the License, or
   * (at your option) any later version.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License along
   * with this program; if not, write to the Free Software Foundation, Inc.,
   * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
   * http://www.gnu.org/copyleft/gpl.html
   */
  
  (function(){(function(){var a=null,b=null,c,d=0;function e(h){var i=h.editor;if(i.document&&i.getCommand('maximize').state!=1){var j=i.getThemeSpace('contents'),k=j.getStyle('height'),l;if(CKEDITOR.env.ie)l=i.document.getBody().$.scrollHeight;else l=Deki.$(i.document.getBody().$).innerHeight();k=parseInt(k)||Deki.$(j.$).height();l=l||i.config.height;if(l<i.config.resize_minHeight)l=i.config.resize_minHeight;var m=l-k;if(m!=0)i.resize(null,l+70,true);}};function f(h){var i=h.textarea;if(!i||h.getCommand('maximize').state==1)return;var j;if(CKEDITOR.env.ie)j=i.$.scrollHeight;else{var k=i.getComputedStyle('padding-left'),l=i.getComputedStyle('padding-right');if(b===null){b=CKEDITOR.document.createElement('pre');b.setStyles({'font-size':i.getComputedStyle('font-size'),'font-family':i.getComputedStyle('font-family'),'padding-top':i.getComputedStyle('padding-top'),'padding-right':l,'padding-bottom':i.getComputedStyle('padding-bottom'),'padding-left':k,'line-height':i.getComputedStyle('line-height'),'letter-spacing':i.getComputedStyle('letter-spacing'),'overflow-x':'hidden',position:'absolute',top:0,left:'-9999px','white-space':'pre-wrap'});b.appendTo(i.getDocument().getBody());var m=parseInt(k)+parseInt(l);m=m||0;b.setStyle('width',i.$.clientWidth-m+'px');}var n=i.getValue().replace(/(<|>)/g,'_');n=n.replace(/&/g,'&amp;');var o=new CKEDITOR.dom.element('div',h.document);o.setHtml(n);if(b.getHtml()!=o.getHtml()){b.setHtml(n);var p=Deki.$(i.$).height(),q=Deki.$(b.$).height(),r=i.getComputedStyle('line-height');r=parseInt(r)||0;if(p<q+r||q<p)j=q+r;}}if(!isNaN(j)){j+=50;if(j<h.config.resize_minHeight)j=h.config.resize_minHeight;if(j!=d){if(CKEDITOR.env.ie)i.setStyle('height',j+'px');h.resize(null,j,true);d=j;}}};function g(h){var i=h.editor,j=CKEDITOR.document.getWindow();switch(i.mode){case 'wysiwyg':if(a){window.clearInterval(a);a=null;}if(b){b.remove();b=null;}if(typeof c=='function'){i.removeListener('resize',c);j.removeListener('resize',c);}d=0;i.on('insertHtml',e,null,null,200);i.on('insertElement',e,null,null,200);i.on('paste',e,null,null,2000);i.on('selectionChange',e);i.on('contentDom',e);i.on('key',e);break;case 'source':if(i.config.autogrow_source){if(CKEDITOR.env.ie){var k=i.textarea;c=function(l){var m=k&&k.getParent();m&&k.setStyle('height',m.$.clientHeight+'px');l.cancel();};i.on('resize',c,null,null,1);j.on('resize',c,null,null,1);}f(i);a=window.setInterval(function(){f(i);},400);}break;}};CKEDITOR.plugins.add('autogrow',{requires:['floatingtoolbar'],init:function(h){if(h.config.autogrow){h.on('mode',g);
  h.on('contentDom',g);}}});})();CKEDITOR.config.autogrow=true;CKEDITOR.config.autogrow_source=true;(function(){CKEDITOR.plugins.add('ckoverrides',{beforeInit:function(a){CKEDITOR.tools.extend(CKEDITOR.dom.node.prototype,{clone:function(b,c){var d=this.$.cloneNode(b);if(!c){var e=function(f){if(f.nodeType!=1)return;f.removeAttribute('id',false);f.removeAttribute('_cke_expando',false);f.removeAttribute('function',false);f.removeAttribute('block',false);f.removeAttribute('init',false);f.removeAttribute('foreach',false);f.removeAttribute('if',false);f.removeAttribute('where',false);f.removeAttribute('ctor',false);var g=f.childNodes;for(var h=0;h<g.length;h++)e(g[h]);};e(d);}return new CKEDITOR.dom.node(d);}},true);},init:function(a){}});})();CKEDITOR.plugins.add('combobutton',{requires:['richcombo'],onLoad:function(){CKEDITOR.ui.comboButton=CKEDITOR.tools.createClass({base:CKEDITOR.ui.richCombo,$:function(a){this.base(a);},statics:{handler:{create:function(a){return new CKEDITOR.ui.comboButton(a);}}},proto:{canGroup:true,onClose:function(){this.setState(this._.previousState);},render:function(a,b){var c=CKEDITOR.env,d='cke_'+this.id,e=CKEDITOR.tools.addFunction(function(j){var m=this;var k=m._;if(k.state==0)return;if(!k.on)k.previousState=k.state;m.createPanel(a);if(k.on){k.panel.hide();return;}if(!k.committed){k.list.commit();k.committed=1;}var l=m.getValue();if(l)k.list.mark(l);else k.list.unmarkAll();k.panel.showBlock(m.id,new CKEDITOR.dom.element(j),4);},this),f={id:d,combo:this,focus:function(){var j=CKEDITOR.document.getById(d);j.focus();},clickFn:e};a.on('mode',function(){this.setState(this.modes[a.mode]?2:0);},this);var g=CKEDITOR.tools.addFunction(function(j,k){j=new CKEDITOR.dom.event(j);var l=j.getKeystroke();switch(l){case 13:case 32:case 40:CKEDITOR.tools.callFunction(e,k);break;default:f.onkey(f,l);}j.preventDefault();});f.keyDownFn=g;var h='';if(this.className)h+=this.className;h+=' cke_off';b.push('<span class="cke_button">','<a id="',d,'" class="',h,'"',c.gecko&&c.version>=10900&&!c.hc?'':'" href="javascript:void(\''+(this.title||'').replace("'")+"')\"",' title="',this.title,'" tabindex="-1" hidefocus="true" role="button" aria-labelledby="'+d+'_label"'+' aria-haspopup="true"');if(c.opera||c.gecko&&c.mac)b.push(' onkeypress="return false;"');if(c.gecko)b.push(' onblur="this.style.cssText = this.style.cssText;"');b.push(' onkeydown="CKEDITOR.tools.callFunction( ',g,', event, this );" onclick="CKEDITOR.tools.callFunction(',e,', this); return false;"><span class="cke_icon"');
  if(this.icon){var i=(this.iconOffset||0)*(-16);b.push(' style="background-image:url(',CKEDITOR.getUrl(this.icon),');background-position:0 '+i+'px;"');}b.push('>&nbsp;</span><span id="',d,'_label" class="cke_label">',this.label,'</span>');b.push('<span class="cke_buttonarrow">'+(CKEDITOR.env.hc?'&#9660;':'&nbsp;')+'</span>');b.push('</a>','</span>');if(this.onRender)this.onRender();return f;},setValue:function(a,b){this._.value=a;}}});},init:function(a){a.ui.addHandler(CKEDITOR.UI_COMBOBUTTON,CKEDITOR.ui.comboButton.handler);}});CKEDITOR.UI_COMBOBUTTON=92;CKEDITOR.ui.prototype.addComboButton=function(a,b){this.add(a,CKEDITOR.UI_COMBOBUTTON,b);};(function(){var a={dl:1};function b(k,l,m,n,o){if(!a[k.getName()])return[];if(!n)n=0;if(!m)m=[];for(var p=0,q=k.getChildCount();p<q;p++){var r=k.getChild(p);if(!r.is||!r.is('dt','dd'))continue;var s={parent:k,indent:n,contents:[],dx:r.getName()};if(!o){s.grandparent=k.getParent();if(s.grandparent&&s.grandparent.is&&s.grandparent.is('dt','dd'))s.grandparent=s.grandparent.getParent();}else s.grandparent=o;if(l)CKEDITOR.dom.element.setMarker(l,r,'listarray_index',m.length);m.push(s);for(var t=0,u=r.getChildCount();t<u;t++){var v=r.getChild(t);if(v.type==1&&a[v.getName()])b(v,l,m,n+1,s.grandparent);else s.contents.push(v);}}return m;};function c(k,l,m,n){if(!m)m=0;if(!k||k.length<m+1)return null;var o=k[m].parent.getDocument(),p=new CKEDITOR.dom.documentFragment(o),q=null,r=m,s=Math.max(k[m].indent,0),t=null,u=n==1?'p':'div';for(;;){var v=k[r];if(v.indent==s){if(!q||k[r].parent.getName()!=q.getName()){q=k[r].parent.clone(false,true);p.append(q);}t=q.append(o.createElement(v.dx));for(var w=0;w<v.contents.length;w++)t.append(v.contents[w].clone(true,true));r++;}else if(v.indent==Math.max(s,0)+1){var x=c(k,null,r,n);t.append(x.listNode);r=x.nextIndex;}else if(v.indent==-1&&!m&&v.grandparent){t;if(a[v.grandparent.getName()])t=o.createElement(v.dx);else if(n!=2&&v.grandparent.getName()!='td')t=o.createElement(u);else t=new CKEDITOR.dom.documentFragment(o);for(w=0;w<v.contents.length;w++)t.append(v.contents[w].clone(true,true));if(t.type==11&&r!=k.length-1){if(t.getLast()&&t.getLast().type==1&&t.getLast().getAttribute('type')=='_moz')t.getLast().remove();t.appendBogus();}if(t.type==1&&t.getName()==u&&t.$.firstChild){t.trim();var y=t.getFirst();if(y.type==1&&y.isBlockBoundary()){var z=new CKEDITOR.dom.documentFragment(o);t.moveChildren(z);t=z;}}var A=t.$.nodeName.toLowerCase();if(!CKEDITOR.env.ie&&(A=='div'||A=='p'))t.appendBogus();
  p.append(t);q=null;r++;}else return null;if(k.length<=r||Math.max(k[r].indent,0)<s)break;}if(l){var B=p.getFirst();while(B){if(B.type==1)CKEDITOR.dom.element.clearMarkers(l,B);B=B.getNextSourceNode();}}return{listNode:p,nextIndex:r};};function d(k,l){k.getCommand(this.name).setState(l);};function e(k){var q=this;var l=k.data.path,m=l.blockLimit,n=l.elements,o;for(var p=0;p<n.length&&(o=n[p])&&(!o.equals(m));p++)if(n[p].getName()==q.type)return d.call(q,k.editor,q.type==n[p].getName()?1:2);return d.call(q,k.editor,2);};function f(k,l,m,n){var o=CKEDITOR.plugins.list.listToArray(l.root,m),p=[];for(var q=0;q<l.contents.length;q++){var r=l.contents[q];r.renameNode(this.type);}};var g=/^h[1-6]$/;function h(k,l,m){var n=l.contents,o=l.root.getDocument(),p=[];if(n.length==1&&n[0].equals(l.root)){var q=o.createElement('div');n[0].moveChildren&&n[0].moveChildren(q);n[0].append(q);n[0]=q;}var r=l.contents[0].getParent();for(var s=0;s<n.length;s++)r=r.getCommonAncestor(n[s].getParent());for(s=0;s<n.length;s++){var t=n[s],u;while(u=t.getParent()){if(u.equals(r)){p.push(t);break;}t=u;}}if(p.length<1)return;var v=p[p.length-1].getNext(),w=o.createElement('dl');m.push(w);while(p.length){var x=p.shift(),y=o.createElement(this.type=='dl'?'dt':this.type);if(g.test(x.getName()))x.appendTo(y);else{x.copyAttributes(y);x.moveChildren(y);x.remove();}y.appendTo(w);if(!CKEDITOR.env.ie)y.appendBogus();}if(v)w.insertBefore(v);else w.appendTo(r);};function i(k,l,m){var n=b(l.root,m),o=[];if(a[this.type])for(var p=0;p<n.length;p++)n[p].indent=-1;else{for(var q=0;q<l.contents.length;q++){var r=l.contents[q];r=r.getAscendant(this.type,true);if(!r||r.getCustomData('list_item_processed'))continue;o.push(r);CKEDITOR.dom.element.setMarker(m,r,'list_item_processed',true);}var s=null;for(q=0;q<o.length;q++){var t=o[q].getCustomData('listarray_index');n[t].indent=-1;s=t;}for(q=s+1;q<n.length;q++)if(n[q].indent>n[q-1].indent+1){var u=n[q-1].indent+1-n[q].indent,v=n[q].indent;while(n[q]&&n[q].indent>=v){n[q].indent+=u;q++;}q--;}}var w=c(n,m,null,k.config.enterMode),x=w.listNode,y,z;function A(B){if((y=x[B?'getFirst':'getLast']())&&(!(y.is&&y.isBlockBoundary())&&(z=l.root[B?'getPrevious':'getNext'](CKEDITOR.dom.walker.whitespaces(true)))&&(!(z.is&&z.isBlockBoundary({br:1})))))k.document.createElement('br')[B?'insertBefore':'insertAfter'](y);};A(true);A();x.replace(l.root);};function j(k,l){this.name=k;this.type=l;};j.prototype={exec:function(k){k.focus();var l=k.document,m=k.getSelection(),n=m&&m.getRanges();
  if(!n||n.length<1)return;if(this.state==2){var o=l.getBody();o.trim();if(!o.getFirst()){var p=l.createElement(k.config.enterMode==1?'p':k.config.enterMode==3?'div':'br');p.appendTo(o);n=[new CKEDITOR.dom.range(l)];if(p.is('br')){n[0].setStartBefore(p);n[0].setEndAfter(p);}else n[0].selectNodeContents(p);m.selectRanges(n);}else{var q=n.length==1&&n[0],r=q&&q.getEnclosedNode();if(r&&r.is&&this.type==r.getName())d.call(this,k,1);}}var s=m.createBookmarks(true),t=[],u={};while(n.length>0){q=n.shift();var v=q.getBoundaryNodes(),w=v.startNode,x=v.endNode;if(w.type==1&&w.getName()=='td')q.setStartAt(v.startNode,1);if(x.type==1&&x.getName()=='td')q.setEndAt(v.endNode,2);var y=q.createIterator(),z;y.forceBrBreak=this.state==2;while(z=y.getNextParagraph()){var A=new CKEDITOR.dom.elementPath(z),B=A.elements,C=B.length,D=null,E=false,F=A.blockLimit,G;for(var H=C-1;H>=0&&(G=B[H]);H--)if(a[G.getName()]&&F.contains(G)){F.removeCustomData('list_group_object');var I=G.getCustomData('list_group_object');if(I)I.contents.push(z);else{I={root:G,contents:[z]};t.push(I);CKEDITOR.dom.element.setMarker(u,G,'list_group_object',I);}E=true;break;}if(E)continue;var J=F;if(J.getCustomData('list_group_object'))J.getCustomData('list_group_object').contents.push(z);else{I={root:J,contents:[z]};CKEDITOR.dom.element.setMarker(u,J,'list_group_object',I);t.push(I);}}}var K=[];while(t.length>0){I=t.shift();if(this.state==2){if(a[I.root.getName()])f.call(this,k,I,u,K);else h.call(this,k,I,K);}else if(this.state==1&&a[I.root.getName()])i.call(this,k,I,u);}for(H=0;H<K.length;H++){D=K[H];var L,M=this;(L=function(N){var O=D[N?'getPrevious':'getNext'](CKEDITOR.dom.walker.whitespaces(true));if(O&&O.getName&&O.getName()==M.type){O.remove();O.moveChildren(D,N?true:false);}})();L(true);}CKEDITOR.dom.element.clearAllMarkers(u);m.selectBookmarks(s);k.focus();}};CKEDITOR.plugins.add('definitionlist',{requires:['domiterator','list'],lang:['en','cs','de','en-au','es','et','fr-ca','fr','he','hu','it','ja','ko','nl','pt-br','ru','sv'],init:function(k){var l=new j('definitionlist','dl'),m=new j('definitionterm','dt'),n=new j('definitiondesc','dd');k.addCommand('definitionlist',l);k.addCommand('definitionterm',m);k.addCommand('definitiondesc',n);k.ui.addButton('DefinitionList',{label:k.lang.definitionList,command:'definitionlist',icon:this.path+'images/dl.gif'});k.ui.addButton('DefinitionTerm',{label:k.lang.definitionTerm,command:'definitionterm',icon:this.path+'images/dt.gif'});k.ui.addButton('DefinitionDescription',{label:k.lang.definitionDesc,command:'definitiondesc',icon:this.path+'images/dd.gif'});
  k.on('selectionChange',CKEDITOR.tools.bind(e,l));k.on('selectionChange',CKEDITOR.tools.bind(e,m));k.on('selectionChange',CKEDITOR.tools.bind(e,n));}});})();(function(){var a='extensions',b={canUndo:false,exec:function(c){this.editor=c;var d=c.getSelection(),e=d&&d.getRanges()[0],f='';if(e&&!e.collapsed){d.lock();f=e.cloneContents().getFirst().getText();d.unlock(true);}var g={sSelection:f,elParent:d.getStartElement().getParent()},h=CKEDITOR.plugins.get('mindtouchdialog');h.openDialog(a,{url:c.config.mindtouch.commonPath+'/popups/extension_dialog.php',width:'700px',height:'400px',params:g,callback:this._.insertExtension,scope:this});},_:{insertExtension:function(c){var d=this.editor;if(c.sDekiScript)d.insertHtml(CKEDITOR.tools.htmlEncode(c.sDekiScript));}}};CKEDITOR.plugins.add(a,{requires:['mindtouchdialog','selection'],lang:['en','cs','de','en-au','es','et','fr-ca','fr','he','hu','it','ja','ko','nl','pt-br','ru','sv'],init:function(c){c.addCommand(a,b);c.ui.addButton('Extensions',{label:c.lang.extensions.toolbar,command:a,icon:c.config.mindtouch.commonPath+'/icons/icons.gif',iconOffset:20});}});})();(function(){var a=function(c){var d=c.data,e=Deki.$(d.getThemeSpace('top').$),f=Deki.$(d.container.$),g=Deki.$(CKEDITOR.document.$).scrollTop(),h=parseInt(f.css('padding-top'))||0,i=f.position().top+h,j=null;if(g>i){var k=$('#cke_contents_'+d.name),l=k.position().top+k.height()-e.height();if(g<l)j=g-i;}else{var m=e.position().top;if(m!=i)j=0;}if(j!==null)e.css('top',j+'px');};function b(c){var d=c.editor;if(d.config.floating_toolbar){var e=CKEDITOR.document.getWindow(),f=d.container,g=f.getDocumentPosition(),h=e.getScrollPosition(),i=Deki.$(d.getThemeSpace('top').$),j=g.y-i.height();if(j<0)j=0;if(h.y>g.y)e.$.scrollTo(0,j);}};CKEDITOR.plugins.add('floatingtoolbar',{init:function(c){if(c.config.floating_toolbar){var d=CKEDITOR.document.getWindow().$;c.on('themeLoaded',function(e){Deki.$(d).bind('scroll',c,a);});c.on('destroy',function(e){Deki.$(d).unbind('scroll',a);});c.on('mode',b,null,null,1);c.on('contentDom',b,null,null,1);c.on('save',b,null,null,1);c.on('cancel',b,null,null,1);c.on('scrollToTop',b,null,null,1);}}});})();CKEDITOR.config.floating_toolbar=true;(function(){var a=null;function b(k){return d(k.getAttribute('_cke_saved_style'));};function c(k){return d(k.getStyleAttribute(true));};function d(k){var l={};if(typeof k!=='string'||k.length==0)return l;k=k.replace(/[\n\r]/g,'');k=k.replace(/\s+/g,' ');k=k.replace(/\/\*.*\*\//g,'');var m=k.split(';'),n,o,p,q;
  for(n=0;n<m.length;n++){if(m[n].indexOf(':')===-1)continue;o=h(':',m[n],2);p=CKEDITOR.tools.trim(o[0]).toLowerCase();q=CKEDITOR.tools.trim(o[1]);l[p]=q;}return l;};function e(k,l){if(g(k))k.$.setAttribute('_cke_saved_style',l);};function f(k){var l=[],m,n;for(m in k)l.push(m+': '+k[m]);n=l.join('; ');if(n.length)n+=';';return n;};function g(k){var l=false,m,n;for(m in CKEDITOR.instances){n=CKEDITOR.instances[m];if(n.document&&n.document.equals(k.getDocument())){l=true;break;}}return l;};function h(k,l,m){var n={0:''};if(arguments.length<2||typeof arguments[0]=='undefined'||typeof arguments[1]=='undefined')return null;if(k===''||k===false||k===null)return false;if(typeof k=='function'||typeof k=='object'||typeof l=='function'||typeof l=='object')return n;if(k===true)k='1';if(!m)return l.toString().split(k.toString());else{var o=l.toString().split(k.toString()),p=o.splice(0,m-1),q=o.join(k.toString());p.push(q);return p;}};function i(){if(a){var k;if(a.is&&a.is('img'))k=new CKEDITOR.dom.nodeList([a.$]);else k=a.getChildren();j(k,'img');a=null;}};function j(k){var l,m,n,o,p,q=CKEDITOR.tools.isArray(arguments[1])?arguments[1]:[arguments[1]];for(n=0;n<k.count();n++){m=k.getItem(n);if(m.type!==1)continue;if(m.is.apply(m,q)){p=b(m);o=c(m);for(l in p)p[l]=m.getStyle(l)||p[l];for(l in o)p[l]=o[l];e(m,f(p));}j(m.getChildren());}};CKEDITOR.plugins.add('inlinestyle',{requires:['styles'],beforeInit:function(k){CKEDITOR.tools.extend(CKEDITOR.dom.element.prototype,{getAttribute:(function(){var l=function(m){if(m=='style')return this.getStyleAttribute();else return this.$.getAttribute(m,2);};if(CKEDITOR.env.ie&&(CKEDITOR.env.ie7Compat||CKEDITOR.env.ie6Compat))return function(m){var q=this;switch(m){case 'class':m='className';break;case 'tabindex':var n=l.call(q,m);if(n!==0&&q.$.tabIndex===0)n=null;return n;break;case 'checked':var o=q.$.attributes.getNamedItem(m),p=o.specified?o.nodeValue:q.$.checked;return p?'checked':null;}return l.call(q,m);};else return l;})(),getStyleAttribute:(function(){var l=function(m){if(!m&&this.hasAttribute('_cke_saved_style'))return this.$.getAttribute('_cke_saved_style',2);else return this.$.getAttribute('style',2);};if(CKEDITOR.env.ie&&(CKEDITOR.env.ie7Compat||CKEDITOR.env.ie6Compat))return function(m){if(!m&&this.hasAttribute('_cke_saved_style'))return this.$.getAttribute('_cke_saved_style');else return this.$.style.cssText;};else return l;})(),setAttribute:(function(){var l=function(m,n){this.$.setAttribute(m,n);if(m=='style')e(this,n);return this;
  };if(CKEDITOR.env.ie&&(CKEDITOR.env.ie7Compat||CKEDITOR.env.ie6Compat))return function(m,n){var o=this;if(m=='class')o.$.className=n;else if(m=='style'){o.$.style.cssText=n;e(o,n);}else if(m=='tabindex')o.$.tabIndex=n;else if(m=='checked')o.$.checked=n;else l.apply(o,arguments);return o;};else return l;})(),removeAttribute:(function(){var l=function(m){this.$.removeAttribute(m);if(m=='style'&&this.hasAttribute('_cke_saved_style'))this.$.removeAttribute('_cke_saved_style');};if(CKEDITOR.env.ie&&(CKEDITOR.env.ie7Compat||CKEDITOR.env.ie6Compat))return function(m){if(m=='class')m='className';else if(m=='tabindex')m='tabIndex';l.call(this,m);};else return l;})(),removeStyle:function(l){var p=this;var m;if(!p.hasAttribute('_cke_saved_style')){p.setStyle(l,'');if(p.$.style.removeAttribute)p.$.style.removeAttribute(CKEDITOR.tools.cssStyleToDomStyle(l));m=p.$.style.cssText;}else{var n=b(p);if(n[l])delete n[l];m=f(n);var o=CKEDITOR.style.getStyleText({styles:n});p.$.style.cssText=o;}if(!m)p.removeAttribute('style');else if(g(p))p.$.setAttribute('_cke_saved_style',m);},setStyle:function(l,m){var q=this;var n;if(!q.hasAttribute('_cke_saved_style')){q.$.style[CKEDITOR.tools.cssStyleToDomStyle(l)]=m;n=q.$.style.cssText;}else{var o=b(q);o[l]=m;n=f(o);var p=CKEDITOR.style.getStyleText({styles:o});q.$.style.cssText=p;}if(g(q))q.$.setAttribute('_cke_saved_style',n);return q;},copyAttributes:function(l,m){var s=this;var n=s.$.attributes;m=m||{};for(var o=0;o<n.length;o++){var p=n[o],q=p.nodeName.toLowerCase(),r;if(q in m)continue;if(q=='checked'&&(r=s.getAttribute(q)))l.setAttribute(q,r);else if(p.specified||CKEDITOR.env.ie&&p.nodeValue&&q=='value'){r=s.getAttribute(q);if(r===null)r=p.nodeValue;l.setAttribute(q,r);}}if(s.$.style.cssText.length||s.hasAttribute('_cke_saved_style'))l.$.style.cssText=s.getAttribute('_cke_saved_style')||s.$.style.cssText;}},true);},init:function(k){k.on('contentDom',function(l){k.document.on('mousedown',function(m){a=m.data.getTarget();});k.document.on('mouseup',i);});}});})();(function(){function a(d,e){var f=e.ui._.items[d];if(typeof f=='undefined'||f.type!=1)return null;var g={command:f.command};g=CKEDITOR.tools.extend({},g,f.args[0]);return g;};function b(d,e,f){d.addMenuGroup(e);var g={};for(var h=0;h<f.length;h++){var i=f[h],j=a(i,d);if(j){j.group=e;g[i.toLowerCase()]=j;}}return g;};function c(d,e){var f={};for(var g in e){var h=0,i=e[g].command,j=i&&d.getCommand(i);if(j)h=j.state;f[g]=h;}return f;};CKEDITOR.plugins.add('menubuttons',{requires:['mindtouch'],lang:['en','cs','de','en-au','es','et','fr-ca','fr','he','hu','it','ja','ko','nl','pt-br','ru','sv'],init:function(d){var e=b(d,'insertButton',d.config.menu_insertItems);
  d.addMenuItems(e);d.ui.add('InsertMenu',5,{label:d.lang.menubuttons.insert,title:d.lang.menubuttons.insert,className:'cke_button_insert',onMenu:function(){return c(d,e);}});var f=b(d,'viewButton',d.config.menu_viewItems);d.addMenuItems(f);d.ui.add('ViewMenu',5,{label:d.lang.menubuttons.view,title:d.lang.menubuttons.view,className:'cke_button_view',onMenu:function(){var g,h,i,j;for(j=0;j<d.config.menu_viewItems.length;j++){i=d.config.menu_viewItems[j].toLowerCase();g=d.getMenuItem(i);switch(i){case 'source':h=d.mode=='source'?d.lang.mindtouch.wysiwyg:d.lang.source;break;case 'showblocks':var k=d.getCommand('showblocks').state;h=k==1?d.lang.mindtouch.hideBlocks:d.lang.showBlocks;break;}if(g&&h)g.label=h;}return c(d,f);},onRender:function(){var g=this,h=function(){for(var i=0;i<d.config.menu_viewItems.length;i++){var j=a(d.config.menu_viewItems[i],d),k=j&&d.getCommand(j.command);if(k&&k.state==1){g.setState(1);return;}}g.setState(2);};d.on('afterCommandExec',function(){h();});d.on('mode',function(){h();});}});}});})();CKEDITOR.config.menu_insertItems=['Flash','Extensions','DekiScript','JEM','CSS','Comment'];CKEDITOR.config.menu_viewItems=['Source','ShowBlocks'];(function(){var a=false,b=function(e){var f=e.data.path.elements,g=e.editor;if(g.mode!='wysiwyg')return false;a=false;for(var h=0;h<f.length;h++)if(f[h].is('h1')&&g.document.getBody().getFirst().equals(f[h])){a=true;return false;}for(var i in g._.commands)if(CKEDITOR.tools.indexOf(g.config.header_ignoreCommands,i)==-1)g._.commands[i].enable();return true;},c=function(e){var f=e.editor;if(!a)return false;for(var g in f._.commands)if(CKEDITOR.tools.indexOf(f.config.header_ignoreCommands,g)==-1)f._.commands[g].disable();return true;},d=function(e,f,g,h){var i=g.command;if(i){var j=new CKEDITOR.style(h);e.attachStyleStateChange(j,function(k){e.getCommand(i).setState(k);});e.addCommand(i,new CKEDITOR.styleCommand(j));}e.ui.addButton(f,g);};CKEDITOR.plugins.add('mindtouch',{lang:['en','cs','de','en-au','es','et','fr-ca','fr','he','hu','it','ja','ko','nl','pt-br','ru','sv'],requires:['button','format','selection','styles'],beforeInit:function(e){e.lang.pagebreak=e.lang.fakeobjects.div;var f=this.path;d(e,'Comment',{label:e.lang.mindtouch.comment,command:'comment',icon:f+'images/comment.png'},e.config.mindtouchStyles_comment);d(e,'DekiScript',{label:e.lang.mindtouch.dekiscript,command:'dekiscript',icon:f+'images/script.png'},e.config.mindtouchStyles_dekiscript);d(e,'JEM',{label:e.lang.mindtouch.jem,command:'jem',icon:f+'images/script-jem.png'},e.config.mindtouchStyles_jem);
  d(e,'CSS',{label:e.lang.mindtouch.css,command:'css',icon:f+'images/script-css.png'},e.config.mindtouchStyles_css);},init:function(e){e.skin.editor.css.push(CKEDITOR.basePath+'../editor/skin.css');e.on('selectionChange',b,null,null,-1);e.on('selectionChange',c,null,null,100);e.lang.format.tag_h6=e.lang.format.tag_h5;e.lang.format.tag_h5=e.lang.format.tag_h4;e.lang.format.tag_h4=e.lang.format.tag_h3;e.lang.format.tag_h3=e.lang.format.tag_h2;e.lang.format.tag_h2=e.lang.format.tag_h1;CKEDITOR.tools.extend(e.lang.format,e.lang.mindtouch.format,true);var f=this.path,g={},h='formatButton';e.addMenuGroup(h);g.h1={label:e.lang.format.tag_h2,command:'h1',icon:f+'images/text_heading_1.png',group:h};g.h2={label:e.lang.format.tag_h3,command:'h2',icon:f+'images/text_heading_2.png',group:h};g.h3={label:e.lang.format.tag_h4,command:'h3',icon:f+'images/text_heading_3.png',group:h};g.h4={label:e.lang.format.tag_h5,command:'h4',icon:f+'images/text_heading_4.png',group:h};g.h5={label:e.lang.format.tag_h6,command:'h5',icon:f+'images/text_heading_5.png',group:h};e.addMenuItems(g);e.ui.add('Hx',5,{label:e.lang.mindtouch.format.tag_hx,title:e.lang.mindtouch.format.tag_hx,className:'cke_button_hx',icon:f+'images/text_heading_x.png',onMenu:function(){var j={};for(var k=0;k<e.config.menu_hxItems.length;k++){var l=e.config.menu_hxItems[k].toLowerCase(),m=0,n=g[l].command,o=n&&e.getCommand(n);if(o)m=o.state;j[l]=m;}return j;},onRender:function(){var j=this;e.on('selectionChange',function(){var k=2;for(var l=0;l<e.config.menu_hxItems.length;l++){var m=e.config.menu_hxItems[l].toLowerCase(),n=e.getCommand(g[m].command);if(n&&n.state==1)k=1;}j.setState(k);});}});var i=e.config.enterMode==3?'div':'p';d(e,'Normal',{label:e.lang.format['tag_'+i],command:'normal'},e.config['format_'+i]);d(e,'Code',{label:e.lang.mindtouch.code,command:'code',icon:f+'images/style_code.png'},e.config.mindtouchStyles_code);d(e,'H1',g.h1,e.config.format_h2);d(e,'H2',g.h2,e.config.format_h3);d(e,'H3',g.h3,e.config.format_h4);d(e,'H4',g.h4,e.config.format_h5);d(e,'H5',g.h5,e.config.format_h6);e.on('paste',function(j){if(j.data.html){var k=j.data.html;if(e.config.paste_removeStyles||CKEDITOR.env.webkit&&e.config.paste_removeStylesWebkit){var l=new CKEDITOR.dom.element('div',e.document);l.setHtml(k);var m=l.getNextSourceNode(false,1);while(m){m.removeAttribute('style');m=m.getNextSourceNode(false,1);}j.data.html=l.getHtml();}}});e.on('insertHtml',function(j){var k=j.editor;if(k.mode=='wysiwyg'&&CKEDITOR.env.webkit){var l=j.data;
  if(/<(p|div|h[1-6]|ul|ol)/.test(l)){k.focus();var m=k.getSelection(),n=m&&m.getRanges()[0];if(n.collapsed&&n.startContainer.is&&n.startContainer.is('p','h1','h2','h3','h4','h5','h6')){var o=n.startContainer.getFirst();if(!o||!o.getNext()&&(o.is&&o.is('br')||o.type==3&&o.getText().length==0)){k.fire('saveSnapshot');if(k.dataProcessor)l=k.dataProcessor.toHtml(l);var p=new CKEDITOR.dom.element('div',k.document);p.setHtml(l);var q=p.getChildren();while(q.count())q.getItem(0).insertBefore(n.startContainer);CKEDITOR.tools.setTimeout(function(){k.fire('saveSnapshot');},0);j.cancel();}}}}});}});})();CKEDITOR.config.header_ignoreCommands=['mindtouchsave','mindtouchcancel','source','undo','redo','find','replace','removeFormat','maximize','about','blur','blurBack','checkspell','copy','cut','paste','newpage','pagebreak','preview','print','scaytcheck','selectAll','shiftTab','showblocks','tab','toolbarCollapse','toolbarFocus','atd'];CKEDITOR.config.mindtouchStyles_code={element:'code'};CKEDITOR.config.mindtouchStyles_comment={element:'p',attributes:{'class':'comment'}};CKEDITOR.config.mindtouchStyles_dekiscript={element:'pre',attributes:{'class':'script'}};CKEDITOR.config.mindtouchStyles_jem={element:'pre',attributes:{'class':'script-jem'}};CKEDITOR.config.mindtouchStyles_css={element:'pre',attributes:{'class':'script-css'}};CKEDITOR.config.menu_hxItems=['H4','H5'];CKEDITOR.config.paste_removeStyles=false;CKEDITOR.config.paste_removeStylesWebkit=true;(function(){CKEDITOR.plugins.add('mindtouchdialog',{openDialog:function(a,b){var d=this;d.dialogName=a;d.dialogParams=b;var c=new Deki.Dialog({src:d.dialogParams.url,width:d.dialogParams.width,height:d.dialogParams.height,buttons:[Deki.Dialog.BTN_OK,Deki.Dialog.BTN_CANCEL],args:d.dialogParams.params,callback:d.dialogParams.callback,scope:d.dialogParams.scope});c.render();c.show();}});})();(function(){var a='mindtouchimage',b={canUndo:false,exec:function(c){this.editor=c;var d=c.getSelection().getSelectedElement();if(!(d&&d.getName()=='img'&&!d.getAttribute('_cke_protected_html'))&&!(d&&d.getName()=='input'&&d.getAttribute('type')&&d.getAttribute('type')=='image'))d=null;var e={};if(d){var f='';if(d.hasClass('rwrap'))f='right';else if(d.hasClass('lwrap'))f='left';else f='default';var g=parseInt(d.getComputedStyle('width'))||parseInt(d.getStyle('width'))||parseInt(d.getAttribute('width'))||0,h=parseInt(d.getComputedStyle('height'))||parseInt(d.getStyle('height'))||parseInt(d.getAttribute('height'))||0;e={bInternal:d.hasClass('internal'),sSrc:d.getAttribute('_cke_saved_src')||d.getAttribute('src'),sAlt:d.getAttribute('alt'),sWrap:f,nWidth:g,nHeight:h};
  }e.nPageId=c.config.mindtouch.pageId;e.sUserName=c.config.mindtouch.userName;var i=c.config.mindtouch.commonPath+'/popups/image_dialog.php?contextID='+c.config.mindtouch.pageId;if(d)i+='&update=true';var j=CKEDITOR.plugins.get('mindtouchdialog');j.openDialog(a,{url:i,width:'600px',height:'370px',params:e,callback:this._.insertImage,scope:this});},_:{insertImage:function(c){var d=this.editor,e=d.document.createElement('img');e.setAttribute('alt','');try{e.setAttribute('_cke_saved_src',c.sSrc);e.setAttribute('src',c.sSrc);if(c.nWidth||c.nHeight){e.setStyle('width',c.nWidth+'px');e.setStyle('height',c.nHeight+'px');}if(c.sAlt)e.setAttribute('alt',c.sAlt);var f=c.bInternal?'internal ':'';e.setAttribute('class',f+c.sWrapClass);switch(c.sWrap){case 'left':case 'right':e.setAttribute('align',c.sWrap);break;default:if(e.hasAttribute('align'))e.removeAttribute('align');break;}if(c.sFullSrc&&c.sFullSrc.length>0){var g=e&&e.getAscendant('a');if(!g)g=d.document.createElement('a');g.setAttribute('href',c.sFullSrc);g.setAttribute('_cke_saved_href',c.sFullSrc);if(c.sAlt)g.setAttribute('title',c.sAlt);d.insertElement(g);g.append(e,false);}else d.insertElement(e);}catch(h){}}}};CKEDITOR.plugins.add(a,{requires:['mindtouchdialog'],init:function(c){c.addCommand(a,b);c.ui.addButton('MindTouchImage',{label:c.lang.common.image,command:a});if(c.addMenuItems)c.addMenuItems({image:{label:c.lang.image.menu,command:'mindtouchimage',group:'image'}});c.on('doubleclick',function(d){var e=d.data.element;if(e.is('img')&&!e.getAttribute('_cke_realelement'))if(c.execCommand(a))d.cancel();},this,null,1);}});})();(function(){var a='mindtouchlink',b={canUndo:false,exec:function(e){var l=this;l.editor=e;var f=e.getSelection(),g=null,h=CKEDITOR.plugins.link;if((g=h.getSelectedLink(e))&&(g.hasAttribute('href')))f.selectElement(g);else g=null;var i=l._.parseLink.apply(l,[g]),j=[e.config.mindtouch.commonPath+'/popups/link_dialog.php','?href='+i.f_href,'&contextID='+e.config.mindtouch.pageId,'&cntxt='+e.config.mindtouch.pageTitle.utf8URL(),'&userName='+e.config.mindtouch.userName],k=CKEDITOR.plugins.get('mindtouchdialog');k.openDialog(a,{url:j.join(''),width:'600px',height:'285px',params:i,callback:l._.insertLink,scope:l});return true;},_:{parseLink:function(e){var f=this.editor,g=e&&(e.getAttribute('_cke_saved_href')||e.getAttribute('href'))||'',h={f_href:g,f_text:e?e.getText():'',contextTopic:f.config.mindtouch.pageTitle,contextTopicID:f.config.mindtouch.pageId,userName:f.config.mindtouch.userName};
  if(!e){var i=f.getSelection(),j=i&&i.getRanges()[0],k='';if(j&&!j.collapsed){i.lock();var l=j.cloneContents().getChildren();for(var m=0;m<l.count();m++)k+=l.getItem(m).getText();i.unlock(true);}h.f_href=d.isLinkInternal(k)?'./'+encodeURIComponent(k):encodeURI(k);h.f_text=k;h.newlink=true;}if(h.f_href.indexOf(d.internalPrefix)==0)h.f_href=h.f_href.substr(d.internalPrefix.length);this._.selectedElement=e;return h;},insertLink:function(e){var n=this;var f={href:'javascript:void(0)/*'+CKEDITOR.tools.getNextNumber()+'*/'},g=n.editor;f._cke_saved_href=d.normalizeUri(e.f_href);f.title=d.hrefDecode(f._cke_saved_href);g.fire('saveSnapshot');if(f.title.indexOf(d.internalPrefix)==0){f.title=f.title.substr(d.internalPrefix.length);if(n._.selectedElement)n._.selectedElement.removeClass('external');}if(!n._.selectedElement){var h=g.getSelection(),i=h.getRanges();if(i.length==1&&i[0].collapsed){var j=e.f_text.length>0?e.f_text:e.f_href,k=new CKEDITOR.dom.text(j,g.document);i[0].insertNode(k);i[0].selectNodeContents(k);h.selectRanges(i);}var l=new CKEDITOR.style({element:'a',attributes:f});l.type=2;l.apply(g.document);}else{var m=n._.selectedElement;m.setAttributes(f);delete n._.selectedElement;}g.fire('saveSnapshot');}}},c=CKEDITOR.tools.clone(b);c.exec=function(e){var g=this;g.editor=e;var f=g._.parseLink.apply(g,[null]);g._.insertLink.apply(g,[f]);};var d={requires:['mindtouchdialog','selection'],init:function(e){var f=this;e.addCommand(a,b);e.addCommand('quicklink',c);var g=e.keystrokeHandler.keystrokes;g[1000+75]=a;g[1000+87]='quicklink';e.ui.addButton('MindTouchLink',{label:e.lang.link.toolbar,command:a,icon:f.path+'images/a_link.png'});e.ui.addButton('Unlink',{label:e.lang.unlink,command:'unlink',icon:f.path+'images/a_unlink.png'});e.on('doubleclick',function(h){var i=CKEDITOR.plugins.link.getSelectedLink(e)||h.data.element;if(i.is('a')&&i.getAttribute('href'))if(e.execCommand(a))h.cancel();},this,null,1);if(e.addMenuItems)e.addMenuItems({link:{label:e.lang.link.menu,command:'mindtouchlink',icon:f.path+'images/a_link.png',group:'link',order:1},unlink:{label:e.lang.unlink,command:'unlink',icon:f.path+'images/a_unlink.png',group:'link',order:5}});},internalPrefix:'mks://localhost/',externalRegex:/^([a-z]+:)[\/]{2,5}/i,emailRegex:/^(mailto:)?[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,isLinkExternal:function(e){return e.match(this.externalRegex)!=null&&e.indexOf(this.internalPrefix)!=0;
  },isLinkInternal:function(e){return!(this.isLinkExternal(e)||this.isLinkNetwork(e)||this.isEmail(e));},isLinkNetwork:function(e){return e.indexOf('\\')==0||e.indexOf('//')==0;},isEmail:function(e){return this.emailRegex.test(e);},hrefDecode:function(e){if(typeof e.replace=='undefined')e=e.toString();e=e.replace(/&nbsp;/ig,' ');e=unescape(e);e=e.utf8ToString();if(e.indexOf(this.internalPrefix)==0)e=e.replace(/_/ig,' ');return e;},normalizeUri:function(e){var f=this;if(f.isEmail(e)){if(e.toLowerCase().indexOf('mailto:')!=0)e='mailto:'+e;return e;}if(f.isLinkNetwork(e))return 'file:///'+e.replace(/\\/g,'/');if(f.isLinkExternal(e))return e;if(e!=''&&e.indexOf(f.internalPrefix)!=0&&e.indexOf('/')!=0)e=f.internalPrefix+e;e=e.replace(/ /g,'_');return e;}};CKEDITOR.plugins.add(a,d);})();(function(){var a='mindtouchkeystrokes',b=function(l){var m=this;m.fire('saveSnapshot');var n=new CKEDITOR.style(m.config['format_'+l]);n.apply(m.document);m.fire('saveSnapshot');},c=function(l){var m=this,n=l==2000+9,o=l==1000+9,p=m.getSelection(),q=p&&p.getRanges()[0];if(!q)return false;var r=m.config.tabSpaces,s='';while(r--)s+='\xa0';var t=q.startContainer,u=false;while(t){if(t.type==1)if(t.is('td','th')){if(u){var v=q.checkStartOfBlock();if(v||!v&&o)break;}var w=n?t.getPrevious(d):t.getNext(d);if(w==null){var x=n?t.getParent().getPrevious(e):t.getParent().getNext(e);if(x)w=n?x.getLast(d):x.getFirst(d);}if(w==null){if(n)break;m.execCommand('rowInsertAfter');w=p.getStartElement().getAscendant('tr').getFirst(d);}if(w!=null){q.moveToElementEditStart(w);q.select();return true;}}else if(t.is('tr','tbody','table'))return true;else if(t.is('dt')||t.is('dd')&&n){var y=p.createBookmarks();t.renameNode(t.getName()=='dt'?'dd':'dt');p.selectBookmarks(y);return true;}else if(!n&&t.is('pre')&&s.length){m.insertHtml(s);return true;}else if(t.is('li'))u=true;t=t.getParent();}if(!n){var z=q.getCommonAncestor(true,true),A;if(z&&z.is('h1','h2','h3','h4','h5','h6')){A=z.getNextSourceNode(false,1);if(!A){A=new CKEDITOR.dom.element(m.config.enterMode==3?'div':'p',m.document);A.insertAfter(z);}q.moveToElementEditStart(A);q.select();return true;}if(s.length&&!q.checkStartOfBlock()){m.insertHtml(s);return true;}}m.execCommand(n?'outdent':'indent');return true;},d=function(l){return function(m){var n=m&&m.is('td','th');return l^n;};},e=function(l){return function(m){var n=m&&m.getName()=='tr';return l^n;};},f=function(){var l=this,m;if(l.getCommand('bulletedlist').state==1)m='numberedlist';else if(l.getCommand('numberedlist').state==1){var n=new CKEDITOR.dom.elementPath(l.getSelection().getStartElement());
  m='numberedlist';var o=0,p,q;for(var r=0;r<n.elements.length;r++){p=n.elements[r];if(p.is('ul','ol'))o++;if(o>1)m='bulletedlist';}}else m='bulletedlist';if(l.getCommand(m).state!=0){l.execCommand(m);return true;}return false;},g={exec:function(l){var r=this;r.editor=l;var m=l.getSelection(),n=m&&m.getRanges(),o=n&&n[0];if(!o||!o.collapsed)return false;var p=o.getCommonAncestor(true,true);if(p.is('pre'))return false;l.fire('saveSnapshot');var q=m&&m.createBookmarks(true);r.replace(p,'~~~~',r.getNodesToReplace(true));r.replace(p,'~~~',r.getNodesToReplace(false));if(CKEDITOR.env.gecko)p.setHtml(p.getHtml());m.selectBookmarks(q);l.fire('saveSnapshot');return false;},replace:function(l,m,n){var o=l;while(o=o.getNextSourceNode(false,3,l)){var p=new CKEDITOR.dom.elementPath(o),q=false,r;for(r=0;r<p.elements.length;r++)if(p.elements[r].hasClass('plain')){q=true;break;}if(q)continue;var s=o.getText().indexOf(m);if(s>-1){var t=new CKEDITOR.dom.range(this.editor.document);t.setStart(o,s);t.setEnd(o,s+m.length);o=this.replaceRange(t,n);}}},replaceRange:function(l,m){l.select();l.deleteContents();var n;for(var o in m){n=m[o];l.insertNode(n);l.moveToPosition(n,4);}return n;},getNodesToReplace:function(l){var r=this;var m=[],n=CKEDITOR.plugins.get('mindtouchlink'),o=n.internalPrefix+'User:'+r.editor.config.mindtouch.userName,p=r.editor.document.createElement('a');p.addClass('internal');p.setAttributes({title:'User:'+r.editor.config.mindtouch.userName,href:o,_cke_saved_href:o});p.setText(r.editor.config.mindtouch.userName);m.push(p);if(l){var q=r.editor.document.createText(' '+r.editor.config.mindtouch.today);m.push(q);}return m;},canUndo:false},h=function(){var l=this;if(CKEDITOR.env.webkit){var m=l.getSelection(),n=m&&m.getRanges(),o=n&&n[0];if(!o||!o.collapsed)return false;var p=new CKEDITOR.dom.elementPath(o.startContainer);if(p&&p.block&&p.block.is('pre')&&o.checkStartOfBlock()){var q;if(!((q=p.block.getPreviousSourceNode(true,1))&&(q.is&&q.is('pre'))))return false;l.fire('saveSnapshot');o.setStartAt(q,2);o.collapse(true);o.select();var r=m.createBookmarks(true);i(p.block,q);m.selectBookmarks(r);l.fire('saveSnapshot');return true;}}return false;};function i(l,m){var n=j(m.getHtml(),/(\n|<br\s*\/*>)$/i,'')+l.getHtml();l.setHtml(n);m.remove();};function j(l,m,n){var o='',p='';l=l.replace(/(^<span[^>]+_fck_bookmark.*?\/span>)|(<span[^>]+_fck_bookmark.*?\/span>$)/gi,function(q,r,s){r&&(o=r);s&&(p=s);return '';});return o+l.replace(m,n)+p;};var k=function(l){var m=this,n=m.getSelection(),o=n&&n.getRanges()[0];
  if(!o)return false;var p=function(s){var t=s.startContainer;while(t){if(t.is&&t.is('td','th'))break;t=t.getParent();}return t;},q=p(o);if(!q)return false;var r;if(o.startContainer.type==3)r=o.startOffset;window.setTimeout(function(){var s=m.getSelection(),t=s&&s.getRanges()[0];if(!t)return false;var u=p(t);if(!u||u.equals(q))return false;var v=q.getParent(),w;if(l==38)w=v&&v.getPrevious(e);else if(l==40)w=v&&v.getNext(e);else return false;if(!w){var x=v.getAscendant('table'),y=x&&x[l==40?'getNext':'getPrevious']();if(y){t.moveToElementEditStart(y);t.collapse(true);t.select();}return true;}var z=new CKEDITOR.dom.element(w.$.cells[q.$.cellIndex]);if(u.equals(z))return false;if(!isNaN(r)){var A=z[l==40?'getFirst':'getLast']();if(A&&A.type!==3){var B=A.getChildren();for(var C=0;C<B.count();C++){var D=B.getItem(C);if(D.type===3){A=D;break;}}}if(A&&A.type===3&&A.getLength()>=r){t.setStart(A,r);t.collapse(true);t.select();return true;}}t.moveToElementEditStart(z);t.select();return true;},0);};CKEDITOR.plugins.add(a,{requires:['keystrokes','mindtouchlink'],init:function(l){l.addCommand('autoreplace',g);l.on('key',function(m){var n=m.editor,o=m.data.keyCode;switch(o){case 9:case 2000+9:case 1000+9:if(c.call(n,o))m.cancel();break;case 38:case 40:CKEDITOR.env.webkit&&k.call(n,o);break;case 1000+2000+76:f.call(n);m.cancel();break;case 13:n.execCommand('autoreplace');break;case 8:if(h.call(n))m.cancel();break;case 1000+49:case 1000+50:case 1000+51:case 1000+52:case 1000+53:var p='h'+(o-1000-47);b.call(n,p);m.cancel();break;case 1000+48:case 1000+78:var p=n.config.enterMode==3?'div':'p';b.call(n,p);m.cancel();break;}},null,null,1);}});})();(function(){function a(e){var f=e.getCommand('maximize');if(f&&f.state==1)e.execCommand('maximize');};var b={modes:{wysiwyg:1,source:1},editorFocus:false,exec:function(e){var f=this;f.editor=e;a(e);if(Deki.Editor&&Deki.Editor.CheckPermissions)Deki.Editor.CheckPermissions(f.save,f);else f.save();},save:function(){var e=this.editor,f=e.element.$.form;if(f&&!e.config.mindtouch.isReadOnly){e.fire('save');try{f.submit();}catch(g){if(f.submit.click)f.submit.click();}}},canUndo:false},c={modes:{wysiwyg:1,source:1},editorFocus:false,exec:function(e){a(e);e.fire('cancel');},canUndo:false},d='mindtouchsave';CKEDITOR.plugins.add(d,{lang:['en','cs','de','en-au','es','et','fr-ca','fr','he','hu','it','ja','ko','nl','pt-br','ru','sv'],init:function(e){e.addCommand(d,b);e.addCommand('mindtouchcancel',c);var f=e.keystrokeHandler.keystrokes;f[1000+2000+83]=d;
  e.ui.addButton('MindTouchSave',{label:e.lang.save,command:d});e.ui.addButton('MindTouchCancel',{label:e.lang.cancel,command:'mindtouchcancel',icon:e.config.mindtouch.commonPath+'/icons/icons.gif',iconOffset:100});}});})();(function(){CKEDITOR.plugins.add('styletools',{init:function(a){CKEDITOR.tools.extend(CKEDITOR.style,{getNormalizedValue:function(b,c,d){var e='';d=d||c;switch(c){case 'background-image':e=b.getStyle(c).replace(/url\('?([^']*)'?\)/gi,'$1');break;case 'background-color':case 'border-color':if(b.getStyle(c).length>0)e=CKEDITOR.style.convertRGBToHex(b.getStyle(c));else if(c=='background-color'&&b.hasAttribute('bgColor'))e=b.getAttribute('bgColor');else if(c=='border-color'&&b.hasAttribute('borderColor'))e=b.getAttribute('borderColor');break;case 'border-style':e=b.getStyle('border-style');if(e&&e.match(/([^\s]*)\s/))e=RegExp.$1;break;case 'border-width':e=CKEDITOR.style.getNum(b.getStyle('border-width'));break;case 'white-space':if(b.getStyle('white-space').length)e=b.getStyle('white-space');else if(b.hasAttribute('noWrap'))e='nowrap';break;default:e=CKEDITOR.style.getValue(b,c,d);}return e;},getValue:function(b,c,d){var e='',f=b.style;d=d||c;if(b.hasAttribute(d))e=b.getAttribute(d);else e=b.getStyle(c);return e;},convertRGBToHex:function(b){var c=/rgb\s*\(\s*([0-9]+).*,\s*([0-9]+).*,\s*([0-9]+).*\)/gi,d=b.replace(c,'$1,$2,$3').split(','),e,f,g;if(d.length==3){e=parseInt(d[0]).toString(16);f=parseInt(d[1]).toString(16);g=parseInt(d[2]).toString(16);e=e.length==1?'0'+e:e;f=f.length==1?'0'+f:f;g=g.length==1?'0'+g:g;b='#'+e+f+g;}return b;},convertHexToRGB:function(b){if(b.indexOf('#')==0){b=b.replace(/[^0-9A-F]/gi,'');r=parseInt(b.substring(0,2),16);g=parseInt(b.substring(2,4),16);b=parseInt(b.substring(4,6),16);b='rgb('+r+','+g+','+b+')';}else b='';return b;},getUnit:function(b){var c=b.replace(/[0-9]+(px|%|in|cm|mm|em|ex|pt|pc)?/,'$1');if(!c.length)c='px';return c;},getNum:function(b){b=parseInt(b);if(isNaN(b))b='';return b;}});}});})();(function(){var a='mindtouchtemplates',b={canUndo:false,exec:function(c){this.editor=c;var d={contextTopicID:c.config.mindtouch.pageId},e=CKEDITOR.plugins.get('mindtouchdialog');e.openDialog(a,{url:c.config.mindtouch.commonPath+'/popups/select_template.php',width:'400px',height:'110px',params:d,callback:this._.insertTemplate,scope:this});},_:{insertTemplate:function(c){var d=this.editor;if(c.f_template)d.insertHtml(c.f_template);}}};CKEDITOR.plugins.add(a,{requires:['mindtouchdialog'],lang:['en','cs','de','en-au','es','et','fr-ca','fr','he','hu','it','ja','ko','nl','pt-br','ru','sv'],init:function(c){c.addCommand(a,b);
  c.ui.addButton('MindTouchTemplates',{label:c.lang.mindtouchtemplates.button,command:a,icon:this.path+'images/template.png'});}});})();CKEDITOR.plugins.add('tableadvanced',{requires:['styles'],lang:['en','cs','de','en-au','es','et','fr-ca','fr','he','hu','it','ja','ko','nl','pt-br','ru','sv'],init:function(a){CKEDITOR.dialog.add('table',this.path+'dialogs/table.js',true);CKEDITOR.dialog.add('tableProperties',this.path+'dialogs/table.js',true);CKEDITOR.dialog.add('cellProperties',this.path+'dialogs/tableCell.js',true);a.addCommand('rowProperties',new CKEDITOR.dialogCommand('rowProperties'));CKEDITOR.dialog.add('rowProperties',this.path+'dialogs/tableRow.js');CKEDITOR.tools.extend(a.lang.table,a.lang.tableadvanced);CKEDITOR.tools.extend(a.lang.table.cell,a.lang.tableadvanced.cell);CKEDITOR.tools.extend(a.lang.table.row,a.lang.tableadvanced.row);var b=a.lang.table;if(a.addMenuItems){a.addMenuGroup('tablerowproperties');a.addMenuItems({tablerow:{label:b.row.menu,group:'tablerow',order:1,getItems:function(){return{tablerow_insertBefore:2,tablerow_insertAfter:2,tablerow_delete:2,tablerow_properties:2};}},tablerow_properties:{label:b.row.title,group:'tablerowproperties',command:'rowProperties',order:20}});}}});(function(){CKEDITOR.plugins.add('transformations',{requires:['combobutton','styles'],lang:['en','cs','de','en-au','es','et','fr-ca','fr','he','hu','it','ja','ko','nl','pt-br','ru','sv'],init:function(a){var b=a.config,c={},d=this;a.ui.addComboButton('Transformations',{label:a.lang.transformations.label,title:a.lang.transformations.panelTitle,className:'cke_transformations',icon:d.path+'images/page_white_transformations.png',panel:{css:a.skin.editor.css.concat(b.contentsCss),multiSelect:false,attributes:{'aria-label':a.lang.panelTitle}},init:function(){var e=this;Deki.$.getJSON('/deki/gui/editor.php?method=transform',function(f){var g=f.body;e.startGroup(a.lang.transformations.panelTitle);for(var h=0;h<g.length;h++){var i=g[h],j=i.name||i.func,k=i.func.length?i.func:i.title,l={name:j,element:i.tags,attributes:{'class':'deki-transform','function':i.func}};c[j]=new CKEDITOR.style(l);e.add(j,'<span>'+k+'</span>',k);}e.commit();e.onOpen();});},onClick:function(e){a.focus();a.fire('saveSnapshot');var f=c[e],g=a.getSelection();if(!g)return;if(f.type==3){var h=g.getSelectedElement();if(h)f.applyToObject(h);return;}var i=new CKEDITOR.dom.elementPath(g.getStartElement());if(f.checkActive(i)){switch(f.type){case 2:f.remove(a.document);break;case 1:var h=i.block||i.blockLimit;
  h.removeClass('deki-transform');h.removeAttribute('function');break;}}else f.apply(a.document);a.fire('saveSnapshot');},onRender:function(){var e=this;a.on('selectionChange',function(f){var g=this.getValue(),h=f.data.path,i=h.elements;for(var j=0,k;j<i.length;j++){k=i[j];for(var l in c)if(c[l].checkElementRemovable(k,true)){if(l!=g)this.setValue(l);e.setState(1);return;}}this.setValue('');e.setState(2);},this);},onOpen:function(){var m=this;if(CKEDITOR.env.ie)a.focus();var e=a.getSelection();if(!e)return;var f=e.getSelectedElement(),g=f&&f.getName(),h=new CKEDITOR.dom.elementPath(f||e.getStartElement()),i=[0,0,0,0];m.showAll();m.unmarkAll();for(var j in c){var k=c[j],l=k.type;if(l==3){if(f&&k.element==g){if(k.checkElementRemovable(f,true))m.mark(j);i[l]++;}else m.hideItem(j);}else{if(k.checkActive(h))m.mark(j);i[l]++;}}}});}});})();(function(){function a(g){var h=g.getSelection(),i=h&&h.getStartElement(),j=i&&new CKEDITOR.dom.elementPath(i);if(!j||!j.block||!j.block.is('pre')){e.hide();return;}var k=h.getRanges()[0],l=k&&k.startContainer,m={lines:1,chars:0},n=function(q){var r;if(q.type==3){r=q.getText();if(!CKEDITOR.env.gecko){var s,t;if(CKEDITOR.env.ie){s='\r';t=/(^\r)|(\r$)/;}if(CKEDITOR.env.webkit){s='\n';t=/(^\n)|(\n$)/;}if(CKEDITOR.env.opera){s='\r\n';t=/(^\r\n)|(\r\n$)/;}var u=r.split(s);switch(u.length){case 1:if(m.lines<2)m.chars+=r.length;break;case 2:if(t.test(r)){if(m.lines<2)m.chars+=u[u.length-1].length;m.lines++;break;}default:if(m.lines<2)m.chars+=u[u.length-1].length;m.lines+=u.length-1;break;}return;}if(m.lines<2)m.chars+=r.length;}else if(q.type==1)if(q.is('br'))m.lines++;else if(m.lines<2)m.chars+=q.getText().length;};if(l&&l.is&&l.is('pre')&&k.collapsed){var o=g.document.createElement('span');o.setHtml('&#65279;');k.insertNode(o);l=o.getPreviousSourceNode(true,null,k.startContainer);l&&n(l);o.remove();}else if(l&&l.type==3){text=l.getText().substring(0,k.startOffset);var p=new CKEDITOR.dom.text(text);n(p);}else if(l)n(l);if(l)while(l=l.getPreviousSourceNode(true,null,j.block))n(l);c(g,m.lines,m.chars);e.show();};function b(g){var h=g.editor||g.listenerData;CKEDITOR.tools.setTimeout(a,0,this,h);};function c(g,h,i){e.updateLabel('line',g.lang.dsbar.line+':&nbsp;'+h+',&nbsp;');e.updateLabel('col',g.lang.dsbar.col+':&nbsp;'+i);};var d={canUndo:false,startDisabled:true,exec:function(g,h){var i=this.uiItems[0];i.setLabel(h);}},e,f=function(g){this._={id:g,bar:CKEDITOR.document.getById(g),labels:[]};this._.bar.setStyles({display:'none'});};f.prototype={getBar:function(){return this._.bar;
  },addLabel:function(g){var h=new CKEDITOR.dom.element('span',CKEDITOR.document);this._.bar.append(h);this._.labels[g]=h;},updateLabel:function(g,h){this._.labels[g].setHtml(h);},show:function(){this._.bar.setStyle('display','block');},hide:function(){this._.bar.setStyle('display','none');}};CKEDITOR.plugins.add('dsbar',{requires:['selection'],lang:['en','cs','de','en-au','es','et','fr-ca','fr','he','hu','it','ja','ko','nl','pt-br','ru','sv'],init:function(g){g.on('contentDom',function(){g.document.on('mouseup',b,this,g);g.document.on('keyup',b,this,g);});g.on('mode',b);g.on('selectionChange',b);var h='cke_'+CKEDITOR.tools.getNextNumber();g.on('themeSpace',function(i){if(i.data.space=='top'){var j='<span class="dsbar" role="presentation" id="'+h+'"></span>';i.data.html+=j;}});g.on('themeLoaded',function(){e=new f(h);e.addLabel('line');e.addLabel('col');});},afterInit:function(g){var h=g.dataProcessor,i=h&&h.dataFilter;if(CKEDITOR.env.gecko&&i)i.addRules({elements:{pre:function(j){var k=new CKEDITOR.dom.element('br',g.document),l=function(m){if(!m.children)return;for(var n=0;n<m.children.length;n++){var o=m.children[n];if(o.type==3)o.value=o.value.replace(/\n/g,k.getOuterHtml());else l(o);}};l(j);}}});}});})();(function(){var a='video',b={canUndo:false,exec:function(c){this.editor=c;var d=CKEDITOR.plugins.get('mindtouchdialog');d.openDialog(a,{url:c.config.mindtouch.commonPath+'/popups/popup-video.php',width:'400px',height:'118px',params:null,callback:this._.insertVideo,scope:this});},_:{insertVideo:function(c){var d=this.editor;if(c.f_content)d.insertHtml('{{media("'+c.f_content+'")}}');}}};CKEDITOR.plugins.add(a,{requires:['mindtouchdialog'],lang:['en','cs','de','en-au','es','et','fr-ca','fr','he','hu','it','ja','ko','nl','pt-br','ru','sv'],init:function(c){c.addCommand(a,b);c.ui.addButton('Video',{label:c.lang.video.toolbar,command:a,icon:c.config.mindtouch.commonPath+'/icons/film.png'});}});})();CKEDITOR.themes.add('mindtouch',(function(){function a(b,c){var d,e;e=b.config.sharedSpaces;e=e&&e[c];e=e&&CKEDITOR.document.getById(e);if(e){var f='<span class="cke_shared"><span class="'+b.skinClass+' cke_editor_'+b.name+'">'+'<span class="'+CKEDITOR.env.cssClass+'">'+'<span class="cke_wrapper cke_'+b.lang.dir+'">'+'<span class="cke_editor">'+'<div class="cke_'+c+'">'+'</div></span></span></span></span></span>',g=e.append(CKEDITOR.dom.element.createFromHtml(f,e.getDocument()));if(e.getCustomData('cke_hasshared'))g.hide();else e.setCustomData('cke_hasshared',1);d=g.getChild([0,0,0,0]);
  b.on('focus',function(){for(var h=0,i,j=e.getChildren();i=j.getItem(h);h++)if(i.type==1&&!i.equals(g)&&i.hasClass('cke_shared'))i.hide();g.show();});b.on('destroy',function(){g.remove();});}return d;};return{build:function(b,c){var d=b.name,e=b.element,f=b.elementMode;if(!e||f==0)return;if(f==1)e.hide();var g=b.fire('themeSpace',{space:'top',html:''}).html,h=b.fire('themeSpace',{space:'contents',html:''}).html,i=b.fireOnce('themeSpace',{space:'bottom',html:''}).html,j=h&&b.config.height,k=b.config.tabIndex||b.element.getAttribute('tabindex')||0;if(!h)j='auto';else if(!isNaN(j))j+='px';var l='',m=b.config.width;if(m){if(!isNaN(m))m+='px';l+='width: '+m+';';}var n=g&&a(b,'top'),o=a(b,'bottom');n&&(n.setHtml(g),g='');o&&(o.setHtml(i),i='');var p=CKEDITOR.dom.element.createFromHtml(['<span id="cke_',d,'" onmousedown="return false;" class="',b.skinClass,' cke_editor_',d,'" dir="',b.lang.dir,'" title="',CKEDITOR.env.gecko?' ':'','" lang="',b.langCode,'"'+(CKEDITOR.env.webkit?' tabindex="'+k+'"':'')+' role="application"'+' aria-labelledby="cke_',d,'_arialbl"'+(l?' style="'+l+'"':'')+'>'+'<span id="cke_',d,'_arialbl" class="cke_voice_label">'+b.lang.editor+'</span>'+'<span class="',CKEDITOR.env.cssClass,'" role="presentation"><span class="cke_editor" role="presentation" style="display:block"><span class="cke_',b.lang.dir,'" role="presentation"><span',g?'':' style="display:none"',' id="cke_top_',d,'" class="cke_top" role="presentation">',g,'</span>','</span></span><span class="cke_wrapper cke_',b.lang.dir,'" role="presentation"><table class="cke_editor" border="0" cellspacing="0" cellpadding="0" role="presentation"><tbody><tr',h?'':' style="display:none"',' role="presentation"><td id="cke_contents_',d,'" class="cke_contents" style="height:',j,'" role="presentation">',h,'</td></tr><tr',i?'':' style="display:none"',' role="presentation"><td id="cke_bottom_',d,'" class="cke_bottom" role="presentation">',i,'</td></tr></tbody></table><style>.',b.skinClass,'{visibility:hidden;}</style></span></span></span>'].join(''));p.getChild([1,0]).unselectable();p.getChild([1,1,0,0,1]).unselectable();if(f==1)p.insertAfter(e);else e.append(p);b.container=p;p.disableContextMenu();b.fireOnce('themeLoaded');b.fireOnce('uiReady');},buildDialog:function(b){var c=CKEDITOR.tools.getNextNumber(),d=CKEDITOR.dom.element.createFromHtml(['<div class="cke_editor_'+b.name.replace('.','\\.')+'_dialog cke_skin_',b.skinName,'" dir="',b.lang.dir,'" lang="',b.langCode,'" role="dialog" aria-labelledby="%title#"><table class="cke_dialog',' '+CKEDITOR.env.cssClass,' cke_',b.lang.dir,'" style="position:absolute" role="presentation"><tr><td role="presentation"><div class="%body" role="presentation"><div id="%title#" class="%title" role="presentation"></div><a id="%close_button#" class="%close_button" href="javascript:void(0)" title="'+b.lang.common.close+'" role="button"><span class="cke_label">X</span></a>'+'<div id="%tabs#" class="%tabs" role="tablist"></div>'+'<table class="%contents" role="presentation"><tr>'+'<td id="%contents#" class="%contents" role="presentation"></td>'+'</tr></table>'+'<div id="%footer#" class="%footer" role="presentation"></div>'+'</div>'+'<div id="%tl#" class="%tl"></div>'+'<div id="%tc#" class="%tc"></div>'+'<div id="%tr#" class="%tr"></div>'+'<div id="%ml#" class="%ml"></div>'+'<div id="%mr#" class="%mr"></div>'+'<div id="%bl#" class="%bl"></div>'+'<div id="%bc#" class="%bc"></div>'+'<div id="%br#" class="%br"></div>'+'</td></tr>'+'</table>',CKEDITOR.env.ie?'':'<style>.cke_dialog{visibility:hidden;}</style>','</div>'].join('').replace(/#/g,'_'+c).replace(/%/g,'cke_dialog_')),e=d.getChild([0,0,0,0,0]),f=e.getChild(0),g=e.getChild(1);
  f.unselectable();g.unselectable();return{element:d,parts:{dialog:d.getChild(0),title:f,close:g,tabs:e.getChild(2),contents:e.getChild([3,0,0,0]),footer:e.getChild(4)}};},destroy:function(b){var c=b.container;c.clearCustomData();b.element.clearCustomData();if(CKEDITOR.env.ie){c.setStyle('display','none');var d=document.body.createTextRange();d.moveToElementText(c.$);try{d.select();}catch(e){}}if(c)c.remove();if(b.elementMode==1)b.element.show();delete b.element;}};})());CKEDITOR.editor.prototype.lock=function(){if(this._.mask)return;var a=this.container,b=new CKEDITOR.dom.element('div',CKEDITOR.document);b.setStyles({position:'absolute',left:0,top:0,'z-index':99,opacity:0.5,'-ms-filter':'alpha(opacity=50)',filter:'alpha(opacity=50)','background-color':'#fff',cursor:'progress'});b.setStyle('width',a.$.offsetWidth+'px');b.setStyle('height',a.$.offsetHeight+'px');a.setStyle('position','relative');a.append(b);this._.mask=b;};CKEDITOR.editor.prototype.unlock=function(){var a=this;if(a._.mask){a._.mask.remove();a._.mask=null;a.focus();}};CKEDITOR.editor.prototype.getThemeSpace=function(a){var b='cke_'+a,c=this._[b]||(this._[b]=CKEDITOR.document.getById(b+'_'+this.name));return c;};CKEDITOR.editor.prototype.resize=function(a,b,c,d){var e=/^\d+$/;if(e.test(a))a+='px';var f=this.container,g=CKEDITOR.document.getById('cke_contents_'+this.name),h=d?f.getChild(1):f;if(a!==null){CKEDITOR.env.webkit&&h.setStyle('display','none');h.setStyle('width',a);if(CKEDITOR.env.webkit){h.$.offsetWidth;h.setStyle('display','');}}if(b){var i=c?0:(h.$.offsetHeight||0)-(g.$.clientHeight||0);g.setStyle('height',Math.max(b-i,0)+'px');}this.fire('resize');};CKEDITOR.editor.prototype.getResizable=function(){return this.container.getChild(1);};})();
  