NEW_CKEDITOR.dialog.add("smiley",(function(e){var t,i=e.config,a=e.lang.smiley,l=i.smiley_images,s=i.smiley_columns||8,n=function(i){if("a"==(a=(s=i.data.getTarget()).getName()))s=s.getChild(0);else if("img"!=a)return;var a=s.getAttribute("edi_src"),l=s.getAttribute("title"),s=e.document.createElement("img",{attributes:{src:a,"data-edi-saved-src":a,title:l,alt:l,width:s.$.width,height:s.$.height}});e.insertElement(s),t.hide(),i.data.preventDefault()},r=NEW_CKEDITOR.tools.addFunction((function(t,i){var a;t=new NEW_CKEDITOR.dom.event(t),i=new NEW_CKEDITOR.dom.element(i),a=t.getKeystroke();var l="rtl"==e.lang.dir;switch(a){case 38:(a=i.getParent().getParent().getPrevious())&&(a=a.getChild([i.getParent().getIndex(),0])).focus(),t.preventDefault();break;case 40:(a=i.getParent().getParent().getNext())&&(a=a.getChild([i.getParent().getIndex(),0]))&&a.focus(),t.preventDefault();break;case 32:n({data:t}),t.preventDefault();break;case l?37:39:(a=i.getParent().getNext())?((a=a.getChild(0)).focus(),t.preventDefault(!0)):(a=i.getParent().getParent().getNext())&&((a=a.getChild([0,0]))&&a.focus(),t.preventDefault(!0));break;case l?39:37:(a=i.getParent().getPrevious())?((a=a.getChild(0)).focus(),t.preventDefault(!0)):(a=i.getParent().getParent().getPrevious())&&((a=a.getLast().getChild(0)).focus(),t.preventDefault(!0))}})),o=['<div><span id="'+(o=NEW_CKEDITOR.tools.getNextId()+"_smiley_emtions_label")+'" class="edi_voice_label">'+a.options+"</span>",'<table role="listbox" aria-labelledby="'+o+'" style="width:100%;height:100%;border-collapse:separate;" cellspacing="2" cellpadding="2"',NEW_CKEDITOR.env.ie&&NEW_CKEDITOR.env.quirks?' style="position:absolute;"':"","><tbody>"],d=l.length;for(a=0;a<d;a++){0==a%s&&o.push('<tr role="presentation">');var g="edi_smile_label_"+a+"_"+NEW_CKEDITOR.tools.getNextNumber();o.push('<td class="edi_dark_background edi_centered" style="vertical-align: middle;" role="presentation"><a href="javascript:void(0)" role="option"',' aria-posinset="'+(a+1)+'"',' aria-setsize="'+d+'"',' aria-labelledby="'+g+'"',' class="edi_smile edi_hand" tabindex="-1" onkeydown="NEW_CKEDITOR.tools.callFunction( ',r,', event, this );">','<img class="edi_hand" title="',i.smiley_descriptions[a],'" edi_src="',NEW_CKEDITOR.tools.htmlEncode(i.smiley_path+l[a]),'" alt="',i.smiley_descriptions[a],'"',' src="',NEW_CKEDITOR.tools.htmlEncode(i.smiley_path+l[a]),'"',NEW_CKEDITOR.env.ie?" onload=\"this.setAttribute('width', 2); this.removeAttribute('width');\" ":"",'><span id="'+g+'" class="edi_voice_label">'+i.smiley_descriptions[a]+"</span></a>","</td>"),a%s==s-1&&o.push("</tr>")}if(a<s-1){for(;a<s-1;a++)o.push("<td></td>");o.push("</tr>")}return o.push("</tbody></table></div>"),i={type:"html",id:"smileySelector",html:o.join(""),onLoad:function(e){t=e.sender},focus:function(){var e=this;setTimeout((function(){e.getElement().getElementsByTag("a").getItem(0).focus()}),0)},onClick:n,style:"width: 100%; border-collapse: separate;"},{title:e.lang.smiley.title,minWidth:270,minHeight:120,contents:[{id:"tab1",label:"",title:"",expand:!0,padding:0,elements:[i]}],buttons:[NEW_CKEDITOR.dialog.cancelButton]}}));