//crunchinatorvariable_compressed
function fRunExec(oDoc,sCommand,bInterface,vValue){fDebugPoint('fRunExec','Executing command '+sCommand);var oRange=oDoc.selection.createRange();if(!fRangeInEditor(oRange,oDoc))return false;fDocChange();return oDoc.execCommand(sCommand,bInterface,vValue);}function fFormatSelection(oDoc,sTag){fDebugPoint('fFormatSelection','Formatting with tag '+sTag);if(!fRunExec(oDoc,sTag))return false;fSetFormatButtons(oDoc,window);fSetMenuMarkers(oDoc);return true;}function fStyleFormat(oDoc,sAttr,sValue){fDebugPoint('fStyleFormat','Setting '+sAttr+' to '+sValue);fDocChange();if(oDoc.selection.type!='Control')return false;var oRange=oDoc.selection.createRange();if(!fRangeInEditor(oRange,oDoc))return false;for(var i=0;i<oRange.item.length;i++)oRange.item(i).style.setAttribute(sAttr,sValue);return true;}function fStartFormat(oDoc,oButton){fDebugPoint('fStartFormat','Starting formatting');if(oButton.formatTag)fFormatSelection(oDoc,oButton.formatTag);if((oButton.styleAttr)&&(oButton.styleDef))fStyleSelection(oDoc,oButton.styleAttr,oButton.styleDef);}function fChangeButtonAttributes(oButton,sState,sID){fDebugPoint('fChangeButtonAttributes','changing attribute of button '+oButton.id+' to '+sState);if(oButton)fAnimateButton(oButton,sState);oButton.id=sID;}function fSetFormatButtons(oRange){fDebugPoint('fSetFormatButtons','setting format buttons');var aAllFormatButtons=new Array();if(document.all.formatButtonDown)aAllFormatButtons.addStuff(document.all.formatButtonDown);if(document.oForm.formatButton)aAllFormatButtons.addStuff(document.oForm.formatButton);for(var i=0;i<aPallets.length;i++){if(aPallets[i].document.all.formatButtonDown)aAllFormatButtons.addStuff(aPallets[i].document.all.formatButtonDown);if(aPallets[i].document.all.formatButton)aAllFormatButtons.addStuff(aPallets[i].document.all.formatButton);}if(aAllFormatButtons.length==0)return;for(var i=0;i<aAllFormatButtons.length;i++){if(aAllFormatButtons[i]==null)continue;if(aAllFormatButtons[i].formatTag){if(oRange.queryCommandState(aAllFormatButtons[i].formatTag)){if(aAllFormatButtons[i].id=='formatButton')fChangeButtonAttributes(aAllFormatButtons[i],'over','formatButtonDown');}else{if(aAllFormatButtons[i].id=='formatButtonDown')fChangeButtonAttributes(aAllFormatButtons[i],'inert','formatButton');}}}}function fSetStyleSelector(oRange,oDocument){var sCommandValue=oRange.queryCommandValue('FormatBlock');fDebugPoint('fSetStyleSelector','Setting for '+sCommandValue);var aSelectors=new Array();if(document.oForm.selectStyle)aSelectors[aSelectors.length]=document.oForm.selectStyle;for(var i=0;i<aPallets.length;i++)if(aPallets[i].document.all.selectStyle)aSelectors[aSelectors.length]=aPallets[i].document.all.selectStyle;for(var j=0;j<aSelectors.length;j++){aSelectors[j].selectedIndex=0;for(var i=0;i<aSelectors[j].options.length;i++){if(sCommandValue==aSelectors[j].options[i].value){aSelectors[j].selectedIndex=i;continue;}}}}function fSetFormatElements(oDocument){fDebugPoint('fSetFormatElements','setting format elements');var oRange=oDocument.selection.createRange();var sType=oDocument.selection.type;fSetFormatButtons(oRange);fSetMenuMarkers(oRange);fSetStyleSelector(oRange,oDocument);fSetHref(oDocument);return;}function fSetParagraphStyle(oDoc,sStyle){fDebugPoint('fSetParagraphStyle','Setting style '+sStyle);if(!fRunExec(oDoc,'FormatBlock',null,sStyle))return false;fSetFormatButtons(oDoc,window);return true;}function fSetForeColor(oDoc,oButton){var oSourceRange=oButton.createTextRange();var sColorDef=oSourceRange.queryCommandValue('ForeColor');fDebugPoint('fSetForeColor','Setting color '+sColorDef);if(!fRunExec(oDoc,'ForeColor',null,sColorDef))return false;fSetFormatButtons(oDoc,window);return true;}function fSetBackColor(oDoc,oButton){fDebugPoint('fSetBackColor','setting bg color');var oColorDefCell=fParentElement(oButton,'TD');var oTargetRange=oDoc.selection.createRange();if(!fRangeInEditor(oTargetRange,oDoc))return false;var oSourceRange=oButton.createTextRange();var sColorDef=oSourceRange.queryCommandValue('BackColor');var oCurrentCell=fCurrentTableElement('TD');var oCurrentRow=fCurrentTableElement('TR');if((oCurrentCell!=null)&&(oCurrentRow!=null)&&(oCurrentRow.contains(oCurrentCell))&&(oDoc.selection.type=='None')){if((!oButton.hexColorDef)||(oButton.hexColorDef==null))return;oCurrentCell.style.backgroundColor=oButton.hexColorDef;}else oDoc.execCommand('BackColor','',sColorDef);}function fSetupColors(aColors){fDebugPoint('fSetupColors','setting pallet with colors '+aColors.valueOf());var oColorTable=document.all.colorPickerTable;for(var i=0;i<aColors.length;i++){if(fCheckHexValue(aColors[i]))with(oColorTable.insertRow().insertCell().style){height='20px';fDebugPoint('fSetupColors','setting color '+aColors[i]);if(fCheckHexValue(aColors[i]))background=aColors[i];}}fSetPickAttr(oForm.setFontColor,aColors[0]);fSetPickAttr(oForm.setBgColor,aColors[0]);}function fSetPickAttr(oButton,sColor){fDebugPoint('fShowColorLayer','Setting  '+oButton.getAttribute('name')+' '+sColor);var oRange=oButton.createTextRange();oButton.hexColorDef=sColor;if(oButton.dispAttr)oRange.execCommand(oButton.dispAttr,'',sColor);if(oButton.linkedButton)fSetPickAttr(eval('oForm.'+oButton.linkedButton),sColor);}function fPickColor(oEventSrc){var oCell=fParentElement(oEventSrc,'TD');if(oCell==null)return;if(!oForm.activeMenuButton)return;if(!colorPickerTable.contains(oCell))return;var oButton=oForm.activeMenuButton;if((!oButton.attachedMenu)||(oButton.attachedMenu==''))return;if(oButton.attachedMenu!='colorsLayer')return;fSetPickAttr(oButton,oCell.style.background);fHideActiveMenu();}fRegister('formatButtons.js v. 1812020318');
