function spellChecker(_1){this.popUpUrl="/forums/speller/spellchecker.html";this.popUpName="spellchecker";this.popUpProps="menu=no,width=440,height=350,top=70,left=120,resizable=yes,status=yes";this.spellCheckScript="/forums/speller/server-scripts/spellchecker.php";this.replWordFlag="R";this.ignrWordFlag="I";this.replAllFlag="RA";this.ignrAllFlag="IA";this.fromReplAll="~RA";this.fromIgnrAll="~IA";this.wordFlags=new Array();this.currentTextIndex=0;this.currentWordIndex=0;this.spellCheckerWin=null;this.controlWin=null;this.wordWin=null;this.textArea=_1;this.textInputs=arguments;this._spellcheck=_spellcheck;this._getSuggestions=_getSuggestions;this._setAsIgnored=_setAsIgnored;this._getTotalReplaced=_getTotalReplaced;this._setWordText=_setWordText;this._getFormInputs=_getFormInputs;this.openChecker=openChecker;this.startCheck=startCheck;this.checkTextBoxes=checkTextBoxes;this.checkTextAreas=checkTextAreas;this.spellCheckAll=spellCheckAll;this.ignoreWord=ignoreWord;this.ignoreAll=ignoreAll;this.replaceWord=replaceWord;this.replaceAll=replaceAll;this.terminateSpell=terminateSpell;this.undo=undo;window.speller=this;}function checkTextBoxes(){this.textInputs=this._getFormInputs("^text$");this.openChecker();}function checkTextAreas(){this.textInputs=this._getFormInputs("^textarea$");this.openChecker();}function spellCheckAll(){this.textInputs=this._getFormInputs("^text(area)?$");this.openChecker();}function openChecker(){this.spellCheckerWin=window.open(this.popUpUrl,this.popUpName,this.popUpProps);if(!this.spellCheckerWin.opener){this.spellCheckerWin.opener=window;}}function startCheck(_2,_3){this.wordWin=_2;this.controlWin=_3;this.wordWin.resetForm();this.controlWin.resetForm();this.currentTextIndex=0;this.currentWordIndex=0;this.wordFlags=new Array(this.wordWin.textInputs.length);for(var i=0;i<this.wordFlags.length;i++){this.wordFlags[i]=[];}this._spellcheck();return true;}function ignoreWord(){var wi=this.currentWordIndex;var ti=this.currentTextIndex;if(!this.wordWin){alert("Error: Word frame not available.");return false;}if(!this.wordWin.getTextVal(ti,wi)){alert("Error: \"Not in dictionary\" text is missing.");return false;}if(this._setAsIgnored(ti,wi,this.ignrWordFlag)){this.currentWordIndex++;this._spellcheck();}}function ignoreAll(){var wi=this.currentWordIndex;var ti=this.currentTextIndex;if(!this.wordWin){alert("Error: Word frame not available.");return false;}var _9=this.wordWin.getTextVal(ti,wi);if(!_9){alert("Error: \"Not in dictionary\" text is missing");return false;}this._setAsIgnored(ti,wi,this.ignrAllFlag);for(var i=ti;i<this.wordWin.textInputs.length;i++){for(var j=0;j<this.wordWin.totalWords(i);j++){if((i==ti&&j>wi)||i>ti){if((this.wordWin.getTextVal(i,j)==_9)&&(!this.wordFlags[i][j])){this._setAsIgnored(i,j,this.fromIgnrAll);}}}}this.currentWordIndex++;this._spellcheck();}function replaceWord(){var wi=this.currentWordIndex;var ti=this.currentTextIndex;if(!this.wordWin){alert("Error: Word frame not available.");return false;}if(!this.wordWin.getTextVal(ti,wi)){alert("Error: \"Not in dictionary\" text is missing");return false;}if(!this.controlWin.replacementText){return;}var _e=this.controlWin.replacementText;if(_e.value){var _f=new String(_e.value);if(this._setWordText(ti,wi,_f,this.replWordFlag)){this.currentWordIndex++;this._spellcheck();}}}function replaceAll(){var ti=this.currentTextIndex;var wi=this.currentWordIndex;if(!this.wordWin){alert("Error: Word frame not available.");return false;}var _12=this.wordWin.getTextVal(ti,wi);if(!_12){alert("Error: \"Not in dictionary\" text is missing");return false;}var txt=this.controlWin.replacementText;if(!txt.value){return;}var _14=new String(txt.value);this._setWordText(ti,wi,_14,this.replAllFlag);for(var i=ti;i<this.wordWin.textInputs.length;i++){for(var j=0;j<this.wordWin.totalWords(i);j++){if((i==ti&&j>wi)||i>ti){if((this.wordWin.getTextVal(i,j)==_12)&&(!this.wordFlags[i][j])){this._setWordText(i,j,_14,this.fromReplAll);}}}}this.currentWordIndex++;this._spellcheck();}function terminateSpell(){var msg="Spell check complete:\n\n";var _18=this._getTotalReplaced();if(_18==0){if(!this.wordWin){msg="";}else{if(this.wordWin.totalMisspellings()){msg+="No words changed.";}else{msg+="No misspellings found.";}}}else{if(_18==1){msg+="One word changed.";}else{msg+=_18+" words changed.";}}if(msg){msg+="\n";alert(msg);}if(_18>0){for(var i=0;i<this.textInputs.length;i++){if(this.wordWin){if(this.wordWin.textInputs[i]){this.textInputs[i].value=this.wordWin.textInputs[i];}}}}this.spellCheckerWin.close();return true;}function undo(){var ti=this.currentTextIndex;var wi=this.currentWordIndex;if(this.wordWin.totalPreviousWords(ti,wi)>0){this.wordWin.removeFocus(ti,wi);do{if(this.currentWordIndex==0&&this.currentTextIndex>0){this.currentTextIndex--;this.currentWordIndex=this.wordWin.totalWords(this.currentTextIndex)-1;if(this.currentWordIndex<0){this.currentWordIndex=0;}}else{if(this.currentWordIndex>0){this.currentWordIndex--;}}}while(this.wordWin.totalWords(this.currentTextIndex)==0||this.wordFlags[this.currentTextIndex][this.currentWordIndex]==this.fromIgnrAll||this.wordFlags[this.currentTextIndex][this.currentWordIndex]==this.fromReplAll);var _1c=this.currentTextIndex;var idx=this.currentWordIndex;var _1e=this.wordWin.originalSpellings[_1c][idx];if(this.wordWin.totalPreviousWords(_1c,idx)==0){this.controlWin.disableUndo();}switch(this.wordFlags[_1c][idx]){case this.replAllFlag:for(var i=_1c;i<this.wordWin.textInputs.length;i++){for(var j=0;j<this.wordWin.totalWords(i);j++){if((i==_1c&&j>=idx)||i>_1c){var _21=this.wordWin.originalSpellings[i][j];if(_21==_1e){this._setWordText(i,j,_21,undefined);}}}}break;case this.ignrAllFlag:for(var i=_1c;i<this.wordWin.textInputs.length;i++){for(var j=0;j<this.wordWin.totalWords(i);j++){if((i==_1c&&j>=idx)||i>_1c){var _21=this.wordWin.originalSpellings[i][j];if(_21==_1e){this.wordFlags[i][j]=undefined;}}}}break;case this.replWordFlag:this._setWordText(_1c,idx,_1e,undefined);break;}this.wordFlags[_1c][idx]=undefined;this._spellcheck();}}function _spellcheck(){var ww=this.wordWin;if(this.currentWordIndex==ww.totalWords(this.currentTextIndex)){this.currentTextIndex++;this.currentWordIndex=0;if(this.currentTextIndex<this.wordWin.textInputs.length){this._spellcheck();return;}else{this.terminateSpell();return;}}if(this.currentWordIndex>0){this.controlWin.enableUndo();}if(this.wordFlags[this.currentTextIndex][this.currentWordIndex]){this.currentWordIndex++;this._spellcheck();}else{var _23=ww.getTextVal(this.currentTextIndex,this.currentWordIndex);if(_23){this.controlWin.evaluatedText.value=_23;ww.setFocus(this.currentTextIndex,this.currentWordIndex);this._getSuggestions(this.currentTextIndex,this.currentWordIndex);}}}function _getSuggestions(_24,_25){this.controlWin.clearSuggestions();var _26=this.wordWin.suggestions[_24][_25];if(_26){for(var ii=0;ii<_26.length;ii++){this.controlWin.addSuggestion(_26[ii]);}}this.controlWin.selectDefaultSuggestion();}function _setAsIgnored(_28,_29,_2a){this.wordWin.removeFocus(_28,_29);this.wordFlags[_28][_29]=_2a;return true;}function _getTotalReplaced(){var _2b=0;for(var i=0;i<this.wordFlags.length;i++){for(var j=0;j<this.wordFlags[i].length;j++){if((this.wordFlags[i][j]==this.replWordFlag)||(this.wordFlags[i][j]==this.replAllFlag)||(this.wordFlags[i][j]==this.fromReplAll)){_2b++;}}}return _2b;}function _setWordText(_2e,_2f,_30,_31){this.wordWin.setText(_2e,_2f,_30);this.wordFlags[_2e][_2f]=_31;return true;}function _getFormInputs(_32){var _33=new Array();for(var i=0;i<document.forms.length;i++){for(var j=0;j<document.forms[i].elements.length;j++){if(document.forms[i].elements[j].type.match(_32)){_33[_33.length]=document.forms[i].elements[j];}}}return _33;}