var spellURL="spellchecker";var showCompleteAlert=true;var tagGroup=new Array("INPUT","TEXTAREA","DIV","SPAN");var checkElements=new Array();function getText(index){var oElement=document.getElementById(checkElements[index]);var sText="";if(oElement.contentWindow){var editor_detect=oElement.contentWindow.document.getElementById("htmlTextEditor");if(editor_detect){sText=editor_detect.value;return sText}else{sText=oElement.contentWindow.document.body.innerHTML;return sText}}switch(oElement.tagName){case"INPUT":case"TEXTAREA":sText=oElement.value;break;case"DIV":case"SPAN":case"BODY":sText=oElement.innerHTML;break;case"IFRAME":var oFrame=eval(oElement.id);sText=oFrame.document.body.innerHTML}return sText}function replaceChars(a){out="@";add="'@'";temp=""+a;while(temp.indexOf(out)>-1){pos=temp.indexOf(out);temp=""+(temp.substring(0,pos)+add+temp.substring((pos+out.length),temp.length));return temp}}function setEditorText(index,text){var oElement=document.getElementById(checkElements[index]);if(oElement.contentWindow){var editor_detect=oElement.contentWindow.document.getElementById("htmlTextEditor");if(editor_detect){editor_detect.value=text;return}else{oElement.contentWindow.document.body.innerHTML=text;return}}switch(oElement.tagName){case"INPUT":case"TEXTAREA":oElement.value=text;break;case"DIV":case"SPAN":oElement.innerHTML=text;break;case"IFRAME":var oFrame=eval(oElement.id);oFrame.document.body.innerHTML=text;break}}function checkSpelling(){checkElements=new Array();for(var c=0;c<tagGroup.length;c++){var b=tagGroup[c];var d=document.getElementsByTagName(b);for(var a=0;a<d.length;a++){if((b=="INPUT"&&d[a].type=="text")||b=="TEXTAREA"){checkElements[checkElements.length]=d[a].id}else{if((b=="DIV"||b=="SPAN")&&d[a].isContentEditable){checkElements[checkElements.length]=d[a].id}}}}openSpellChecker()}function checkSpellingById(b,c,a){checkElements=new Array();if(a){checkElements[checkElements.length]=b}else{checkElements[checkElements.length]=c}openSpellChecker()}function checkElementSpelling(a){checkElements=new Array();checkElements[checkElements.length]=a.id;openSpellChecker()}function openSpellChecker(){var a=400,e=300;if(document.all){a=document.body.clientWidth;e=document.body.clientHeight}else{if(document.layers){a=window.innerWidth;e=window.innerHeight}}var d=400,g=300;var c=(a-d)/2;var b=(e-g)/2;var f=window.open(spellURL,"newWindow","width="+d+",height="+g+",top="+b+",left="+c+",scrollbars=no,resizable=no,toolbars=no,status=no,menubar=no,location=no")}var iElementIndex=-1;var parentWindow;function initialize(){iElementIndex=parseInt(document.getElementById("ElementIndex").value,10);if(parent.window.dialogArguments){parentWindow=parent.window.dialogArguments}else{if(top.opener){parentWindow=top.opener}else{parentWindow=window.opener}}var a=document.getElementById("SpellMode").value;switch(a){case"start":break;case"suggest":updateText();break;case"end":updateText();default:if(loadText()){document.SpellingForm.submit()}else{endCheck()}break}}function loadText(){if(!parentWindow.document){return false}for(++iElementIndex;iElementIndex<parentWindow.checkElements.length;iElementIndex++){var a=parentWindow.getText(iElementIndex);if(a.length>0){updateSettings(a,0,iElementIndex,"start");document.getElementById("StatusText").innerText="Spell Checking Text ...";return true}}return false}function updateSettings(c,a,b,d){document.getElementById("CurrentText").value=c;document.getElementById("WordIndex").value=a;document.getElementById("ElementIndex").value=b;document.getElementById("SpellMode").value=d}function updateText(){if(!parentWindow.document){return false}var a=document.getElementById("CurrentText").value;parentWindow.setEditorText(iElementIndex,a)}function endCheck(){if(showCompleteAlert){alert("Spell Check Complete")}closeWindow()}function closeWindow(){if(top.opener||parent.window.dialogArguments){self.close()}}function changeWord(b){var a=b.selectedIndex;b.form.ReplacementWord.value=b.options[a].value};