var action,element;function init(){tinyMCEPopup.resizeToInnerSize();var _1=tinyMCE.getInstanceById(tinyMCE.getWindowArg("editor_id"));var _2=tinyMCE.getParentElement(_1.getFocusElement(),"a","name");var _3=_1.getFocusElement();action="insert";if(_2!=null){element=_2;action="update";}if(tinyMCE.getAttrib(_3,"class")=="mceItemAnchor"){element=_3;action="update";}if(action=="update"){document.forms[0].anchorName.value=element.nodeName=="IMG"?element.getAttribute("title"):element.getAttribute("name");}document.forms[0].insert.value=tinyMCE.getLang("lang_"+action,"Insert",true);}function insertAnchor(){var _4=tinyMCE.getInstanceById(tinyMCE.getWindowArg("editor_id"));var _5=document.forms[0].anchorName.value,e;tinyMCEPopup.execCommand("mceBeginUndoLevel");if(action=="update"){if(element.nodeName=="IMG"){element.setAttribute("title",_5);}else{element.setAttribute("name",_5);}}else{var _7=_4.getRng();if(_7.collapse){_7.collapse(false);}_5=_5.replace(/&/g,"&amp;");_5=_5.replace(/\"/g,"&quot;");_5=_5.replace(/</g,"&lt;");_5=_5.replace(/>/g,"&gt;");if(tinyMCE.isGecko){html="<a id=\"mceNewAnchor\" name=\""+_5+"\"></a>";}else{html="<a name=\""+_5+"\"></a>";}tinyMCEPopup.execCommand("mceInsertContent",false,html);if(tinyMCE.isGecko){e=_4.getDoc().getElementById("mceNewAnchor");if(e){_4.selection.selectNode(e,true,false,false);e.removeAttribute("id");}}tinyMCE.handleVisualAid(_4.getBody(),true,_4.visualAid,_4);}tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCE.triggerNodeChange();tinyMCEPopup.close();}