CKEDITOR.dialog.add("specialchar",function(r){var q,p=r.lang.specialChar,o=function(d){var c,b;if(d.data){c=d.data.getTarget()}else{c=new CKEDITOR.dom.element(d)}if(c.getName()=="a"&&(b=c.getChild(0).getHtml())){c.removeClass("cke_light_background");q.hide();var a=r.document.createElement("span");a.setHtml(b);r.insertText(a.getText())}},n=CKEDITOR.tools.addFunction(o),m,l=function(d,c){var b;c=c||d.data.getTarget();if(c.getName()=="span"){c=c.getParent()}if(c.getName()=="a"&&(b=c.getChild(0).getHtml())){if(m){k(null,m)}var a=q.getContentElement("info","htmlPreview").getElement();q.getContentElement("info","charPreview").getElement().setHtml(b);a.setHtml(CKEDITOR.tools.htmlEncode(b));c.getParent().addClass("cke_light_background");m=c}},k=function(b,a){a=a||b.data.getTarget();if(a.getName()=="span"){a=a.getParent()}if(a.getName()=="a"){q.getContentElement("info","charPreview").getElement().setHtml("&nbsp;");q.getContentElement("info","htmlPreview").getElement().setHtml("&nbsp;");a.getParent().removeClass("cke_light_background");m=undefined}},j=CKEDITOR.tools.addFunction(function(d){d=new CKEDITOR.dom.event(d);var c=d.getTarget(),b,a,f=d.getKeystroke(),e=r.lang.dir=="rtl";switch(f){case 38:if(b=c.getParent().getParent().getPrevious()){a=b.getChild([c.getParent().getIndex(),0]);a.focus();k(null,c);l(null,a)}d.preventDefault();break;case 40:if(b=c.getParent().getParent().getNext()){a=b.getChild([c.getParent().getIndex(),0]);if(a&&a.type==1){a.focus();k(null,c);l(null,a)}}d.preventDefault();break;case 32:o({data:d});d.preventDefault();break;case e?37:39:if(b=c.getParent().getNext()){a=b.getChild(0);if(a.type==1){a.focus();k(null,c);l(null,a);d.preventDefault(true)}else{k(null,c)}}else{if(b=c.getParent().getParent().getNext()){a=b.getChild([0,0]);if(a&&a.type==1){a.focus();k(null,c);l(null,a);d.preventDefault(true)}else{k(null,c)}}}break;case e?39:37:if(b=c.getParent().getPrevious()){a=b.getChild(0);a.focus();k(null,c);l(null,a);d.preventDefault(true)}else{if(b=c.getParent().getParent().getPrevious()){a=b.getLast().getChild(0);a.focus();k(null,c);l(null,a);d.preventDefault(true)}else{k(null,c)}}break;default:return}});return{title:p.title,minWidth:430,minHeight:280,buttons:[CKEDITOR.dialog.cancelButton],charColumns:17,onLoad:function(){var i=this.definition.charColumns,h=r.config.extraSpecialChars,g=r.config.specialChars,f=CKEDITOR.tools.getNextId()+"_specialchar_table_label",e=['<table role="listbox" aria-labelledby="'+f+'" style="width: 320px; height: 100%; border-collapse: separate;" align="center" cellspacing="2" cellpadding="2" border="0">'],d=0,c=g.length,b,a;while(d<c){e.push('<tr role="presentation">');for(var x=0;x<i;x++,d++){if(b=g[d]){a="";if(b instanceof Array){a=b[1];b=b[0]}else{var w=b.replace("&","").replace(";","").replace("#","");a=p[w]||b}var v="cke_specialchar_label_"+d+"_"+CKEDITOR.tools.getNextNumber();e.push('<td class="cke_dark_background" style="cursor: default" role="presentation"><a href="javascript: void(0);" role="option" aria-posinset="'+(d+1)+'"',' aria-setsize="'+c+'"',' aria-labelledby="'+v+'"',' style="cursor: inherit; display: block; height: 1.25em; margin-top: 0.25em; text-align: center;" title="',CKEDITOR.tools.htmlEncode(a),'" onkeydown="CKEDITOR.tools.callFunction( '+j+', event, this )" onclick="CKEDITOR.tools.callFunction('+n+', this); return false;" tabindex="-1"><span style="margin: 0 auto;cursor: inherit">'+b+'</span><span class="cke_voice_label" id="'+v+'">'+a+"</span></a>")}else{e.push('<td class="cke_dark_background">&nbsp;')}e.push("</td>")}e.push("</tr>")}e.push("</tbody></table>",'<span id="'+f+'" class="cke_voice_label">'+p.options+"</span>");this.getContentElement("info","charContainer").getElement().setHtml(e.join(""))},contents:[{id:"info",label:r.lang.common.generalTab,title:r.lang.common.generalTab,padding:0,align:"top",elements:[{type:"hbox",align:"top",widths:["320px","90px"],children:[{type:"html",id:"charContainer",html:"",onMouseover:l,onMouseout:k,focus:function(){var a=this.getElement().getElementsByTag("a").getItem(0);setTimeout(function(){a.focus();l(null,a)},0)},onShow:function(){var a=this.getElement().getChild([0,0,0,0,0]);setTimeout(function(){a.focus();l(null,a)},0)},onLoad:function(a){q=a.sender}},{type:"hbox",align:"top",widths:["100%"],children:[{type:"vbox",align:"top",children:[{type:"html",html:"<div></div>"},{type:"html",id:"charPreview",className:"cke_dark_background",style:"border:1px solid #eeeeee;font-size:28px;height:40px;width:70px;padding-top:9px;font-family:'Microsoft Sans Serif',Arial,Helvetica,Verdana;text-align:center;",html:"<div>&nbsp;</div>"},{type:"html",id:"htmlPreview",className:"cke_dark_background",style:"border:1px solid #eeeeee;font-size:14px;height:20px;width:70px;padding-top:2px;font-family:'Microsoft Sans Serif',Arial,Helvetica,Verdana;text-align:center;",html:"<div>&nbsp;</div>"}]}]}]}]}]}});