tinyMCEPopup.requireLangPack();function initCommonAttributes(f){var e=document.forms[0],d=tinyMCEPopup.editor.dom;setFormValue("title",d.getAttrib(f,"title"));setFormValue("id",d.getAttrib(f,"id"));selectByValue(e,"class",d.getAttrib(f,"class"),true);setFormValue("style",d.getAttrib(f,"style"));selectByValue(e,"dir",d.getAttrib(f,"dir"));setFormValue("lang",d.getAttrib(f,"lang"));setFormValue("onfocus",d.getAttrib(f,"onfocus"));setFormValue("onblur",d.getAttrib(f,"onblur"));setFormValue("onclick",d.getAttrib(f,"onclick"));setFormValue("ondblclick",d.getAttrib(f,"ondblclick"));setFormValue("onmousedown",d.getAttrib(f,"onmousedown"));setFormValue("onmouseup",d.getAttrib(f,"onmouseup"));setFormValue("onmouseover",d.getAttrib(f,"onmouseover"));setFormValue("onmousemove",d.getAttrib(f,"onmousemove"));setFormValue("onmouseout",d.getAttrib(f,"onmouseout"));setFormValue("onkeypress",d.getAttrib(f,"onkeypress"));setFormValue("onkeydown",d.getAttrib(f,"onkeydown"));setFormValue("onkeyup",d.getAttrib(f,"onkeyup"))}function setFormValue(d,c){if(document.forms[0].elements[d]){document.forms[0].elements[d].value=c}}function insertDateTime(b){document.getElementById(b).value=getDateTime(new Date(),"%Y-%m-%dT%H:%M:%S")}function getDateTime(c,d){d=d.replace("%D","%m/%d/%y");d=d.replace("%r","%I:%M:%S %p");d=d.replace("%Y",""+c.getFullYear());d=d.replace("%y",""+c.getYear());d=d.replace("%m",addZeros(c.getMonth()+1,2));d=d.replace("%d",addZeros(c.getDate(),2));d=d.replace("%H",""+addZeros(c.getHours(),2));d=d.replace("%M",""+addZeros(c.getMinutes(),2));d=d.replace("%S",""+addZeros(c.getSeconds(),2));d=d.replace("%I",""+((c.getHours()+11)%12+1));d=d.replace("%p",""+(c.getHours()<12?"AM":"PM"));d=d.replace("%%","%");return d}function addZeros(f,e){var d;f=""+f;if(f.length<e){for(d=0;d<(e-f.length);d++){f="0"+f}}return f}function selectByValue(r,p,l,m,k){if(!r||!r.elements[p]){return}var q=r.elements[p];var i=false;for(var o=0;o<q.options.length;o++){var n=q.options[o];if(n.value==l||(k&&n.value.toLowerCase()==l.toLowerCase())){n.selected=true;i=true}else{n.selected=false}}if(!i&&m&&l!=""){var n=new Option("Value: "+l,l);n.selected=true;q.options[q.options.length]=n}return i}function setAttrib(h,i,j){var f=document.forms[0];var g=f.elements[i.toLowerCase()];tinyMCEPopup.editor.dom.setAttrib(h,i,j||g.value)}function setAllCommonAttribs(b){setAttrib(b,"title");setAttrib(b,"id");setAttrib(b,"class");setAttrib(b,"style");setAttrib(b,"dir");setAttrib(b,"lang")}SXE={currentAction:"insert",inst:tinyMCEPopup.editor,updateElement:null};SXE.focusElement=SXE.inst.selection.getNode();SXE.initElementDialog=function(d){addClassesToList("class","xhtmlxtras_styles");TinyMCE_EditableSelects.init();d=d.toLowerCase();var c=SXE.inst.dom.getParent(SXE.focusElement,d.toUpperCase());if(c!=null&&c.nodeName.toUpperCase()==d.toUpperCase()){SXE.currentAction="update"}if(SXE.currentAction=="update"){initCommonAttributes(c);SXE.updateElement=c}document.forms[0].insert.value=tinyMCEPopup.getLang(SXE.currentAction,"Insert",true)};SXE.insertElement=function(k){var j=SXE.inst.dom.getParent(SXE.focusElement,k.toUpperCase()),l,n;tinyMCEPopup.execCommand("mceBeginUndoLevel");if(j==null){var m=SXE.inst.selection.getContent();if(m.length>0){n=k;insertInlineElement(k);var i=tinymce.grep(SXE.inst.dom.select(k));for(var h=0;h<i.length;h++){var j=i[h];if(SXE.inst.dom.getAttrib(j,"_mce_new")){j.id="";j.setAttribute("id","");j.removeAttribute("id");j.removeAttribute("_mce_new");setAllCommonAttribs(j)}}}}else{setAllCommonAttribs(j)}SXE.inst.nodeChanged();tinyMCEPopup.execCommand("mceEndUndoLevel")};SXE.removeElement=function(b){b=b.toLowerCase();elm=SXE.inst.dom.getParent(SXE.focusElement,b.toUpperCase());if(elm&&elm.nodeName.toUpperCase()==b.toUpperCase()){tinyMCEPopup.execCommand("mceBeginUndoLevel");tinyMCE.execCommand("mceRemoveNode",false,elm);SXE.inst.nodeChanged();tinyMCEPopup.execCommand("mceEndUndoLevel")}};SXE.showRemoveButton=function(){document.getElementById("remove").style.display=""};SXE.containsClass=function(c,d){return(c.className.indexOf(d)>-1)?true:false};SXE.removeClass=function(i,l){if(i.className==null||i.className==""||!SXE.containsClass(i,l)){return true}var j=i.className.split(" ");var k="";for(var h=0,g=j.length;h<g;h++){if(j[h]!=l){k+=(j[h]+" ")}}i.className=k.substring(0,k.length-1)};SXE.addClass=function(c,d){if(!SXE.containsClass(c,d)){c.className?c.className+=" "+d:c.className=d}return true};function insertInlineElement(d){var e=tinyMCEPopup.editor,f=e.dom;e.getDoc().execCommand("FontName",false,"mceinline");tinymce.each(f.select("span,font"),function(a){if(a.style.fontFamily=="mceinline"||a.face=="mceinline"){f.replace(f.create(d,{_mce_new:1}),a,1)}})};