tinyMCEPopup.requireLangPack();var LinkDialog={preInit:function(){var b;if(b=tinyMCEPopup.getParam("external_link_list_url")){document.write('<script language="javascript" type="text/javascript" src="'+tinyMCEPopup.editor.documentBaseURI.toAbsolute(b)+'"><\/script>')}},init:function(){var c=document.forms[0],d=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=d.dom.getParent(d.selection.getNode(),"A")){c.href.value=d.dom.getAttrib(e,"href");c.linktitle.value=d.dom.getAttrib(e,"title");c.insert.value=d.getLang("update");selectByValue(c,"link_list",c.href.value);selectByValue(c,"target_list",d.dom.getAttrib(e,"target"));selectByValue(c,"class_list",d.dom.getAttrib(e,"class"))}},update:function(){var h=document.forms[0],i=tinyMCEPopup.editor,f,b;tinyMCEPopup.restoreSelection();f=i.dom.getParent(i.selection.getNode(),"A");if(!h.href.value){if(f){tinyMCEPopup.execCommand("mceBeginUndoLevel");b=i.selection.getBookmark();i.dom.remove(f,1);i.selection.moveToBookmark(b);tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close();return}}tinyMCEPopup.execCommand("mceBeginUndoLevel");if(f==null){i.getDoc().execCommand("unlink",false,null);tinyMCEPopup.execCommand("CreateLink",false,"#mce_temp_url#",{skip_undo:1});tinymce.each(i.dom.select("a"),function(a){if(i.dom.getAttrib(a,"href")=="#mce_temp_url#"){f=a;i.dom.setAttribs(f,{href:h.href.value,title:h.linktitle.value,target:h.target_list?getSelectValue(h,"target_list"):null,"class":h.class_list?getSelectValue(h,"class_list"):null})}})}else{i.dom.setAttribs(f,{href:h.href.value,title:h.linktitle.value,target:h.target_list?getSelectValue(h,"target_list"):null,"class":h.class_list?getSelectValue(h,"class_list"):null})}if(f.childNodes.length!=1||f.firstChild.nodeName!="IMG"){i.focus();i.selection.select(f);i.selection.collapse(0);tinyMCEPopup.storeSelection()}tinyMCEPopup.execCommand("mceEndUndoLevel");tinyMCEPopup.close()},checkPrefix:function(b){if(b.value&&Validator.isEmail(b)&&!/^\s*mailto:/i.test(b.value)&&confirm(tinyMCEPopup.getLang("advanced_dlg.link_is_email"))){b.value="mailto:"+b.value}if(/^\s*www\./i.test(b.value)&&confirm(tinyMCEPopup.getLang("advanced_dlg.link_is_external"))){b.value="http://"+b.value}},fillFileList:function(j,m){var k=tinyMCEPopup.dom,i=k.get(j),l,h;m=window[m];if(m&&m.length>0){i.options[i.options.length]=new Option("","");tinymce.each(m,function(a){i.options[i.options.length]=new Option(a[0],a[1])})}else{k.remove(k.getParent(j,"tr"))}},fillClassList:function(i){var j=tinyMCEPopup.dom,h=j.get(i),k,g;if(k=tinyMCEPopup.getParam("theme_advanced_styles")){g=[];tinymce.each(k.split(";"),function(b){var a=b.split("=");g.push({title:a[0],"class":a[1]})})}else{g=tinyMCEPopup.editor.dom.getClasses()}if(g.length>0){h.options[h.options.length]=new Option(tinyMCEPopup.getLang("not_set"),"");tinymce.each(g,function(a){h.options[h.options.length]=new Option(a.title||a["class"],a["class"])})}else{j.remove(j.getParent(i,"tr"))}},fillTargetList:function(h){var i=tinyMCEPopup.dom,g=i.get(h),f;g.options[g.options.length]=new Option(tinyMCEPopup.getLang("not_set"),"");g.options[g.options.length]=new Option(tinyMCEPopup.getLang("advanced_dlg.link_target_same"),"_self");g.options[g.options.length]=new Option(tinyMCEPopup.getLang("advanced_dlg.link_target_blank"),"_blank");if(f=tinyMCEPopup.getParam("theme_advanced_link_targets")){tinymce.each(f.split(","),function(a){a=a.split("=");g.options[g.options.length]=new Option(a[0],a[1])})}}};LinkDialog.preInit();tinyMCEPopup.onInit.add(LinkDialog.init,LinkDialog);