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