/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* This file has been compacted for best loading performance.
*
* Version: 2.0 RC2
* Created: 2004-12-21 23:53:24
*/
var FCKDebug=new Object();if (FCKConfig.Debug){FCKDebug.Output=function(message,color){if (!FCKConfig.Debug) return;if (message!=null&&isNaN(message)) message=message.replace(/</g,"<");if (!this.DebugWindow||this.DebugWindow.closed) this.DebugWindow=window.open('fckdebug.html','FCKeditorDebug','menubar=no,scrollbars=no,resizable=yes,location=no,toolbar=no,width=600,height=500',true);if (this.DebugWindow.Output) this.DebugWindow.Output(message,color);};}else FCKDebug.Output=function() {};
var FCKTools=new Object();FCKTools.GetLinkedFieldValue=function(){return FCK.LinkedField.value;};FCKTools.SetLinkedFieldValue=function(value){FCK.LinkedField.value=value;};FCKTools.AttachToLinkedFieldFormSubmit=function(functionPointer){var oForm=FCK.LinkedField.form;if (!oForm) return;if (FCKBrowserInfo.IsIE) oForm.attachEvent("onsubmit",functionPointer);else oForm.addEventListener('submit',functionPointer,true);if (!oForm.updateFCKEditor) oForm.updateFCKEditor=new Array();oForm.updateFCKEditor[oForm.updateFCKEditor.length]=functionPointer;if (!oForm.originalSubmit&&!oForm.submit.tagName){oForm.originalSubmit=oForm.submit;oForm.submit=function(){if (this.updateFCKEditor){for (var i=0;i<this.updateFCKEditor.length;i++) this.updateFCKEditor[i]();};this.originalSubmit();};};};FCKTools.AddSelectOption=function(targetDocument,selectElement,optionText,optionValue){var oOption=targetDocument.createElement("OPTION");oOption.text=optionText;oOption.value=optionValue;selectElement.options.add(oOption);return oOption;};FCKTools.RemoveAllSelectOptions=function(selectElement){for (var i=selectElement.options.length-1;i>=0;i--){selectElement.options.remove(i);};};FCKTools.SelectNoCase=function(selectElement,value,defaultValue){var sNoCaseValue=value.toString().toLowerCase();for (var i=0;i<selectElement.options.length;i++){if (sNoCaseValue==selectElement.options[i].value.toLowerCase()){selectElement.selectedIndex=i;return;};};if (defaultValue!=null) FCKTools.SelectNoCase(selectElement,defaultValue);};FCKTools.HTMLEncode=function(text){text=text.replace(/&/g,"&");text=text.replace(/"/g,""");text=text.replace(/</g,"<");text=text.replace(/>/g,">");text=text.replace(/'/g,"'");return text;};FCKTools.GetResultingArray=function(arraySource,separator){switch (typeof(arraySource)){case "string":return arraySource.split(separator);case "function":return separator();default:if (isArray(arraySource)) return arraySource;else return new Array();};};FCKTools.GetElementPosition=function(el){var c={ X:0,Y:0 };while (el){c.X+=el.offsetLeft;c.Y+=el.offsetTop;el=el.offsetParent;};return c;};FCKTools.GetElementAscensor=function(element,ascensorTagName){var e=element.parentNode;while (e){if (e.nodeName==ascensorTagName) return e;e=e.parentNode;};};
FCKTools.AppendStyleSheet=function(documentElement,cssFileUrl){var e=documentElement.createElement('LINK');e.rel='stylesheet';e.type='text/css';e.href=cssFileUrl;documentElement.getElementsByTagName("HEAD")[0].appendChild(e);};FCKTools.ClearElementAttributes=function(element){for (var i=0;i<element.attributes.length;i++){element.removeAttribute(element.attributes[i].name,0);};};FCKTools.GetAllChildrenIds=function(parentElement){var aIds=new Array();var fGetIds=function(parent){for (var i=0;i<parent.childNodes.length;i++){var sId=parent.childNodes[i].id;if (sId&&sId.length>0) aIds[aIds.length]=sId;fGetIds(parent.childNodes[i]);};};fGetIds(parentElement);return aIds;};FCKTools.RemoveOuterTags=function(e){var oFragment=e.ownerDocument.createDocumentFragment();for (var i=0;i<e.childNodes.length;i++) oFragment.appendChild(e.childNodes[i]);e.parentNode.replaceChild(oFragment,e);}
var FCKRegexLib=new Object();FCKRegexLib.AposEntity=/'/gi;FCKRegexLib.ObjectElements=/^(?:IMG|TABLE|TR|TD|INPUT|SELECT|TEXTAREA|HR|OBJECT)$/i;FCKRegexLib.NamedCommands=/^(?:Cut|Copy|Paste|Print|SelectAll|RemoveFormat|Unlink|Undo|Redo|Bold|Italic|Underline|StrikeThrough|Subscript|Superscript|JustifyLeft|JustifyCenter|JustifyRight|JustifyFull|Outdent|Indent|InsertOrderedList|InsertUnorderedList|InsertHorizontalRule)$/i;
FCKLanguageManager.GetActiveLanguage=function(){if (FCKConfig.AutoDetectLanguage){var sUserLang;if (navigator.userLanguage) sUserLang=navigator.userLanguage.toLowerCase();else if (navigator.language) sUserLang=navigator.language.toLowerCase();else{return FCKConfig.DefaultLanguage;};FCKDebug.Output('Navigator Language = '+sUserLang);if (sUserLang.length>=5){sUserLang=sUserLang.substr(0,5);if (this.AvailableLanguages[sUserLang]) return sUserLang;};if (sUserLang.length>=2){sUserLang=sUserLang.substr(0,2);if (this.AvailableLanguages[sUserLang]) return sUserLang;};};return this.DefaultLanguage;};FCKLanguageManager.TranslateElements=function(targetDocument,tag,propertyToSet){var aInputs=targetDocument.getElementsByTagName(tag);for (var i=0;i<aInputs.length;i++){var oAtt=aInputs[i].attributes['fckLang'];if (oAtt){var s=FCKLang[oAtt.value];if (s) eval('aInputs[i].'+propertyToSet+' = s');};};};FCKLanguageManager.TranslatePage=function(targetDocument){this.TranslateElements(targetDocument,'INPUT','value');this.TranslateElements(targetDocument,'SPAN','innerHTML');this.TranslateElements(targetDocument,'LABEL','innerHTML');this.TranslateElements(targetDocument,'OPTION','innerHTML');};if (FCKLanguageManager.AvailableLanguages[FCKConfig.DefaultLanguage]) FCKLanguageManager.DefaultLanguage=FCKConfig.DefaultLanguage;else FCKLanguageManager.DefaultLanguage='en';FCKLanguageManager.ActiveLanguage=new Object();FCKLanguageManager.ActiveLanguage.Code=FCKLanguageManager.GetActiveLanguage();FCKLanguageManager.ActiveLanguage.Name=FCKLanguageManager.AvailableLanguages[FCKLanguageManager.ActiveLanguage.Code];FCK.Language=FCKLanguageManager;LoadLanguageFile();
var FCKEvents=function(eventsOwner){this.Owner=eventsOwner;this.RegisteredEvents=new Object();};FCKEvents.prototype.AttachEvent=function(eventName,functionPointer,params){if (!this.RegisteredEvents[eventName]) this.RegisteredEvents[eventName]=new Array();this.RegisteredEvents[eventName][this.RegisteredEvents[eventName].length]=functionPointer;};FCKEvents.prototype.FireEvent=function(eventName,params){var bReturnValue=true;FCKDebug.Output('Firing event: '+eventName,'Fuchsia');var oCalls=this.RegisteredEvents[eventName];if (oCalls){for (var i=0;i<oCalls.length;i++){if (typeof(oCalls[i])=="function") bReturnValue=(bReturnValue&&oCalls[i](params));else bReturnValue=(bReturnValue&&eval(oCalls[i]));};};return bReturnValue;};
FCKXHtmlEntities=new Object();FCKXHtmlEntities.Entities={' ':'nbsp','¡':'iexcl','¢':'cent','£':'pound','¤':'curren','¥':'yen','¦':'brvbar','§':'sect','¨':'uml','©':'copy','ª':'ordf','«':'laquo','¬':'not','':'shy','®':'reg','¯':'macr','°':'deg','±':'plusmn','²':'sup2','³':'sup3','´':'acute','µ':'micro','¶':'para','·':'middot','¸':'cedil','¹':'sup1','º':'ordm','»':'raquo','¼':'frac14','½':'frac12','¾':'frac34','¿':'iquest','À':'Agrave','Á':'Aacute','Â':'Acirc','Ã':'Atilde','Ä':'Auml','Å':'Aring','Æ':'AElig','Ç':'Ccedil','È':'Egrave','É':'Eacute','Ê':'Ecirc','Ë':'Euml','Ì':'Igrave','Í':'Iacute','Î':'Icirc','Ï':'Iuml','Ð':'ETH','Ñ':'Ntilde','Ò':'Ograve','Ó':'Oacute','Ô':'Ocirc','Õ':'Otilde','Ö':'Ouml','×':'times','Ø':'Oslash','Ù':'Ugrave','Ú':'Uacute','Û':'Ucirc','Ü':'Uuml','Ý':'Yacute','Þ':'THORN','ß':'szlig','à':'agrave','á':'aacute','â':'acirc','ã':'atilde','ä':'auml','å':'aring','æ':'aelig','ç':'ccedil','è':'egrave','é':'eacute','ê':'ecirc','ë':'euml','ì':'igrave','í':'iacute','î':'icirc','ï':'iuml','ð':'eth','ñ':'ntilde','ò':'ograve','ó':'oacute','ô':'ocirc','õ':'otilde','ö':'ouml','÷':'divide','ø':'oslash','ù':'ugrave','ú':'uacute','û':'ucirc','ü':'uuml','ý':'yacute','þ':'thorn','ÿ':'yuml','ƒ':'fnof','Α':'Alpha','Β':'Beta','Γ':'Gamma','Δ':'Delta','Ε':'Epsilon','Ζ':'Zeta','Η':'Eta','Θ':'Theta','Ι':'Iota','Κ':'Kappa','Λ':'Lambda','Μ':'Mu','Ν':'Nu','Ξ':'Xi','Ο':'Omicron','Π':'Pi','Ρ':'Rho','Σ':'Sigma','Τ':'Tau','Υ':'Upsilon','Φ':'Phi','Χ':'Chi','Ψ':'Psi','Ω':'Omega','α':'alpha','β':'beta','γ':'gamma','δ':'delta','ε':'epsilon','ζ':'zeta','η':'eta','θ':'theta','ι':'iota','κ':'kappa','λ':'lambda','μ':'mu','ν':'nu','ξ':'xi','ο':'omicron','π':'pi','ρ':'rho','ς':'sigmaf','σ':'sigma','τ':'tau','υ':'upsilon','φ':'phi','χ':'chi','ψ':'psi','ω':'omega','ϑ':'thetasym','ϒ':'upsih','ϖ':'piv','•':'bull','…':'hellip','′':'prime','″':'Prime','‾':'oline','⁄':'frasl','℘':'weierp','ℑ':'image','ℜ':'real','™':'trade','ℵ':'alefsym','←':'larr','↑':'uarr','→':'rarr','↓':'darr','↔':'harr','↵':'crarr','⇐':'lArr','⇑':'uArr','⇒':'rArr','⇓':'dArr','⇔':'hArr','∀':'forall','∂':'part','∃':'exist','∅':'empty','∇':'nabla','∈':'isin','∉':'notin','∋':'ni','∏':'prod','∑':'sum','−':'minus','∗':'lowast','√':'radic','∝':'prop','∞':'infin','∠':'ang','∧':'and','∨':'or','∩':'cap','∪':'cup','∫':'int','∴':'there4','∼':'sim','≅':'cong','≈':'asymp','≠':'ne','≡':'equiv','≤':'le','≥':'ge','⊂':'sub','⊃':'sup','⊄':'nsub','⊆':'sube','⊇':'supe','⊕':'oplus','⊗':'otimes','⊥':'perp','⋅':'sdot','⌈':'lceil','⌉':'rceil','⌊':'lfloor','⌋':'rfloor','〈':'lang','〉':'rang','◊':'loz','♠':'spades','♣':'clubs','♥':'hearts','♦':'diams','"':'quot','Œ':'OElig','œ':'oelig','Š':'Scaron','š':'scaron','Ÿ':'Yuml','ˆ':'circ','˜':'tilde',' ':'ensp',' ':'emsp',' ':'thinsp','':'zwnj','':'zwj','':'lrm','':'rlm','–':'ndash','—':'mdash','‘':'lsquo','’':'rsquo','‚':'sbquo','“':'ldquo','”':'rdquo','„':'bdquo','†':'dagger','‡':'Dagger','‰':'permil','‹':'lsaquo','›':'rsaquo','€':'euro'};FCKXHtmlEntities.Chars='';for (var e in FCKXHtmlEntities.Entities) FCKXHtmlEntities.Chars+=e;FCKXHtmlEntities.EntitiesRegex=new RegExp('','');FCKXHtmlEntities.EntitiesRegex.compile('['+FCKXHtmlEntities.Chars+']|[^'+FCKXHtmlEntities.Chars+']+','g');FCKXHtmlEntities.GeckoEntitiesMarkerRegex=/#\?-\:/g;
var FCKXHtml=new Object();FCKXHtml.EmptyElementsRegex=/^(?:BASE|META|LINK|HR|BR|PARAM|IMG|AREA|INPUT)$/i;FCKXHtml.GetXHTML=function(node){if (window.ActiveXObject) this.XML=new ActiveXObject('Msxml2.DOMDocument');else this.XML=document.implementation.createDocument('','',null);this.MainNode=this.XML.appendChild(this.XML.createElement('xhtml'));this._AppendChildNodes(this.MainNode,node);var sXHTML=FCKBrowserInfo.IsIE?this.MainNode.xml:FCKXHtml._GetGeckoNodeXml(this.MainNode);if (FCKConfig.ForceSimpleAmpersand) sXHTML=sXHTML.replace(/___FCKAmp___/g,'&');return sXHTML.substr(7,sXHTML.length-15);};FCKXHtml._GetGeckoNodeXml=function(node){var oSerializer=new XMLSerializer();return oSerializer.serializeToString(node).replace(FCKXHtmlEntities.GeckoEntitiesMarkerRegex,'&');};FCKXHtml._AppendAttribute=function(xmlNode,attributeName,attributeValue){if (FCKBrowserInfo.IsGecko&&attributeName.indexOf('_moz')==0) return;var oXmlAtt=this.XML.createAttribute(attributeName);if (attributeValue===true) oXmlAtt.value=attributeName;else oXmlAtt.value=attributeValue;xmlNode.attributes.setNamedItem(oXmlAtt);};FCKXHtml._AppendChildNodes=function(xmlNode,htmlNode){var oChildren=htmlNode.childNodes;var i=0;while (i<oChildren.length){i+=this._AppendNode(xmlNode,oChildren[i]);};if (i==0&&!this.EmptyElementsRegex.test(htmlNode.nodeName)) xmlNode.appendChild(this.XML.createTextNode(''));};FCKXHtml._AppendNode=function(xmlNode,htmlNode){var iAddedNodes=1;switch (htmlNode.nodeType){case 1:if (FCKBrowserInfo.IsGecko&&htmlNode.hasAttribute('_moz_editor_bogus_node')) return;var sNodeName=htmlNode.nodeName.toLowerCase();if (sNodeName.substr(0,1)=='/') break;var oNode=this.XML.createElement(sNodeName);var oAttributes=htmlNode.attributes;for (var n=0;n<oAttributes.length;n++){var oAttribute=oAttributes[n];if (oAttribute.specified){var sAttName=oAttribute.nodeName.toLowerCase();if (FCKBrowserInfo.IsIE&&sAttName=='style') var sAttValue=htmlNode.style.cssText;else if (sAttName=='class'||(FCKBrowserInfo.IsIE&&sAttName.indexOf('on')==0)) var sAttValue=oAttribute.nodeValue;else var sAttValue=htmlNode.getAttribute(sAttName,2);if (FCKConfig.ForceSimpleAmpersand&&sAttValue.replace) sAttValue=sAttValue.replace(/&/g,'___FCKAmp___');this._AppendAttribute(oNode,sAttName,sAttValue);};};var bProcessChild=true;switch (sNodeName){case "img":if (!oNode.attributes.getNamedItem('alt')) this._AppendAttribute(oNode,'alt','');bProcessChild=false;break;case "font":if (FCKBrowserInfo.IsIE&&oNode.attributes.length==0) oNode=this.XML.createDocumentFragment();break;case "input":if (FCKBrowserInfo.IsIE&&htmlNode.value&&!oNode.attributes.getNamedItem('value')) this._AppendAttribute(oNode,'value',htmlNode.value);bProcessChild=false;break;case "abbr":if (FCKBrowserInfo.IsIE){var oNextNode=htmlNode.nextSibling;while (true){iAddedNodes++;if (oNextNode&&oNextNode.nodeName!='/ABBR'){this._AppendNode(oNode,oNextNode);oNextNode=oNextNode.nextSibling;}else break;};bProcessChild=false;};break;case "area":if (FCKBrowserInfo.IsIE&&!oNode.attributes.getNamedItem('coords')){var sCoords=htmlNode.getAttribute('coords',2);if (sCoords&&sCoords!='0,0,0') this._AppendAttribute(oNode,'coords',sCoords);};break;case "script":if (!oNode.attributes.getNamedItem('type')) this._AppendAttribute(oNode,'type','text/javascript');oNode.appendChild(this.XML.createTextNode('\n'+htmlNode.text.trim()+'\n'));bProcessChild=false;break;case "style":if (!oNode.attributes.getNamedItem('type')) this._AppendAttribute(oNode,'type','text/css');oNode.appendChild(this.XML.createTextNode('\n'+htmlNode.innerHTML.trim()+'\n'));bProcessChild=false;break;};if (bProcessChild) this._AppendChildNodes(oNode,htmlNode);xmlNode.appendChild(oNode);break;case 3:var asPieces=htmlNode.nodeValue.match(FCKXHtmlEntities.EntitiesRegex);if (asPieces){for (var i=0;i<asPieces.length;i++){if (asPieces[i].length==1){var sEntity=FCKXHtmlEntities.Entities[asPieces[i]];if (sEntity!=null){if (FCKBrowserInfo.IsIE) var oEnt=this.XML.createEntityReference(sEntity);else var oEnt=this.XML.createTextNode('#?-:'+sEntity+';');xmlNode.appendChild(oEnt);continue;};};xmlNode.appendChild(this.XML.createTextNode(asPieces[i]));};};break;case 8:xmlNode.appendChild(this.XML.createComment(htmlNode.nodeValue));break;default:xmlNode.appendChild(this.XML.createComment("Element not supported - Type: "+htmlNode.nodeType+" Name: "+htmlNode.nodeName));break;};return iAddedNodes;}
FCK.Events=new FCKEvents(FCK);FCK.Toolbar=null;FCK.StartEditor=function(){this.EditorWindow=window.frames['eEditorArea'];this.EditorDocument=this.EditorWindow.document;this.SetHTML(FCKTools.GetLinkedFieldValue());FCKTools.AppendStyleSheet(this.EditorDocument,FCKConfig.EditorAreaCSS);FCKTools.AttachToLinkedFieldFormSubmit(this.UpdateLinkedField);this.InitializeBehaviors();};FCK.SetStatus=function(newStatus){this.Status=newStatus;if (newStatus==FCK_STATUS_ACTIVE){window.onfocus=window.document.body.onfocus=FCK.Focus;if (FCKConfig.StartupFocus) FCK.Focus();if (FCKBrowserInfo.IsIE) FCKScriptLoader.AddScript('js/fckeditorcode_ie_2.js');else FCKScriptLoader.AddScript('js/fckeditorcode_gecko_2.js');};this.Events.FireEvent('OnStatusChange',newStatus);if (this.OnStatusChange) this.OnStatusChange(newStatus);};FCK.GetHTML=function(){if (FCK.EditMode==FCK_EDITMODE_WYSIWYG){return this.EditorDocument.body.innerHTML;}else return document.getElementById('eSourceField').value;};FCK.GetXHTML=function(){var bSource=(FCK.EditMode==FCK_EDITMODE_SOURCE);if (bSource) this.SwitchEditMode();var sXHTML=FCKXHtml.GetXHTML(this.EditorDocument.body);if (bSource) this.SwitchEditMode();return sXHTML;};FCK.UpdateLinkedField=function(){if (FCKConfig.EnableXHTML) FCKTools.SetLinkedFieldValue(FCK.GetXHTML());else FCKTools.SetLinkedFieldValue(FCK.GetHTML());};FCK.ShowContextMenu=function(x,y){if (this.Status!=FCK_STATUS_COMPLETE) return;FCKContextMenu.Show(x,y);this.Events.FireEvent("OnContextMenu");};
FCK.Description="FCKeditor for Gecko Browsers";FCK.InitializeBehaviors=function(){var oOnContextMenu=function(e){e.preventDefault();FCK.ShowContextMenu(e.clientX,e.clientY);};this.EditorDocument.addEventListener('contextmenu',oOnContextMenu,true);var oOnKeyDown=function(e){if (e.ctrlKey&&!e.shiftKey&&!e.altKey){if (e.which==86||e.which==118){if (FCK.Status==FCK_STATUS_COMPLETE){if (!FCK.Events.FireEvent("OnPaste")) e.preventDefault();}else e.preventDefault();};};};this.EditorDocument.addEventListener('keydown',oOnKeyDown,true);var oOnSelectionChange=function(e){FCK.Events.FireEvent("OnSelectionChange");};this.EditorDocument.addEventListener('mouseup',oOnSelectionChange,false);this.EditorDocument.addEventListener('keyup',oOnSelectionChange,false);this.MakeEditable();this.SetStatus(FCK_STATUS_ACTIVE);};FCK.MakeEditable=function(){this.EditorDocument.designMode='on';this.EditorDocument.execCommand('useCSS',false,!FCKConfig.GeckoUseSPAN);};FCK.Focus=function(){try{FCK.EditorWindow.focus();}catch(e) {};};FCK.SetHTML=function(html,forceWYSIWYG){if (forceWYSIWYG||FCK.EditMode==FCK_EDITMODE_WYSIWYG){FCK.EditorDocument.body.innerHTML=html;}else document.getElementById('eSourceField').value=html;};