var MoodleEmoticonDialog={init:function(){tinymce.each(tinymce.DOM.select('tr.emoticoninfo',document),function(c){tinymce.dom.Event.add(c,'mouseover',function(e){this.style.backgroundColor='white'},c);tinymce.dom.Event.add(c,'mouseout',function(e){this.style.backgroundColor='transparent'},c);tinymce.dom.Event.add(c,'click',function(e){var a=/^emoticoninfo emoticoninfo-index-([0-9]+)$/.exec(this.className);if(a.length!=2){return true}var b=a[1];MoodleEmoticonDialog.insert(b)},c)})},insert:function(a){emoticons=tinyMCEPopup.editor._emoticons;i=0;for(var b in emoticons){if(i==a){if(tinymce.isIE){tinyMCEPopup.restoreSelection()}tinyMCEPopup.editor.execCommand('mceInsertContent',false,emoticons[b]);tinyMCEPopup.close();return}i++}},highlight:function(a){a.style.backgroundColor="white"},unhighlight:function(a){a.style.backgroundColor="transparent"}};tinyMCEPopup.onInit.add(MoodleEmoticonDialog.init,MoodleEmoticonDialog);
