var ie=(document.all)?1:0;var ns=(navigator.userAgent.indexOf("compatible")>=-1)?1:0;function spellCheck(formName,fieldName,editmode){var h_spellform=document.forms["spell_form"];h_spellform.spell_formname.value=formName;h_spellform.spell_fieldname.value=fieldName;if(document.getElementById(fieldName+"_iframe")==undefined){h_spellform.spellstring.value=document.forms[formName]["message"].value}else{var iframe=document.getElementById(fieldName+"_iframe");var iframedoc=iframe.contentWindow.document;var oHtml=iframedoc.body;h_spellform.spellstring.value=oHtml.innerHTML}openSpellWin(640,480);h_spellform.submit();return true}var wordindex=-1;var offsetindex=0;var ignoredWords=Array();function misp(word,start,end,suggestions){this.word=word;this.start=start;this.end=end;this.suggestions=suggestions}function replaceWord(){var frm=document.fm1;var strstart="";var strend;if(misps[wordindex].start!=0){strstart=mispstr.slice(0,misps[wordindex].start+offsetindex)}strend=mispstr.slice(misps[wordindex].end+1+offsetindex);mispstr=strstart+frm.changeto.value+strend;offsetindex+=frm.changeto.value.length-misps[wordindex].word.length;misps[wordindex].word=frm.changeto.value;nextWord(false)}function thesarusWord(){var frm=document.fm1;window.open("http://www.m-w.com/cgi-bin/thesaurus?book=Thesaurus&va="+frm.changeto.value,"dictionary","width=650,resizable=yes,scrollbars=yes,height=500")}function lookupWord(){var frm=document.fm1;window.open("http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va="+frm.changeto.value,"dictionary","width=650,resizable=yes,scrollbars=yes,height=500")}function Get_Cookie(sName){var aCookie=document.cookie;if(aCookie==null){return(null)}aCookie=aCookie.split("; ");for(var i=0;i<aCookie.length;i++){var aCrumb=aCookie[i].split("=");if(sName==aCrumb[0]){return unescape(aCrumb[1])}}return null}function Set_Cookie(Cookie_Name,Cookie_Value){var Expires=new Date();Expires.setDate(Expires.getDate()+365);var NewCookie=Cookie_Name+"="+escape(Cookie_Value)+"; expires="+Expires.toGMTString()+";";document.cookie=NewCookie}function learnWord(){Word=misps[wordindex].word;Cookie=Get_Cookie("vbspell_words");if(Cookie==null){Cookie=Word}else{Cookie=Cookie+","+Word}Set_Cookie("vbspell_words",Cookie);nextWord(true)}function exitWord(){window.close()}function doneWord(){var frm=document.fm1;var sug=document.fm1.suggestions;var sugidx=0;var newopt;var isselected=0;iFrameBody.innerHTML=mispstr;if(window.opener.document.getElementById(spell_fieldname+"_iframe")==undefined){iFrameBody.innerHTML=iFrameBody.innerHTML.replace(/_\|_/g,"<br>")}else{iFrameBody.innerHTML=iFrameBody.innerHTML.replace(/_\|_/g," ")}clearBox(sug);frm.change.disabled=true;frm.changeall.disabled=true;frm.ignore.disabled=true;frm.ignoreall.disabled=true;mispstr=mispstr.replace(/_\|_/g,"\n");if(window.opener.document.getElementById(spell_fieldname+"_iframe")==undefined){if(window.opener.document.getElementById(spell_fieldname+"_textarea").innerHTML==""){window.opener.document.forms[spell_formname]["message"].value=mispstr}else{var oHtml=window.opener.document.getElementById(spell_fieldname+"_textarea");oHtml.innerHTML=mispstr;window.opener.document.forms[spell_formname]["message"].value=mispstr}}else{var iframe=window.opener.document.getElementById(spell_fieldname+"_iframe");var iframedoc=iframe.contentWindow.document;var oHtml=iframedoc.body;oHtml.innerHTML=mispstr}window.close();return true}function replaceAll(){var frm=document.fm1;var strstart="";var strend;var idx;var origword;var localoffsetindex=offsetindex;origword=misps[wordindex].word;for(idx=wordindex;idx<misps.length;idx++){misps[idx].start+=localoffsetindex;misps[idx].end+=localoffsetindex}localoffsetindex=0;for(idx=0;idx<misps.length;idx++){if(misps[idx].word==origword){if(misps[idx].start!=0){strstart=mispstr.slice(0,misps[idx].start+localoffsetindex)}strend=mispstr.slice(misps[idx].end+1+localoffsetindex);mispstr=strstart+frm.changeto.value+strend;localoffsetindex+=frm.changeto.value.length-misps[idx].word.length}misps[idx].start+=localoffsetindex;misps[idx].end+=localoffsetindex}ignoredWords[origword]=1;offsetindex=0;nextWord(false)}function hilightWord(){var strstart="";var strend;if(misps[wordindex].start!=0){strstart=mispstr.slice(0,misps[wordindex].start+offsetindex)}strend=mispstr.slice(misps[wordindex].end+1+offsetindex);var divptr=iFrameBody;divptr.innerHTML="";divptr.innerHTML=strstart;divptr.innerHTML+="<a name='comehere'> </a=> <span class='highlight' id='h1' name='hl'> "+misps[wordindex].word+" </span>"+htmlToText(strend);if(window.opener.document.getElementById(spell_fieldname+"_iframe")==undefined){divptr.innerHTML=divptr.innerHTML.replace(/_\|_/g,"<br>")}else{divptr.innerHTML=divptr.innerHTML.replace(/_\|_/g," ")}}function startsp(){nextWord(false)}function getCorrectedText(){return mispstr}function nextWord(ignoreall){var frm=document.fm1;var sug=document.fm1.suggestions;var sugidx=0;var newopt;var isselected=0;if(ignoreall){ignoredWords[misps[wordindex].word]=1}if(wordindex>=0){misps[wordindex].start+=offsetindex;misps[wordindex].end+=offsetindex}wordindex++;if(misps.length<=wordindex){iFrameBody.innerHTML=mispstr;if(window.opener.document.getElementById(spell_fieldname+"_iframe")==undefined){iFrameBody.innerHTML=iFrameBody.innerHTML.replace(/_\|_/g,"<br>")}else{iFrameBody.innerHTML=iFrameBody.innerHTML.replace(/_\|_/g," ")}clearBox(sug);alert("Spell checking complete.");frm.change.disabled=true;frm.changeall.disabled=true;frm.ignore.disabled=true;frm.ignoreall.disabled=true;mispstr=mispstr.replace(/_\|_/g,"\n");if(window.opener.document.getElementById(spell_fieldname+"_iframe")==undefined){if(window.opener.document.getElementById(spell_fieldname+"_textarea").innerHTML==""){window.opener.document.forms[spell_formname]["message"].value=mispstr}else{var oHtml=window.opener.document.getElementById(spell_fieldname+"_textarea");oHtml.innerHTML=mispstr;window.opener.document.forms[spell_formname]["message"].value=mispstr}}else{var iframe=window.opener.document.getElementById(spell_fieldname+"_iframe");var iframedoc=iframe.contentWindow.document;var oHtml=iframedoc.body;oHtml.innerHTML=mispstr}window.close();return true}if(ignoredWords[misps[wordindex].word]==1){nextWord(false);return }clearBox(sug);if(misps[wordindex].suggestions.length){for(sugidx=0;sugidx<misps[wordindex].suggestions.length;sugidx++){if(sugidx==0){isselected=1}else{isselected=0}newopt=new Option(misps[wordindex].suggestions[sugidx],misps[wordindex].suggestions[sugidx],0,isselected);sug.options[sugidx]=newopt;if(isselected){frm.changeto.value=misps[wordindex].suggestions[sugidx];frm.changeto.select()}}}else{frm.changeto.value="";frm.changeto.select()}hilightWord();parent.spellbox.document.getElementById("h1").scrollIntoView(ns)}function htmlToText(thetext){return thetext;var re=/\</g;var re2=/\>/g;var re3=/\n/g;var re4=/\ /g;thetext=thetext.replace(re,"&lt;");thetext=thetext.replace(re2,"&gt;");thetext=thetext.replace(re3,"<br>");thetext=thetext.replace(re4,"&nbsp;");return thetext}function clearBox(box){var length=box.length;for(i=0;i<length;i++){box.options[0]=null}}function openSpellWin(wx,hx){window.open("","spellWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=665,height="+hx);window.focus}