/* TYPOlight webCMS :: Copyright (C) 2005 Leo Feyer :: LGPL license */
tinyMCEPopup.requireLangPack();var LinkDialog={preInit:function(){var a;if(a=tinyMCEPopup.getParam("external_link_list_url")){document.write('<script language="javascript" type="text/javascript" src="'+tinyMCEPopup.editor.documentBaseURI.toAbsolute(a)+'"><\/script>')}},init:function(){var b=document.forms[0],a=tinyMCEPopup.editor;document.getElementById("hrefbrowsercontainer").innerHTML=getBrowserHTML("hrefbrowser","href","file","theme_advanced_link");
if(isVisible("hrefbrowser")){document.getElementById("href").style.width="180px"}this.fillClassList("class_list");this.fillFileList("link_list","tinyMCELinkList");this.fillTargetList("target_list");if(e=a.dom.getParent(a.selection.getNode(),"A")){b.href.value=a.dom.getAttrib(e,"href");b.linktitle.value=a.dom.getAttrib(e,"title");b.insert.value=a.getLang("update");selectByValue(b,"link_list",b.href.value);
selectByValue(b,"target_list",a.dom.getAttrib(e,"target"));selectByValue(b,"class_list",a.dom.getAttrib(e,"class"),true)}TinyMCE_EditableSelects.init()},update:function(){var d=document.forms[0],c=tinyMCEPopup.editor,g,a;tinyMCEPopup.restoreSelection();g=c.dom.getParent(c.selection.getNode(),"A");if(!d.href.value){if(g){tinyMCEPopup.execCommand("mceBeginUndoLevel");a=c.selection.getBookmark();c.dom.remove(g,1);
c.selection.moveToBookmark(a);tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close();return}}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(g==null){tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1});tinymce.each(c.dom.select("a"),function(b){if(c.dom.getAttrib(b,"href")=="#mce_temp_url#"){g=b;c.dom.setAttribs(g,{href:d.href.value,title:d.linktitle.value,target:d.target_list?d.target_list.options[d.target_list.selectedIndex].value:null,"class":d.class_list?d.class_list.options[d.class_list.selectedIndex].value:null})
}})}else{c.dom.setAttribs(g,{href:d.href.value,title:d.linktitle.value,target:d.target_list?d.target_list.options[d.target_list.selectedIndex].value:null,"class":d.class_list?d.class_list.options[d.class_list.selectedIndex].value:null})}if(g.childNodes.length!=1||g.firstChild.nodeName!="IMG"){c.focus();c.selection.select(g);c.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");
tinyMCEPopup.close()},checkPrefix:function(a){if(a.value&&Validator.isEmail(a)&&!/^\s*mailto:/i.test(a.value)&&confirm(tinyMCEPopup.getLang("typolinks_dlg.link_is_email"))){a.value="mailto:"+a.value}if(/^\s*www./i.test(a.value)&&confirm(tinyMCEPopup.getLang("typolinks_dlg.link_is_external"))){a.value="http://"+a.value}},fillFileList:function(g,c){var f=tinyMCEPopup.dom,a=f.get(g),d,b;c=window[c];if(c&&c.length>0){a.options[a.options.length]=new Option("","");
tinymce.each(c,function(h){a.options[a.options.length]=new Option(h[0],h[1])})}else{f.remove(f.getParent(g,"tr"))}},fillClassList:function(f){var d=tinyMCEPopup.dom,a=d.get(f),c,b;if(c=tinyMCEPopup.getParam("theme_advanced_styles")){b=[];tinymce.each(c.split(";"),function(g){var h=g.split("=");b.push({title:h[0],"class":h[1]})})}else{b=tinyMCEPopup.editor.dom.getClasses()}if(b.length>0){a.options[a.options.length]=new Option(tinyMCEPopup.getLang("not_set"),"");
tinymce.each(b,function(g){a.options[a.options.length]=new Option(g.title||g["class"],g["class"])})}},fillTargetList:function(d){var c=tinyMCEPopup.dom,a=c.get(d),b;a.options[a.options.length]=new Option(tinyMCEPopup.getLang("not_set"),"");a.options[a.options.length]=new Option(tinyMCEPopup.getLang("typolinks_dlg.link_target_same"),"_self");a.options[a.options.length]=new Option(tinyMCEPopup.getLang("typolinks_dlg.link_target_blank"),"_blank");
if(b=tinyMCEPopup.getParam("theme_advanced_link_targets")){tinymce.each(b.split(","),function(f){f=f.split("=");a.options[a.options.length]=new Option(f[0],f[1])})}}};LinkDialog.preInit();tinyMCEPopup.onInit.add(LinkDialog.init,LinkDialog);