FCK.Description="FCKeditor for Gecko Browsers";FCK.InitializeBehaviors=function(){if(FCKBrowserInfo.IsGecko)Window_OnResize();FCKFocusManager.AddWindow(this.EditorWindow);this.ExecOnSelectionChange=function(){FCK.Events.FireEvent("OnSelectionChange");};this.ExecOnSelectionChangeTimer=function(){if(FCK.LastOnChangeTimer)window.clearTimeout(FCK.LastOnChangeTimer);FCK.LastOnChangeTimer=window.setTimeout(FCK.ExecOnSelectionChange,100);};this.EditorDocument.addEventListener('mouseup',this.ExecOnSelectionChange,false);this.EditorDocument.addEventListener('keyup',this.ExecOnSelectionChangeTimer,false);this._DblClickListener=function(e){FCK.OnDoubleClick(e.target);e.stopPropagation();};this.EditorDocument.addEventListener('dblclick',this._DblClickListener,true);FCK.ContextMenu._InnerContextMenu.SetMouseClickWindow(FCK.EditorWindow);FCK.ContextMenu._InnerContextMenu.AttachToElement(FCK.EditorDocument);};FCK.MakeEditable=function(){this.EditingArea.MakeEditable();};functionDocument_OnContextMenu(e){if(!e.target._FCKShowContextMenu)e.preventDefault();};document.oncontextmenu=Document_OnContextMenu;FCK._BaseGetNamedCommandState=FCK.GetNamedCommandState;FCK.GetNamedCommandState=function(A){switch(A){case'Unlink':returnFCKSelection.HasAncestorNode('A')?0:-1;default:returnFCK._BaseGetNamedCommandState(A);}};FCK.RedirectNamedCommands={Print:true,Paste:true,Cut:true,Copy:true};FCK.ExecuteRedirectedNamedCommand=function(A,B){switch(A){case'Print':FCK.EditorWindow.print();break;case'Paste':try{if(FCK.Paste())FCK.ExecuteNamedCommand('Paste',null,true);}catch(e){FCKDialog.OpenDialog('FCKDialog_Paste',FCKLang.Paste,'dialog/fck_paste.html',400,330,'Security');};break;case'Cut':try{FCK.ExecuteNamedCommand('Cut',null,true);}catch(e){alert(FCKLang.PasteErrorCut);};break;case'Copy':try{FCK.ExecuteNamedCommand('Copy',null,true);}catch(e){alert(FCKLang.PasteErrorCopy);};break;default:FCK.ExecuteNamedCommand(A,B);}};FCK.AttachToOnSelectionChange=function(A){this.Events.AttachEvent('OnSelectionChange',A);};FCK.Paste=function(){if(FCKConfig.ForcePasteAsPlainText){FCK.PasteAsPlainText();returnfalse;};returntrue;};FCK.InsertHtml=function(A){A=FCKConfig.ProtectedSource.Protect(A);A=FCK.ProtectEvents(A);A=FCK.ProtectUrls(A);A=FCK.ProtectTags(A);A=A.replace(FCKRegexLib.StrongOpener,'<b$1');A=A.replace(FCKRegexLib.StrongCloser,'<\/b>');A=A.replace(FCKRegexLib.EmOpener,'<i$1');A=A.replace(FCKRegexLib.EmCloser,'<\/i>');varB=FCKSelection.Delete();varC=B.getRangeAt(0);varD=C.createContextualFragment(A);varE=D.lastChild;C.insertNode(D);FCKSelection.SelectNode(E);FCKSelection.Collapse(false);this.Focus();};FCK.InsertElement=function(A){varB=FCKSelection.Delete();varC=B.getRangeAt(0);C.insertNode(A);FCKSelection.SelectNode(A);FCKSelection.Collapse(false);this.Focus();};FCK.PasteAsPlainText=function(){FCKTools.RunFunction(FCKDialog.OpenDialog,FCKDialog,['FCKDialog_Paste',FCKLang.PasteAsText,'dialog/fck_paste.html',400,330,'PlainText']);};FCK.GetClipboardHTML=function(){return'';};FCK.CreateLink=function(A){FCK.ExecuteNamedCommand('Unlink');if(A.length>0){varB='javascript:void(0);/*'+(newDate().getTime())+'*/';FCK.ExecuteNamedCommand('CreateLink',B);varC=this.EditorDocument.evaluate("//a[@href='"+B+"']",this.EditorDocument.body,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;if(C){C.href=A;returnC;}};returnnull;};
varFCKConfig=FCK.Config={};if(document.location.protocol=='file:'){FCKConfig.BasePath=decodeURIComponent(document.location.pathname.substr(1));FCKConfig.BasePath=FCKConfig.BasePath.replace(/\\/gi,'/');FCKConfig.BasePath='file://'+FCKConfig.BasePath.substring(0,FCKConfig.BasePath.lastIndexOf('/')+1);FCKConfig.FullBasePath=FCKConfig.BasePath;}else{FCKConfig.BasePath=document.location.pathname.substring(0,document.location.pathname.lastIndexOf('/')+1);FCKConfig.FullBasePath=document.location.protocol+'//'+document.location.host+FCKConfig.BasePath;};FCKConfig.EditorPath=FCKConfig.BasePath.replace(/editor\/$/,'');try{FCKConfig.ScreenWidth=screen.width;FCKConfig.ScreenHeight=screen.height;}catch(e){FCKConfig.ScreenWidth=800;FCKConfig.ScreenHeight=600;};FCKConfig.ProcessHiddenField=function(){this.PageConfig={};varA=window.parent.document.getElementById(FCK.Name+'___Config');if(!A)return;varB=A.value.split('&');for(vari=0;i<B.length;i++){if(B[i].length==0)continue;varC=B[i].split('=');varD=decodeURIComponent(C[0]);varE=decodeURIComponent(C[1]);if(D=='CustomConfigurationsPath')FCKConfig[D]=E;elseif(E.toLowerCase()=="true")this.PageConfig[D]=true;elseif(E.toLowerCase()=="false")this.PageConfig[D]=false;elseif(E.length>0&&!isNaN(E))this.PageConfig[D]=parseInt(E,10);elsethis.PageConfig[D]=E;}};functionFCKConfig_LoadPageConfig(){varA=FCKConfig.PageConfig;for(varBinA)FCKConfig[B]=A[B];};functionFCKConfig_PreProcess(){varA=FCKConfig;if(A.AllowQueryStringDebug){try{if((/fckdebug=true/i).test(window.top.location.search))A.Debug=true;}catch(e){/*Ignore it. Much probably we are inside a FRAME where the "top" is in another domain (security error).*/}};if(!A.PluginsPath.EndsWith('/'))A.PluginsPath+='/';if(typeof(A.EditorAreaCSS)=='string')A.EditorAreaCSS=[A.EditorAreaCSS];varB=A.ToolbarComboPreviewCSS;if(!B||B.length==0)A.ToolbarComboPreviewCSS=A.EditorAreaCSS;elseif(typeof(B)=='string')A.ToolbarComboPreviewCSS=[B];};FCKConfig.ToolbarSets={};FCKConfig.Plugins={};FCKConfig.Plugins.Items=[];FCKConfig.Plugins.Add=function(A,B,C){FCKConfig.Plugins.Items.AddItem([A,B,C]);};FCKConfig.ProtectedSource={};FCKConfig.ProtectedSource.RegexEntries=[/<!--[\s\S]*?-->/g,/<script[\s\S]*?<\/script>/gi,/<noscript[\s\S]*?<\/noscript>/gi];FCKConfig.ProtectedSource.Add=function(A){this.RegexEntries.AddItem(A);};FCKConfig.ProtectedSource.Protect=function(A){function_Replace(protectedSource){varB=FCKTempBin.AddElement(protectedSource);return'<!--{PS..'+B+'}-->';};for(vari=0;i<this.RegexEntries.length;i++){A=A.replace(this.RegexEntries[i],_Replace);};returnA;};FCKConfig.ProtectedSource.Revert=function(A,B){function_Replace(m,opener,index){varC=B?FCKTempBin.RemoveElement(index):FCKTempBin.Elements[index];returnFCKConfig.ProtectedSource.Revert(C,B);};returnA.replace(/(<|<)!--\{PS..(\d+)\}--(>|>)/g,_Replace);}
varFCKXHtml={};FCKXHtml.CurrentJobNum=0;FCKXHtml.GetXHTML=function(A,B,C){FCKXHtmlEntities.Initialize();this._NbspEntity=(FCKConfig.ProcessHTMLEntities?'nbsp':'#160');varD=FCK.IsDirty();this._CreateNode=FCKConfig.ForceStrongEm?FCKXHtml_CreateNode_StrongEm:FCKXHtml_CreateNode_Normal;FCKXHtml.SpecialBlocks=[];this.XML=FCKTools.CreateXmlObject('DOMDocument');this.MainNode=this.XML.appendChild(this.XML.createElement('xhtml'));FCKXHtml.CurrentJobNum++;if(B)this._AppendNode(this.MainNode,A);elsethis._AppendChildNodes(this.MainNode,A,false);varE=this._GetMainXmlString();this.XML=null;E=E.substr(7,E.length-15).Trim();if(FCKBrowserInfo.IsGecko)E=E.replace(/<br\/>$/,'');E=E.replace(FCKRegexLib.SpaceNoClose,' />');if(FCKConfig.ForceSimpleAmpersand)E=E.replace(FCKRegexLib.ForceSimpleAmpersand,'&');if(C)E=FCKCodeFormatter.Format(E);for(vari=0;i<FCKXHtml.SpecialBlocks.length;i++){varF=newRegExp('___FCKsi___'+i);E=E.replace(F,FCKXHtml.SpecialBlocks[i]);};E=E.replace(FCKRegexLib.GeckoEntitiesMarker,'&');if(!D)FCK.ResetIsDirty();returnE;};FCKXHtml._AppendAttribute=function(A,B,C){try{if(C==undefined||C==null)C='';elseif(C.replace){if(FCKConfig.ForceSimpleAmpersand)C=C.replace(/&/g,'___FCKAmp___');C=C.replace(FCKXHtmlEntities.EntitiesRegex,FCKXHtml_GetEntity);};varD=this.XML.createAttribute(B);D.value=C;A.attributes.setNamedItem(D);}catch(e){}};FCKXHtml._AppendChildNodes=function(A,B,C){if(C)FCKDomTools.TrimNode(B,true);varD=0;varE=B.firstChild;while(E){if(this._AppendNode(A,E))D++;E=E.nextSibling;};if(D==0){if(C&&FCKConfig.FillEmptyBlocks){this._AppendEntity(A,this._NbspEntity);returnA;};varF=A.nodeName;if(FCKListsLib.InlineChildReqElements[F])returnnull;if(!FCKListsLib.EmptyElements[F])A.appendChild(this.XML.createTextNode(''));};returnA;};FCKXHtml._AppendNode=function(A,B){if(!B)returnfalse;switch(B.nodeType){case1:if(B.getAttribute('_fckfakelement'))returnFCKXHtml._AppendNode(A,FCK.GetRealElement(B));if(FCKBrowserInfo.IsGecko&&B.hasAttribute('_moz_editor_bogus_node'))returnfalse;if(B.getAttribute('_fcktemp'))returnfalse;varC=B.tagName.toLowerCase();if(FCKBrowserInfo.IsIE){if(B.scopeName&&B.scopeName!='HTML'&&B.scopeName!='FCK')C=B.scopeName.toLowerCase()+':'+C;}else{if(C.StartsWith('fck:'))C=C.Remove(0,4);};if(!FCKRegexLib.ElementName.test(C))returnfalse;if(C=='br'&&B.getAttribute('type',2)=='_moz')returnfalse;if(B._fckxhtmljob&&B._fckxhtmljob==FCKXHtml.CurrentJobNum)returnfalse;varD=this._CreateNode(C);FCKXHtml._AppendAttributes(A,B,D,C);B._fckxhtmljob=FCKXHtml.CurrentJobNum;varE=FCKXHtml.TagProcessors[C];if(E)D=E(D,B,A);elseD=this._AppendChildNodes(D,B,Boolean(FCKListsLib.NonEmptyBlockElements[C]));if(!D)returnfalse;A.appendChild(D);break;case3:returnthis._AppendTextNode(A,B.nodeValue.ReplaceNewLineChars(' '));case8:if(FCKBrowserInfo.IsIE&&!B.innerHTML)break;try{A.appendChild(this.XML.createComment(B.nodeValue));}catch(e){/*Do nothing... probably this is a wrong format comment.*/};break;default:A.appendChild(this.XML.createComment("Element not supported - Type: "+B.nodeType+" Name: "+B.nodeName));break;};returntrue;};functionFCKXHtml_CreateNode_StrongEm(A){switch(A){case'b':A='strong';break;case'i':A='em';break;};returnthis.XML.createElement(A);};functionFCKXHtml_CreateNode_Normal(A){returnthis.XML.createElement(A);};FCKXHtml._AppendSpecialItem=function(A){return'___FCKsi___'+FCKXHtml.SpecialBlocks.AddItem(A);};FCKXHtml._AppendEntity=function(A,B){A.appendChild(this.XML.createTextNode('#?-:'+B+';'));};FCKXHtml._AppendTextNode=function(A,B){varC=B.length>0;if(C)A.appendChild(this.XML.createTextNode(B.replace(FCKXHtmlEntities.EntitiesRegex,FCKXHtml_GetEntity)));returnC;};functionFCKXHtml_GetEntity(A){varB=FCKXHtmlEntities.Entities[A]||('#'+A.charCodeAt(0));return'#?-:'+B+';';};FCKXHtml._RemoveAttribute=function(A,B,C){varD=A.attributes.getNamedItem(C);if(D&&B.test(D.nodeValue)){varE=D.nodeValue.replace(B,'');if(E.length==0)A.attributes.removeNamedItem(C);elseD.nodeValue=E;}};FCKXHtml.TagProcessors={img:function(A,B){if(!A.attributes.getNamedItem('alt'))FCKXHtml._AppendAttribute(A,'alt','');varC=B.getAttribute('_fcksavedurl');if(C!=null)FCKXHtml._AppendAttribute(A,'src',C);returnA;},a:function(A,B){if(B.innerHTML.Trim().length==0&&!B.name)returnfalse;varC=B.getAttribute('_fcksavedurl');if(C!=null)FCKXHtml._AppendAttribute(A,'href',C);if(FCKBrowserInfo.IsIE){FCKXHtml._RemoveAttribute(A,FCKRegexLib.FCK_Class,'class');if(B.name)FCKXHtml._AppendAttribute(A,'name',B.name);};A=FCKXHtml._AppendChildNodes(A,B,false);returnA;},script:function(A,B){if(!A.attributes.getNamedItem('type'))FCKXHtml._AppendAttribute(A,'type','text/javascript');A.appendChild(FCKXHtml.XML.createTextNode(FCKXHtml._AppendSpecialItem(B.text)));returnA;},style:function(A,B){if(!A.attributes.getNamedItem('type'))FCKXHtml._AppendAttribute(A,'type','text/css');A.appendChild(FCKXHtml.XML.createTextNode(FCKXHtml._AppendSpecialItem(B.innerHTML)));returnA;},title:function(A,B){A.appendChild(FCKXHtml.XML.createTextNode(FCK.EditorDocument.title));returnA;},table:function(A,B){if(FCKBrowserInfo.IsIE)FCKXHtml._RemoveAttribute(A,FCKRegexLib.FCK_Class,'class');A=FCKXHtml._AppendChildNodes(A,B,false);returnA;},ol:function(A,B,C){if(B.innerHTML.Trim().length==0)returnfalse;varD=C.lastChild;if(D&&D.nodeType==3)D=D.previousSibling;if(D&&D.nodeName.toUpperCase()=='LI'){B._fckxhtmljob=null;FCKXHtml._AppendNode(D,B);returnfalse;};A=FCKXHtml._AppendChildNodes(A,B);returnA;},span:function(A,B){if(B.innerHTML.length==0)returnfalse;A=FCKXHtml._AppendChildNodes(A,B,false);returnA;},iframe:function(A,B){varC=B.innerHTML;if(FCKBrowserInfo.IsGecko)C=FCKTools.HTMLDecode(C);C=C.replace(/\s_fcksavedurl="[^"]*"/g,'');A.appendChild(FCKXHtml.XML.createTextNode(FCKXHtml._AppendSpecialItem(C)));returnA;}};FCKXHtml.TagProcessors.ul=FCKXHtml.TagProcessors.ol;
varFCKXml=function(){};FCKXml.prototype.LoadUrl=function(A){this.Error=false;varB=this;varC=FCKTools.CreateXmlObject('XmlHttp');C.open("GET",A,false);C.send(null);if(C.status==200||C.status==304)this.DOMDocument=C.responseXML;elseif(C.status==0&&C.readyState==4)this.DOMDocument=C.responseXML;elsethis.DOMDocument=null;if(this.DOMDocument==null||this.DOMDocument.firstChild==null){this.Error=true;if(window.confirm('Error loading "'+A+'"\r\nDo you want to see more info?'))alert('URL requested: "'+A+'"\r\nServer response:\r\nStatus: '+C.status+'\r\nResponse text:\r\n'+C.responseText);}};FCKXml.prototype.SelectNodes=function(A,B){if(this.Error)return[];varC=[];varD=this.DOMDocument.evaluate(A,B?B:this.DOMDocument,this.DOMDocument.createNSResolver(this.DOMDocument.documentElement),XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);if(D){varE=D.iterateNext();while(E){C[C.length]=E;E=D.iterateNext();}};returnC;};FCKXml.prototype.SelectSingleNode=function(A,B){if(this.Error)returnnull;varC=this.DOMDocument.evaluate(A,B?B:this.DOMDocument,this.DOMDocument.createNSResolver(this.DOMDocument.documentElement),9,null);if(C&&C.singleNodeValue)returnC.singleNodeValue;elsereturnnull;}