X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=program%2Fjs%2Fgoogiespell.js;h=3618fe10a3c99e12da6542b720cdfb22995a504e;hb=76507f7c63a660742e76889ad6e3919f3dde3bb0;hp=48e8407fcb7e670e9c630d625c8a5e3d12037dc3;hpb=e8a0682b96f5b7f297e58d101735ba20a0cc3a89;p=roundcube.git
diff --git a/program/js/googiespell.js b/program/js/googiespell.js
index 48e8407..3618fe1 100644
--- a/program/js/googiespell.js
+++ b/program/js/googiespell.js
@@ -1,748 +1,39 @@
-var SPELL_CUR_LANG=null;
-var GOOGIE_DEFAULT_LANG="en";
-function GoogieSpell(_1,_2){
-var _3=this;
-this.array_keys=function(_4){
-var _5=[];
-for(var _6 in _4){
-_5.push([_6]);
-}
-return _5;
-};
-var _7=getCookie("language");
-GOOGIE_CUR_LANG=_7!=null?_7:GOOGIE_DEFAULT_LANG;
-this.img_dir=_1;
-this.server_url=_2;
-this.org_lang_to_word={"da":"Dansk","de":"Deutsch","en":"English","es":"Español","fr":"Français","it":"Italiano","nl":"Nederlands","pl":"Polski","pt":"Português","fi":"Suomi","sv":"Svenska"};
-this.lang_to_word=this.org_lang_to_word;
-this.langlist_codes=this.array_keys(this.lang_to_word);
-this.show_change_lang_pic=true;
-this.change_lang_pic_placement="right";
-this.report_state_change=true;
-this.ta_scroll_top=0;
-this.el_scroll_top=0;
-this.lang_chck_spell="Check spelling";
-this.lang_revert="Revert to";
-this.lang_close="Close";
-this.lang_rsm_edt="Resume editing";
-this.lang_no_error_found="No spelling errors found";
-this.lang_no_suggestions="No suggestions";
-this.show_spell_img=false;
-this.decoration=true;
-this.use_close_btn=true;
-this.edit_layer_dbl_click=true;
-this.report_ta_not_found=true;
-this.custom_ajax_error=null;
-this.custom_no_spelling_error=null;
-this.custom_menu_builder=[];
-this.custom_item_evaulator=null;
-this.extra_menu_items=[];
-this.custom_spellcheck_starter=null;
-this.main_controller=true;
-this.lang_state_observer=null;
-this.spelling_state_observer=null;
-this.show_menu_observer=null;
-this.all_errors_fixed_observer=null;
-this.use_focus=false;
-this.focus_link_t=null;
-this.focus_link_b=null;
-this.cnt_errors=0;
-this.cnt_errors_fixed=0;
-$(document).bind("click",function(e){
-if($(e.target).attr("googie_action_btn")!="1"&&_3.isLangWindowShown()){
-_3.hideLangWindow();
-}
-if($(e.target).attr("googie_action_btn")!="1"&&_3.isErrorWindowShown()){
-_3.hideErrorWindow();
-}
-});
-this.decorateTextarea=function(id){
-this.text_area=typeof (id)=="string"?document.getElementById(id):id;
-if(this.text_area){
-if(!this.spell_container&&this.decoration){
-var _a=document.createElement("table");
-var _b=document.createElement("tbody");
-var tr=document.createElement("tr");
-var _d=document.createElement("td");
-var _e=this.isDefined(this.force_width)?this.force_width:this.text_area.offsetWidth;
-var _f=this.isDefined(this.force_height)?this.force_height:16;
-tr.appendChild(_d);
-_b.appendChild(tr);
-$(_a).append(_b).insertBefore(this.text_area).width("100%").height(_f);
-$(_d).height(_f).width(_e).css("text-align","right");
-this.spell_container=_d;
-}
-this.checkSpellingState();
-}else{
-if(this.report_ta_not_found){
-alert("Text area not found");
-}
-}
-};
-this.setSpellContainer=function(id){
-this.spell_container=typeof (id)=="string"?document.getElementById(id):id;
-};
-this.setLanguages=function(_11){
-this.lang_to_word=_11;
-this.langlist_codes=this.array_keys(_11);
-};
-this.setCurrentLanguage=function(_12){
-GOOGIE_CUR_LANG=_12;
-var now=new Date();
-now.setTime(now.getTime()+365*24*60*60*1000);
-setCookie("language",_12,now);
-};
-this.setForceWidthHeight=function(_14,_15){
-this.force_width=_14;
-this.force_height=_15;
-};
-this.setDecoration=function(_16){
-this.decoration=_16;
-};
-this.dontUseCloseButtons=function(){
-this.use_close_btn=false;
-};
-this.appendNewMenuItem=function(_17,_18,_19){
-this.extra_menu_items.push([_17,_18,_19]);
-};
-this.appendCustomMenuBuilder=function(_1a,_1b){
-this.custom_menu_builder.push([_1a,_1b]);
-};
-this.setFocus=function(){
-try{
-this.focus_link_b.focus();
-this.focus_link_t.focus();
-return true;
-}
-catch(e){
-return false;
-}
-};
-this.setStateChanged=function(_1c){
-this.state=_1c;
-if(this.spelling_state_observer!=null&&this.report_state_change){
-this.spelling_state_observer(_1c,this);
-}
-};
-this.setReportStateChange=function(_1d){
-this.report_state_change=_1d;
-};
-this.getUrl=function(){
-return this.server_url+GOOGIE_CUR_LANG;
-};
-this.escapeSpecial=function(val){
-return val.replace(/&/g,"&").replace(//g,">");
-};
-this.createXMLReq=function(_1f){
-return ""+""+""+_1f+"";
-};
-this.spellCheck=function(_20){
-this.cnt_errors_fixed=0;
-this.cnt_errors=0;
-this.setStateChanged("checking_spell");
-if(this.main_controller){
-this.appendIndicator(this.spell_span);
-}
-this.error_links=[];
-this.ta_scroll_top=this.text_area.scrollTop;
-this.ignore=_20;
-this.hideLangWindow();
-if($(this.text_area).val()==""||_20){
-if(!this.custom_no_spelling_error){
-this.flashNoSpellingErrorState();
-}else{
-this.custom_no_spelling_error(this);
-}
-this.removeIndicator();
-return;
-}
-this.createEditLayer(this.text_area.offsetWidth,this.text_area.offsetHeight);
-this.createErrorWindow();
-$("body").append(this.error_window);
-try{
-netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
-}
-catch(e){
-}
-if(this.main_controller){
-$(this.spell_span).unbind("click");
-}
-this.orginal_text=$(this.text_area).val();
-var _21=this.escapeSpecial(this.orginal_text);
-var ref=this;
-$.ajax({type:"POST",url:this.getUrl(),data:this.createXMLReq(_21),dataType:"text",error:function(o){
-if(ref.custom_ajax_error){
-ref.custom_ajax_error(ref);
-}else{
-alert("An error was encountered on the server. Please try again later.");
-}
-if(ref.main_controller){
-$(ref.spell_span).remove();
-ref.removeIndicator();
-}
-ref.checkSpellingState();
-},success:function(_24){
-var _25=_24;
-ref.results=ref.parseResult(_25);
-if(_25.match(//)!=null){
-ref.showErrorsInIframe();
-ref.resumeEditingState();
-}else{
-if(!ref.custom_no_spelling_error){
-ref.flashNoSpellingErrorState();
-}else{
-ref.custom_no_spelling_error(ref);
-}
-}
-ref.removeIndicator();
-}});
-};
-this.parseResult=function(_26){
-var _27=/\w+="(\d+|true)"/g;
-var _28=/\t/g;
-var _29=_26.match(/]*>[^<]*<\/c>/g);
-var _2a=new Array();
-if(_29==null){
-return _2a;
-}
-for(var i=0;i<_29.length;i++){
-var _2c=new Array();
-this.errorFound();
-_2c["attrs"]=new Array();
-var _2d=_29[i].match(_27);
-for(var j=0;j<_2d.length;j++){
-var _2f=_2d[j].split(/=/);
-var val=_2f[1].replace(/"/g,"");
-_2c["attrs"][_2f[0]]=val!="true"?parseInt(val):val;
-}
-_2c["suggestions"]=new Array();
-var _31=_29[i].replace(/<[^>]*>/g,"");
-var _32=_31.split(_28);
-for(var k=0;k<_32.length;k++){
-if(_32[k]!=""){
-_2c["suggestions"].push(_32[k]);
-}
-}
-_2a.push(_2c);
-}
-return _2a;
-};
-this.createErrorWindow=function(){
-this.error_window=document.createElement("div");
-$(this.error_window).addClass("googie_window").attr("googie_action_btn","1");
-};
-this.isErrorWindowShown=function(){
-return $(this.error_window).is(":visible");
-};
-this.hideErrorWindow=function(){
-$(this.error_window).css("visibility","hidden");
-$(this.error_window_iframe).css("visibility","hidden");
-};
-this.updateOrginalText=function(_34,_35,_36,id){
-var _38=this.orginal_text.substring(0,_34);
-var _39=this.orginal_text.substring(_34+_35.length);
-this.orginal_text=_38+_36+_39;
-$(this.text_area).val(this.orginal_text);
-var _3a=_36.length-_35.length;
-for(var j=0;jid){
-this.results[j]["attrs"]["o"]+=_3a;
-}
-}
-};
-this.saveOldValue=function(elm,_3d){
-elm.is_changed=true;
-elm.old_value=_3d;
-};
-this.createListSeparator=function(){
-var td=document.createElement("td");
-var tr=document.createElement("tr");
-$(td).html(" ").attr("googie_action_btn","1").css({"cursor":"default","font-size":"3px","border-top":"1px solid #ccc","padding-top":"3px"});
-tr.appendChild(td);
-return tr;
-};
-this.correctError=function(id,elm,_42,_43){
-var _44=elm.innerHTML;
-var _45=_42.nodeType==3?_42.nodeValue:_42.innerHTML;
-var _46=this.results[id]["attrs"]["o"];
-if(_43){
-var _47=elm.previousSibling.innerHTML;
-elm.previousSibling.innerHTML=_47.slice(0,_47.length-1);
-_44=" "+_44;
-_46--;
-}
-this.hideErrorWindow();
-this.updateOrginalText(_46,_44,_45,id);
-$(elm).html(_45).css("color","green").attr("is_corrected",true);
-this.results[id]["attrs"]["l"]=_45.length;
-if(!this.isDefined(elm.old_value)){
-this.saveOldValue(elm,_44);
-}
-this.errorFixed();
-};
-this.showErrorWindow=function(elm,id){
-if(this.show_menu_observer){
-this.show_menu_observer(this);
-}
-var ref=this;
-var pos=$(elm).offset();
-pos.top-=this.edit_layer.scrollTop;
-$(this.error_window).css({"visibility":"visible","top":(pos.top+20)+"px","left":(pos.left)+"px"}).html("");
-var _4c=document.createElement("table");
-var _4d=document.createElement("tbody");
-$(_4c).addClass("googie_list").attr("googie_action_btn","1");
-var _4e=false;
-if(this.custom_menu_builder!=[]){
-for(var k=0;k0){
-_4d.appendChild(this.createListSeparator());
-}
-var _63=function(i){
-if(i").css("position","absolute").css("z-index",0);
-$("body").append(_68);
-this.error_window_iframe=_68;
-}
-$(this.error_window_iframe).css({"visibility":"visible","top":this.error_window.offsetTop,"left":this.error_window.offsetLeft,"width":this.error_window.offsetWidth,"height":this.error_window.offsetHeight});
-}
-};
-this.createEditLayer=function(_69,_6a){
-this.edit_layer=document.createElement("div");
-$(this.edit_layer).addClass("googie_edit_layer").width(_69-10).height(_6a);
-if(this.text_area.nodeName.toLowerCase()!="input"||$(this.text_area).val()==""){
-$(this.edit_layer).css("overflow","auto").height(_6a-4);
-}else{
-$(this.edit_layer).css("overflow","hidden");
-}
-var ref=this;
-if(this.edit_layer_dbl_click){
-$(this.edit_layer).bind("click",function(e){
-if(e.target.className!="googie_link"&&!ref.isErrorWindowShown()){
-ref.resumeEditing();
-var fn1=function(){
-$(ref.text_area).focus();
-fn1=null;
-};
-window.setTimeout(fn1,10);
-}
-return false;
-});
-}
-};
-this.resumeEditing=function(){
-this.setStateChanged("ready");
-if(this.edit_layer){
-this.el_scroll_top=this.edit_layer.scrollTop;
-}
-this.hideErrorWindow();
-if(this.main_controller){
-$(this.spell_span).removeClass().addClass("googie_no_style");
-}
-if(!this.ignore){
-if(this.use_focus){
-$(this.focus_link_t).remove();
-$(this.focus_link_b).remove();
-}
-$(this.edit_layer).remove();
-$(this.text_area).show();
-if(this.el_scroll_top!=undefined){
-this.text_area.scrollTop=this.el_scroll_top;
-}
-}
-this.checkSpellingState(false);
-};
-this.createErrorLink=function(_6e,id){
-var elm=document.createElement("span");
-var ref=this;
-var d=function(e){
-ref.showErrorWindow(elm,id);
-d=null;
-return false;
-};
-$(elm).html(_6e).addClass("googie_link").bind("click",d).attr({"googie_action_btn":"1","g_id":id,"is_corrected":false});
-return elm;
-};
-this.createPart=function(_74){
-if(_74==" "){
-return document.createTextNode(" ");
-}
-_74=this.escapeSpecial(_74);
-_74=_74.replace(/\n/g,"
");
-_74=_74.replace(/ /g," ");
-_74=_74.replace(/^ /g," ");
-_74=_74.replace(/ $/g," ");
-var _75=document.createElement("span");
-$(_75).html(_74);
-return _75;
-};
-this.showErrorsInIframe=function(){
-var _76=document.createElement("div");
-var _77=0;
-var _78=this.results;
-if(_78.length>0){
-for(var i=0;i<_78.length;i++){
-var _7a=_78[i]["attrs"]["o"];
-var len=_78[i]["attrs"]["l"];
-var _7c=this.orginal_text.substring(_77,_7a);
-var _7d=this.createPart(_7c);
-_76.appendChild(_7d);
-_77+=_7a-_77;
-var _7e=this.createErrorLink(this.orginal_text.substr(_7a,len),i);
-this.error_links.push(_7e);
-_76.appendChild(_7e);
-_77+=len;
-}
-var _7f=this.orginal_text.substr(_77,this.orginal_text.length);
-var _80=this.createPart(_7f);
-_76.appendChild(_80);
-}else{
-_76.innerHTML=this.orginal_text;
-}
-$(_76).css("text-align","left");
-var me=this;
-if(this.custom_item_evaulator){
-$.map(this.error_links,function(elm){
-me.custom_item_evaulator(me,elm);
-});
-}
-$(this.edit_layer).append(_76);
-$(this.text_area).hide();
-$(this.edit_layer).insertBefore(this.text_area);
-if(this.use_focus){
-this.focus_link_t=this.createFocusLink("focus_t");
-this.focus_link_b=this.createFocusLink("focus_b");
-$(this.focus_link_t).insertBefore(this.edit_layer);
-$(this.focus_link_b).insertAfter(this.edit_layer);
-}
-};
-this.createLangWindow=function(){
-this.language_window=document.createElement("div");
-$(this.language_window).addClass("googie_window").width(100).attr("googie_action_btn","1");
-var _83=document.createElement("table");
-var _84=document.createElement("tbody");
-var ref=this;
-$(_83).addClass("googie_list").width("100%");
-this.lang_elms=new Array();
-for(i=0;i").attr({src:this.img_dir+"change_lang.gif","alt":"Change language","googie_action_btn":"1"});
-var _92=document.createElement("span");
-var ref=this;
-$(_92).addClass("googie_lang_3d_on").append(img).bind("click",function(e){
-var elm=this.tagName.toLowerCase()=="img"?this.parentNode:this;
-if($(elm).hasClass("googie_lang_3d_click")){
-elm.className="googie_lang_3d_on";
-ref.hideLangWindow();
-}else{
-elm.className="googie_lang_3d_click";
-ref.showLangWindow(elm);
-}
-});
-return _92;
-};
-this.createSpellDiv=function(){
-var _96=document.createElement("span");
-$(_96).addClass("googie_check_spelling_link").text(this.lang_chck_spell);
-if(this.show_spell_img){
-$(_96).append(" ").append($("").attr("src",this.img_dir+"spellc.gif"));
-}
-return _96;
-};
-this.flashNoSpellingErrorState=function(_97){
-this.setStateChanged("no_error_found");
-var ref=this;
-if(this.main_controller){
-var _99;
-if(_97){
-var fn=function(){
-_97();
-ref.checkSpellingState();
-};
-_99=fn;
-}else{
-_99=function(){
-ref.checkSpellingState();
-};
-}
-var rsm=$("").text(this.lang_no_error_found);
-$(this.switch_lan_pic).hide();
-$(this.spell_span).empty().append(rsm).removeClass().addClass("googie_check_spelling_ok");
-window.setTimeout(_99,1000);
-}
-};
-this.resumeEditingState=function(){
-this.setStateChanged("resume_editing");
-if(this.main_controller){
-var rsm=$("").text(this.lang_rsm_edt);
-var ref=this;
-$(this.switch_lan_pic).hide();
-$(this.spell_span).empty().unbind().append(rsm).bind("click",function(){
-ref.resumeEditing();
-}).removeClass().addClass("googie_resume_editing");
-}
-try{
-this.edit_layer.scrollTop=this.ta_scroll_top;
-}
-catch(e){
-}
-};
-this.checkSpellingState=function(_9e){
-if(_9e){
-this.setStateChanged("ready");
-}
-if(this.show_change_lang_pic){
-this.switch_lan_pic=this.createChangeLangPic();
-}else{
-this.switch_lan_pic=document.createElement("span");
-}
-var _9f=this.createSpellDiv();
-var ref=this;
-if(this.custom_spellcheck_starter){
-$(_9f).bind("click",function(e){
-ref.custom_spellcheck_starter();
-});
-}else{
-$(_9f).bind("click",function(e){
-ref.spellCheck();
-});
-}
-if(this.main_controller){
-if(this.change_lang_pic_placement=="left"){
-$(this.spell_container).empty().append(this.switch_lan_pic).append(" ").append(_9f);
-}else{
-$(this.spell_container).empty().append(_9f).append(" ").append(this.switch_lan_pic);
-}
-}
-this.spell_span=_9f;
-};
-this.isDefined=function(o){
-return (o!="undefined"&&o!=null);
-};
-this.errorFixed=function(){
-this.cnt_errors_fixed++;
-if(this.all_errors_fixed_observer){
-if(this.cnt_errors_fixed==this.cnt_errors){
-this.hideErrorWindow();
-this.all_errors_fixed_observer();
-}
-}
-};
-this.errorFound=function(){
-this.cnt_errors++;
-};
-this.createCloseButton=function(_a4){
-return this.createButton(this.lang_close,"googie_list_close",_a4);
-};
-this.createButton=function(_a5,_a6,_a7){
-var _a8=document.createElement("tr");
-var btn=document.createElement("td");
-var _aa;
-if(_a6){
-_aa=document.createElement("span");
-$(_aa).addClass(_a6).html(_a5);
-}else{
-_aa=document.createTextNode(_a5);
-}
-$(btn).bind("click",_a7).bind("mouseover",this.item_onmouseover).bind("mouseout",this.item_onmouseout);
-btn.appendChild(_aa);
-_a8.appendChild(btn);
-return _a8;
-};
-this.removeIndicator=function(elm){
-if(window.rcmail){
-rcmail.set_busy(false);
-}
-};
-this.appendIndicator=function(elm){
-if(window.rcmail){
-rcmail.set_busy(true,"checking");
-}
-};
-this.createFocusLink=function(_ad){
-var _ae=document.createElement("a");
-$(_ae).attr({"href":"javascript:;","name":_ad});
-return _ae;
-};
-this.item_onmouseover=function(e){
-if(this.className!="googie_list_revert"&&this.className!="googie_list_close"){
-this.className="googie_list_onhover";
-}else{
-this.parentNode.className="googie_list_onhover";
-}
-};
-this.item_onmouseout=function(e){
-if(this.className!="googie_list_revert"&&this.className!="googie_list_close"){
-this.className="googie_list_onout";
-}else{
-this.parentNode.className="googie_list_onout";
-}
-};
-};
-
+var GOOGIE_CUR_LANG,GOOGIE_DEFAULT_LANG="en";
+function GoogieSpell(s,t,u){var l=this,r=getCookie("language");GOOGIE_CUR_LANG=null!=r?r:GOOGIE_DEFAULT_LANG;this.array_keys=function(a){var b=[],c;for(c in a)b.push([c]);return b};this.img_dir=s;this.server_url=t;this.lang_to_word=this.org_lang_to_word={da:"Dansk",de:"Deutsch",en:"English",es:"Español",fr:"Français",it:"Italiano",nl:"Nederlands",pl:"Polski",pt:"Português",fi:"Suomi",sv:"Svenska"};this.langlist_codes=this.array_keys(this.lang_to_word);this.show_change_lang_pic=!0;this.change_lang_pic_placement=
+"right";this.report_state_change=!0;this.el_scroll_top=this.ta_scroll_top=0;this.lang_chck_spell="Check spelling";this.lang_revert="Revert to";this.lang_close="Close";this.lang_rsm_edt="Resume editing";this.lang_no_error_found="No spelling errors found";this.lang_no_suggestions="No suggestions";this.lang_learn_word="Add to dictionary";this.show_spell_img=!1;this.decoration=!0;this.use_close_btn=!1;this.report_ta_not_found=this.edit_layer_dbl_click=!0;this.custom_no_spelling_error=this.custom_ajax_error=
+null;this.custom_menu_builder=[];this.custom_item_evaulator=null;this.extra_menu_items=[];this.custom_spellcheck_starter=null;this.main_controller=!0;this.has_dictionary=u;this.all_errors_fixed_observer=this.show_menu_observer=this.spelling_state_observer=this.lang_state_observer=null;this.use_focus=!1;this.focus_link_b=this.focus_link_t=null;this.cnt_errors_fixed=this.cnt_errors=0;$(document).bind("click",function(a){a=$(a.target);"1"!=a.attr("googie_action_btn")&&l.isLangWindowShown()&&l.hideLangWindow();
+"1"!=a.attr("googie_action_btn")&&l.isErrorWindowShown()&&l.hideErrorWindow()});this.decorateTextarea=function(a){if(this.text_area="string"===typeof a?document.getElementById(a):a){if(!this.spell_container&&this.decoration){var a=document.createElement("table"),b=document.createElement("tbody"),c=document.createElement("tr"),d=document.createElement("td"),e=this.isDefined(this.force_width)?this.force_width:this.text_area.offsetWidth,f=this.isDefined(this.force_height)?this.force_height:16;c.appendChild(d);
+b.appendChild(c);$(a).append(b).insertBefore(this.text_area).width("100%").height(f);$(d).height(f).width(e).css("text-align","right");this.spell_container=d}this.checkSpellingState()}else this.report_ta_not_found&&alert("Text area not found")};this.setSpellContainer=function(a){this.spell_container="string"===typeof a?document.getElementById(a):a};this.setLanguages=function(a){this.lang_to_word=a;this.langlist_codes=this.array_keys(a)};this.setCurrentLanguage=function(a){GOOGIE_CUR_LANG=a;var b=
+new Date;b.setTime(b.getTime()+31536E6);setCookie("language",a,b)};this.setForceWidthHeight=function(a,b){this.force_width=a;this.force_height=b};this.setDecoration=function(a){this.decoration=a};this.dontUseCloseButtons=function(){this.use_close_btn=!1};this.appendNewMenuItem=function(a,b,c){this.extra_menu_items.push([a,b,c])};this.appendCustomMenuBuilder=function(a,b){this.custom_menu_builder.push([a,b])};this.setFocus=function(){try{return this.focus_link_b.focus(),this.focus_link_t.focus(),!0}catch(a){return!1}};
+this.setStateChanged=function(a){this.state=a;null!=this.spelling_state_observer&&this.report_state_change&&this.spelling_state_observer(a,this)};this.setReportStateChange=function(a){this.report_state_change=a};this.getUrl=function(){return this.server_url+GOOGIE_CUR_LANG};this.escapeSpecial=function(a){return a?a.replace(/&/g,"&").replace(//g,">"):""};this.createXMLReq=function(a){return''+
+a+""};this.spellCheck=function(a){this.prepare(a);var a=this.escapeSpecial(this.orginal_text),b=this;$.ajax({type:"POST",url:this.getUrl(),data:this.createXMLReq(a),dataType:"text",error:function(){b.custom_ajax_error?b.custom_ajax_error(b):alert("An error was encountered on the server. Please try again later.");b.main_controller&&($(b.spell_span).remove(),b.removeIndicator());b.checkSpellingState()},success:function(a){b.processData(a);b.results.length||(b.custom_no_spelling_error?
+b.custom_no_spelling_error(b):b.flashNoSpellingErrorState());b.removeIndicator()}})};this.learnWord=function(a){var a=this.escapeSpecial(a.innerHTML),b=this,a=''+a+"";$.ajax({type:"POST",url:this.getUrl(),data:a,dataType:"text",error:function(){b.custom_ajax_error?b.custom_ajax_error(b):alert("An error was encountered on the server. Please try again later.")},success:function(){}})};this.prepare=function(a,b){this.cnt_errors=
+this.cnt_errors_fixed=0;this.setStateChanged("checking_spell");!b&&this.main_controller&&this.appendIndicator(this.spell_span);this.error_links=[];this.ta_scroll_top=this.text_area.scrollTop;this.ignore=a;this.hideLangWindow();if(""==$(this.text_area).val()||a)this.custom_no_spelling_error?this.custom_no_spelling_error(this):this.flashNoSpellingErrorState(),this.removeIndicator();else{this.createEditLayer(this.text_area.offsetWidth,this.text_area.offsetHeight);this.createErrorWindow();$("body").append(this.error_window);
+try{netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead")}catch(c){}this.main_controller&&$(this.spell_span).unbind("click");this.orginal_text=$(this.text_area).val()}};this.parseResult=function(a){var b=/\w+="(\d+|true)"/g,c=/\t/g,a=a.match(/]*>[^<]*<\/c>/g),d=[];if(null==a)return d;for(var e=0,f=a.length;e]*>/g,"").split(c);for(h=0;hd&&(this.results[c].attrs.o+=b)};this.saveOldValue=function(a,b){a.is_changed=!0;a.old_value=b};this.createListSeparator=function(){var a=document.createElement("td"),
+b=document.createElement("tr");$(a).html(" ").attr("googie_action_btn","1").css({cursor:"default","font-size":"3px","border-top":"1px solid #ccc","padding-top":"3px"});b.appendChild(a);return b};this.correctError=function(a,b,c,d){var e=b.innerHTML,c=3==c.nodeType?c.nodeValue:c.innerHTML,f=this.results[a].attrs.o;if(d)d=b.previousSibling.innerHTML,b.previousSibling.innerHTML=d.slice(0,d.length-1),e=" "+e,f--;this.hideErrorWindow();this.updateOrginalText(f,e,c,a);$(b).html(c).css("color","green").attr("is_corrected",
+!0);this.results[a].attrs.l=c.length;this.isDefined(b.old_value)||this.saveOldValue(b,e);this.errorFixed()};this.ignoreError=function(a){$(a).removeAttr("class").css("color","").unbind();this.hideErrorWindow()};this.showErrorWindow=function(a,b){this.show_menu_observer&&this.show_menu_observer(this);var c=this,d=$(a).offset(),e=document.createElement("table"),f=document.createElement("tbody");$(this.error_window).html("");$(e).addClass("googie_list").attr("googie_action_btn","1");for(var j=!1,g=0;g<
+this.custom_menu_builder.length;g++){var h=this.custom_menu_builder[g];if(h[0](this.results[b])){j=h[1](this,f,a);break}}if(!j){var j=this.results[b].suggestions,l=this.results[b].attrs.o,g=this.results[b].attrs.l,k,m;this.has_dictionary&&!$(a).attr("is_corrected")&&(h=document.createElement("tr"),k=document.createElement("td"),m=document.createElement("span"),$(m).text(this.lang_learn_word),$(k).attr("googie_action_btn","1").css("cursor","default").mouseover(c.item_onmouseover).mouseout(c.item_onmouseout).click(function(){c.learnWord(a,
+b);c.ignoreError(a,b)}),k.appendChild(m),h.appendChild(k),f.appendChild(h));for(var o=0,g=j.length;o").css({position:"absolute",
+"z-index":-1}),$("body").append(d),this.error_window_iframe=d;$(this.error_window_iframe).css({top:this.error_window.offsetTop,left:this.error_window.offsetLeft,width:this.error_window.offsetWidth,height:this.error_window.offsetHeight}).show()}};this.createEditLayer=function(a,b){this.edit_layer=document.createElement("div");$(this.edit_layer).addClass("googie_edit_layer").attr("id","googie_edit_layer").width("auto").height(b);"input"!=this.text_area.nodeName.toLowerCase()||""==$(this.text_area).val()?
+$(this.edit_layer).css("overflow","auto").height(b-4):$(this.edit_layer).css("overflow","hidden");var c=this;this.edit_layer_dbl_click&&$(this.edit_layer).dblclick(function(a){if("googie_link"!=a.target.className&&!c.isErrorWindowShown()){c.resumeEditing();var b=function(){$(c.text_area).focus();b=null};window.setTimeout(b,10)}return!1})};this.resumeEditing=function(){this.setStateChanged("ready");if(this.edit_layer)this.el_scroll_top=this.edit_layer.scrollTop;this.hideErrorWindow();this.main_controller&&
+$(this.spell_span).removeClass().addClass("googie_no_style");if(!this.ignore&&(this.use_focus&&($(this.focus_link_t).remove(),$(this.focus_link_b).remove()),$(this.edit_layer).remove(),$(this.text_area).show(),void 0!=this.el_scroll_top))this.text_area.scrollTop=this.el_scroll_top;this.checkSpellingState(!1)};this.createErrorLink=function(a,b){var c=document.createElement("span"),d=this,e=function(){d.showErrorWindow(c,b);e=null;return!1};$(c).html(a).addClass("googie_link").click(e).removeAttr("is_corrected").attr({googie_action_btn:"1",
+g_id:b});return c};this.createPart=function(a){if(" "==a)return document.createTextNode(" ");var a=this.escapeSpecial(a),a=a.replace(/\n/g,"
"),a=a.replace(/ /g," "),a=a.replace(/^ /g," "),a=a.replace(/ $/g," "),b=document.createElement("span");$(b).html(a);return b};this.showErrorsInIframe=function(){var a=document.createElement("div"),b=0,c=this.results;if(0").attr({src:this.img_dir+
+"change_lang.gif",alt:"Change language",googie_action_btn:"1"}),b=document.createElement("span");l=this;$(b).addClass("googie_lang_3d_on").append(a).bind("click",function(){var a="img"==this.tagName.toLowerCase()?this.parentNode:this;$(a).hasClass("googie_lang_3d_click")?(a.className="googie_lang_3d_on",l.hideLangWindow()):(a.className="googie_lang_3d_click",l.showLangWindow(a))});return b};this.createSpellDiv=function(){var a=document.createElement("span");$(a).addClass("googie_check_spelling_link").text(this.lang_chck_spell);
+this.show_spell_img&&$(a).append(" ").append($("").attr("src",this.img_dir+"spellc.gif"));return a};this.flashNoSpellingErrorState=function(a){this.setStateChanged("no_error_found");var b=this;if(this.main_controller){var c;c=a?function(){a();b.checkSpellingState()}:function(){b.checkSpellingState()};var d=$("").text(this.lang_no_error_found);$(this.switch_lan_pic).hide();$(this.spell_span).empty().append(d).removeClass().addClass("googie_check_spelling_ok");window.setTimeout(c,1E3)}};
+this.resumeEditingState=function(){this.setStateChanged("resume_editing");if(this.main_controller){var a=$("").text(this.lang_rsm_edt),b=this;$(this.switch_lan_pic).hide();$(this.spell_span).empty().unbind().append(a).bind("click",function(){b.resumeEditing()}).removeClass().addClass("googie_resume_editing")}try{this.edit_layer.scrollTop=this.ta_scroll_top}catch(c){}};this.checkSpellingState=function(a){a&&this.setStateChanged("ready");this.switch_lan_pic=this.show_change_lang_pic?this.createChangeLangPic():
+document.createElement("span");var a=this.createSpellDiv(),b=this;this.custom_spellcheck_starter?$(a).bind("click",function(){b.custom_spellcheck_starter()}):$(a).bind("click",function(){b.spellCheck()});this.main_controller&&("left"==this.change_lang_pic_placement?$(this.spell_container).empty().append(this.switch_lan_pic).append(" ").append(a):$(this.spell_container).empty().append(a).append(" ").append(this.switch_lan_pic));this.spell_span=a};this.isDefined=function(a){return void 0!==a&&null!==
+a};this.errorFixed=function(){this.cnt_errors_fixed++;this.all_errors_fixed_observer&&this.cnt_errors_fixed==this.cnt_errors&&(this.hideErrorWindow(),this.all_errors_fixed_observer())};this.errorFound=function(){this.cnt_errors++};this.createCloseButton=function(a){return this.createButton(this.lang_close,"googie_list_close",a)};this.createButton=function(a,b,c){var d=document.createElement("tr"),e=document.createElement("td"),f;b?(f=document.createElement("span"),$(f).addClass(b).html(a)):f=document.createTextNode(a);
+$(e).bind("click",c).bind("mouseover",this.item_onmouseover).bind("mouseout",this.item_onmouseout);e.appendChild(f);d.appendChild(e);return d};this.removeIndicator=function(){window.rcmail&&rcmail.set_busy(!1,null,this.rc_msg_id)};this.appendIndicator=function(){if(window.rcmail)this.rc_msg_id=rcmail.set_busy(!0,"checking")};this.createFocusLink=function(a){var b=document.createElement("a");$(b).attr({href:"javascript:;",name:a});return b};this.item_onmouseover=function(){"googie_list_revert"!=this.className&&
+"googie_list_close"!=this.className?this.className="googie_list_onhover":this.parentNode.className="googie_list_onhover"};this.item_onmouseout=function(){"googie_list_revert"!=this.className&&"googie_list_close"!=this.className?this.className="googie_list_onout":this.parentNode.className="googie_list_onout"}};