CKEDITOR.plugins.add('colorbutton',{requires:['panelbutton','floatpanel','styles'],init:function(a){var b=a.config,c=a.lang.colorButton,d;if(!CKEDITOR.env.hc){e('TextColor','fore',c.textColorTitle);e('BGColor','back',c.bgColorTitle);}function e(g,h,i){a.ui.add(g,CKEDITOR.UI_PANELBUTTON,{label:i,title:i,className:'cke_button_'+g.toLowerCase(),modes:{wysiwyg:1},panel:{css:a.skin.editor.css,attributes:{role:'listbox','aria-label':c.panelTitle}},onBlock:function(j,k){k.autoSize=true;k.element.addClass('cke_colorblock');k.element.setHtml(f(j,h));var l=k.keys;l[39]='next';l[40]='next';l[9]='next';l[37]='prev';l[38]='prev';l[CKEDITOR.SHIFT+9]='prev';l[32]='click';}});};function f(g,h){var i=[],j=b.colorButton_colors.split(','),k=j.length+(b.colorButton_enableMore?2:1),l=CKEDITOR.tools.addFunction(function(r,s){if(r=='?'){var t=arguments.callee;function u(w){this.removeListener('ok',u);this.removeListener('cancel',u);w.name=='ok'&&t(this.getContentElement('picker','selectedColor').getValue(),s);};a.openDialog('colordialog',function(){this.on('ok',u);this.on('cancel',u);});return;}a.focus();g.hide();a.fire('saveSnapshot');new CKEDITOR.style(b['colorButton_'+s+'Style'],{color:'inherit'}).remove(a.document);if(r){var v=b['colorButton_'+s+'Style'];v.childRule=s=='back'?function(){return false;}:function(w){return w.getName()!='a';};new CKEDITOR.style(v,{color:r}).apply(a.document);}a.fire('saveSnapshot');});i.push('<a class="cke_colorauto" _cke_focus=1 hidefocus=true title="',c.auto,'" onclick="CKEDITOR.tools.callFunction(',l,",null,'",h,"');return false;\" href=\"javascript:void('",c.auto,'\')" role="option" aria-posinset="1" aria-setsize="',k,'"><table role="presentation" cellspacing=0 cellpadding=0 width="100%"><tr><td><span class="cke_colorbox" style="background-color:#000"></span></td><td colspan=7 align=center>',c.auto,'</td></tr></table></a><table role="presentation" cellspacing=0 cellpadding=0 width="100%">');for(var m=0;m<j.length;m++){if(m%8===0)i.push('</tr><tr>');var n=j[m].split('/'),o=n[0],p=n[1]||o;if(!n[1])o='#'+o.replace(/^(.)(.)(.)$/,'$1$1$2$2$3$3');var q=a.lang.colors[p]||p;i.push('<td><a class="cke_colorbox" _cke_focus=1 hidefocus=true title="',q,'" onclick="CKEDITOR.tools.callFunction(',l,",'",o,"','",h,"'); return false;\" href=\"javascript:void('",q,'\')" role="option" aria-posinset="',m+2,'" aria-setsize="',k,'"><span class="cke_colorbox" style="background-color:#',p,'"></span></a></td>');}if(b.colorButton_enableMore)i.push('</tr><tr><td colspan=8 align=center><a class="cke_colormore" _cke_focus=1 hidefocus=true title="',c.more,'" onclick="CKEDITOR.tools.callFunction(',l,",'?','",h,"');return false;\" href=\"javascript:void('",c.more,"')\"",' role="option" aria-posinset="',k,'" aria-setsize="',k,'">',c.more,'</a></td>');
i.push('</tr></table>');return i.join('');};}});CKEDITOR.config.colorButton_enableMore=true;CKEDITOR.config.colorButton_colors='000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF';CKEDITOR.config.colorButton_foreStyle={element:'span',styles:{color:'#(color)'},overrides:[{element:'font',attributes:{color:null}}]};CKEDITOR.config.colorButton_backStyle={element:'span',styles:{'background-color':'#(color)'}};
