(function(){tinymce.create("tinymce.plugins.DefinitionList",{_previousNode:null,init:function(a,c){var d=this;a.addCommand("mceInsertDefinitionList",function(f,e){d._execCommand(a,e)});a.addButton("definitionlist",{title:"Definition list",cmd:"mceInsertDefinitionList",image:c+"/img/definitionlist.gif"});a.onNodeChange.add(this._nodeChange,this);a.onKeyUp.add(this._keyUp,this)},_execCommand:function(d,c){function a(k,e){var j;if(e){b=d.selection.getBookmark();var i="";j=d.getDoc().createElement("p");for(var l=0;l<k.childNodes.length;l++){i+=k.childNodes[l].innerHTML+"<br/>"}j.innerHTML=i;k.parentNode.replaceChild(j,k);d.selection.moveToBookmark(b)}else{var h=d.getDoc().createElement("dl");j=d.getDoc().createElement("dt");for(var l=0;l<k.childNodes.length;l++){j.appendChild(k.childNodes[l].cloneNode(1))}h.appendChild(j);d.dom.replace(h,k,0);d.selection.select(j.firstChild);d.selection.collapse(true)}}var g=d.selection.getNode();var f=this._getParentNode(g,["p","h1","h2","h3","h4","h5","h6","pre","div","blockquote","samp","code","ul","ol","dl"]);if(f){tag=f.tagName.toLowerCase();if(tag=="dl"){a(f,true)}else{if((tag!="ol")&&(tag!="ul")){a(f,false)}}}},_keyUp:function(c,g){function a(j,e){var d=c.getDoc().createElement(e);b=c.selection.getBookmark();c.dom.replace(d,j,true);c.selection.moveToBookmark(b)}if(g.keyCode==13){var i=c.selection.getNode();var f=this._getParentNode(i,["dl"]);if(f){var h=this._getParentNode(i,["dt","dd"]);if(h.tagName.toLowerCase()=="dt"){}else{}}}},_nodeChange:function(c,a,d){if(tinyMCE.activeEditor.id!=c.id){return}if(d==this._previousNode){return}else{this._previousNode=d}a.setActive("definitionlist",this._getParentNode(d,["dl"]))},_inArray:function(e,c){for(var d=0;d<c.length;d++){if(e==c[d]){return true}}return false},_getParentNode:function(f,c){c.push("body");var d=f;while(!this._inArray(d.nodeName.toLowerCase(),c)){if(d.parentNode==null){return false}else{d=d.parentNode}}if(d.nodeName.toLowerCase()=="body"){return false}else{return d}},getInfo:function(){return{longname:"Flags",author:"Four Digits",authorurl:"http://www.fourdigits.nl",infourl:"http://plone.org/products/tinymce",version:"1.0"}}});tinymce.PluginManager.add("definitionlist",tinymce.plugins.DefinitionList)})();