var g_bEditorFullscreen=!1,g_sDefaultLocale="de",g_sEditorIDPrefix="editor_",g_nEditorFixedFooterOffset=38,g_aEditor=null,tinyfck_field,tinyfck;function pdafExecCommandCallback(a,b,c){switch(c){case "mceFullScreen":return _pdaf_toggleEditorFullscreen(),!0;case "mceSave":return pdafEditorBgSave(a),!0}return!1}
function pdafFileBrowserCallBack(a,b,c,d){var b=g_pdaf_context_path+"/stream/js/coreui/filemanager/browser.html?Connector="+g_pdaf_context_path+"/filebrowser/"+g_pdaf_configured_plugin,e;tinyfck_field=a;tinyfck=d;switch(c){case "image":e="Image,UI";break;case "ui":e="UI";break;case "file":e="File";break;case "multimedia":case "media":e="Multimedia"}e&&(b+="&Type="+e);window.open(b,"tinyfck","dependent=yes,modal,width=800,height=600,resizable=yes,status=yes")}
function pdafCustomCleanup(a,b){switch(a){case "get_from_editor_dom":_pdaf_cleanUpLists(b);break;case "insert_to_editor_dom":_pdaf_cleanUpLists(b)}return b}
function _pdaf_toggleEditorFullscreen(){alert("toggling fullscreen");var a=jphloc.ge("header"),b=jphloc.ge("menu"),c=jphloc.ge("toolbar");alert("header:"+a+"\nmenu:"+b+"\ntoolbar:"+c);g_bEditorFullscreen?(g_bEditorFullscreen=!1,jphloc.show(a),jphloc.show(b),jphloc.show(c)):(g_bEditorFullscreen=!0,jphloc.hide(a),jphloc.hide(b),jphloc.hide(c));alert("done")}
function _append_hiddenfield(a,b,c){var d=document.createElement("input");d.setAttribute("type","hidden");d.setAttribute("name",b);d.setAttribute("value",c);jphloc.ge(a).appendChild(d)}function _special_submit(a,b,c){null!=b&&_append_hiddenfield(a,"submit_restricted",b);c&&_append_hiddenfield(a,"submit_saveas","true");jphloc.ge(a).submit()}function pdafEditorSave(a,b){_special_submit("mainform",b,!1);_pdaf_reset_mce_dirty(a)}
function pdafEditorSaveAll(a,b){aEditorIDs=b.split(",");for(var c=0;c<aEditorIDs.length;c++)_pdaf_reset_mce_dirty(aEditorIDs[c]);pdaf_submit_form(a)}function pdafEditorSaveFile(a){_special_submit("mainform",null,!1);_pdaf_reset_mce_dirty(a)}function pdafEditorSaveAs(a,b){_special_submit("mainform",b,!0);_pdaf_reset_mce_dirty(a)}function pdafEditorSaveAsFile(a){_special_submit("mainform",null,!0);_pdaf_reset_mce_dirty(a)}
function pdafGetLocaleOfEditorID(a){var b=null,c=a.indexOf("[");0<=c&&c<a.length&&(b=a.substring(c+1),c=b.indexOf("]"),b=0<=c&&c<a.length?b.substring(0,c):null);return b?b:g_sDefaultLocale}function pdafEditorBgSave(a){pdafEditorBackgroundSave(a,pdafGetLocaleOfEditorID(a))}
function pdafEditorBackgroundSave(a,b){var c=jphloc.ge("pdaf_ajax_result_message");c&&c.parentNode.removeChild(c);document.getElementsByName("cfgplugin");var c=document.getElementsByName("cfgpage")[0].value,d=tinyMCE.get(a).getContent();sajax_do_call(null,"savePageBackground",_pdafCallbackSavePageBackground,[g_pdaf_configured_plugin,c,b,d]);_pdaf_reset_mce_dirty(a)}
function pdafEditorBackgroundSaveFile(a,b,c){var d=jphloc.ge("pdaf_ajax_result_message");d&&d.parentNode.removeChild(d);sajax_do_call(null,a,_pdafCallbackSaveFileBackground,[c,tinyMCE.get(b).getContent()]);_pdaf_reset_mce_dirty(b)}function _pdaf_reset_mce_dirty(a){tinyMCE.get(a).isNotDirty=!0}
function _getJSCode(a){if(a&&1==a.nodeType&&"script"==a.nodeName.toLowerCase()){var a=a.innerHTML,b=a.indexOf("<\!--"),c=a.indexOf("//--\>");0>c&&(c=a.indexOf("--\>"));return 0<=b&&0<=c&&c>b?a.substring(b+4,c):a}return""}function _evalJS(a){var a=jphloc.getChildrenByTagName(a,"script",!0),b;for(b in a)jphloc.eval(_getJSCode(a[b]))}
function _pdafCallbackSaveBackground(a){var a=sajax_clean_result(a),b=jphloc.ge("mainform"),c=b.parentNode;oMsg=document.createElement("span");oMsg.innerHTML=a;oMsg.setAttribute("id","pdaf_ajax_result_message");c.insertBefore(oMsg,b);pdaf_triggerWindowLayoutChange();_evalJS(oMsg)}function _pdafCallbackSavePageBackground(a){_pdafCallbackSaveBackground(a)}function _pdafCallbackSaveFileBackground(a){_pdafCallbackSaveBackground(a)}
function _pdaf_cleanUpLists(a){var b,c,d=["ol","ul"],e,g,f,h;for(c=0;c<d.length;c++){b=a.getElementsByTagName(d[c]);for(e=0;e<b.length;e++)if(f=b[e],f.hasChildNodes())for(g=0;g<f.childNodes.length;g++)h=f.childNodes[g],"li"!=h.nodeName.toLowerCase()&&(lli=_pdaf_prevNode(h,"li"),np=a.ownerDocument.createElement("li"),np.innerHTML="&nbsp;",np.appendChild(h),lli?_pdaf_inserAfter(np,lli):f.insertBefore(np,f.firstChild))}}
function _pdaf_inserAfter(a,b){b.nextSibling?b.parentNode.insertBefore(a,b.nextSibling):b.parentNode.appendChild(a)}function _pdaf_prevNode(a,b){for(var c=b.split(","),d;null!=(a=a.previousSibling);)for(d=0;d<c.length;d++)if(a.nodeName.toLowerCase()==c[d])return a;return null}
function pdafFullPageSetupContent(a){var a=tinymce.EditorManager.getInstanceById(a),b=a.getParam("content_css","");if(""!=b){for(var c='<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n',b=b.split(","),d=a.plugins.fullpage.head,e=0;e<b.length;e++){var g='href="'+b[e]+'"',f="<link "+g+' type="text/css" rel="stylesheet"></link>';0>d.indexOf(g)&&(c+=f+"\n")}c=d.replace("</head>",c+"</head>");a.plugins.fullpage.head=c}}
function pdafTInyMCESetupContent(a){tinymce.EditorManager.getInstanceById(a)}function pdafTinyMCEInitCallback(){}
function pdafTinyMCEAutoResize(a){a||(a=window.tinyMCE.activeEditor);var a=a.id,b=document.getElementById(a+"_ifr");null==b&&alert("Failed to resolve editor IFrame with ID '"+a+"_ifr'");var c;window.innerHeight?c=window.innerHeight:document.documentElement&&document.documentElement.clientHeight&&(c=document.documentElement.clientHeight);var d;b.contentDocument?d=b.contentDocument:b.contentWindow?d=b.contentWindow.document:b.document&&(d=b.document);null==d?alert("Failed to resolve Editor document!"):
(b.parentNode.parentNode.parentNode.parentNode.style.height="auto",b.style.height=c-jphloc.getOffsetTopRecursive(b)-g_nEditorFixedFooterOffset+"px")}function pdafTinyMCESetup(a){a.onInit.add(function(){window.setTimeout("pdafTinyMCEAutoResize()",500)})}pdaf_registerWindowLayoutChangeListener(function(){"undefined"!=typeof tinyMCE&&tinyMCE.activeEditor&&pdafTinyMCEAutoResize(tinyMCE.activeEditor)});

