﻿var googieAjax=false;var googie=null;var googieButtons="";var googieSpellURL;var spellErrorOccured=false;var googieSpellEntities="";var googieSpellEntitiesArr=null;var googieBeforeSpellCheck=null;var googieAfterSpellCheck=null;var bSpellShowCompletePrompts=true;function addSpellChecker(id,googieSpellURL1){if(googie==null){googieSpellURL=googieSpellURL1;googie=new GoogieSpellMultiple(googieSpellURL+"spell/",googieSpellURL+"engine.aspx?sleep=0&");var saveSpellCheckOptionsDivFailed=function(req){spellErrorOccured=true;if(googieAjax){$find(SpellGenericError).show()}else{aspnet_confirmWindow("Error","prompt_Generic_Error","window.close();","","",250,150,"OK","","","","",",","true")}};var auto_correct=function(elm,current_googie){var original_t=elm.old_value;var new_t=elm.innerHTML;d=AJS.getRequest(googieSpellURL+"addToDict.aspx?auto=1");var saveSpellCheckOptionsDivAuto=function(req){if(googieAjax){$find(SpellAutoCorrect).get_parameters()[0].set_value(original_t);$find(SpellAutoCorrect).get_parameters()[1].set_value(new_t);$find(SpellAutoCorrect).show()}else{aspnet_confirmWindow("Auto Correct","prompt_Spell_AutoCorrect","window.close();","","",250,150,"OK","","","",original_t+"%00"+new_t,"%00","true")}};d.addCallback(saveSpellCheckOptionsDivAuto);d.addErrback(saveSpellCheckOptionsDivFailed);d.sendReq(original_t+"="+new_t)};var auto_correct_eval=function(elm){return elm.is_corrected&&googieLoggedInUser};googie.appendNewMenuItem("Auto Correct",auto_correct,auto_correct_eval);var add_checker=function(elm,current_googie){return !elm.is_corrected&&googieLoggedInUser&&current_googie.results[elm.g_id]["attrs"]["duplicate"]!="true"};var add_item=function(elm,current_googie){d=AJS.getRequest(googieSpellURL+"addToDict.aspx");var saveSpellCheckOptionsDiv=function(req){googie.ignoreAll(elm)};d.addCallback(saveSpellCheckOptionsDiv);d.addErrback(saveSpellCheckOptionsDivFailed);d.sendReq(elm.innerHTML)};googie.appendNewMenuItem("Add",add_item,add_checker);googie.noMoreErrorsCallback(fn_no_more_errors);googie.appendNewMenuItem("Stop Spell Check",stopSpellCheck,function(){return true});googie.setCustomAjaxError(saveSpellCheckOptionsDivFailed);googie.setElementEvaulator(isVisibleDynDiv);var currGetValue=function(ta){var retVal="";if(ta.id.indexOf("_Placeholder")!=-1){retVal=eval(ta.id.replace("_Placeholder","")).get_contentHTML()}else{if(!isRTE(ta)){retVal=ta.value}else{eval("retVal = "+ta.id+".get_value();")}}return retVal};var currSetValue=function(ta,value){if(ta.id.indexOf("_Placeholder")!=-1){eval(ta.id.replace("_Placeholder","")).set_contentHTML(value)}else{if(!isRTE(ta)){ta.value=value}else{eval(ta.id+".set_value(value);")}}};googie.setGetValue(currGetValue);googie.setSetValue(currSetValue);var currGetWysiwyg=function(ta){return isRTE(ta)&&eval(ta.id+".get_editorMode() === eChalk.Web.Common.TextFormat.RichText")};googie.setGetWysiwyg(currGetWysiwyg);googie.setDependent();googie.useCloseButtons();googie.setSpellContainer("googieButtonContainer")}googieSpellEntities+=","+id}function isRTE(A){return typeof window[A.id]!="undefined"&&typeof window[A.id].get_value!="undefined"}function addSpellCheckerFinal(){if(googie!=null){for(var x=googie.g_elms.length-1;x>=0&&Array.indexOf;x--){googie.g_elms[x].text_area=document.getElementById(googie.g_elms[x].text_area.id);if(googie.g_elms[x].text_area==null||(","+googieSpellEntities+",").indexOf(","+googie.g_elms[x].text_area.id+",")!=-1){Array.removeAt(googie.g_elms,x)}}if(googieSpellEntities!=""){googieSpellEntitiesArr=new Array();if(googieSpellEntities!=""){googieSpellEntitiesArr=googieSpellEntities.split(",")}googieSpellEntities="";gs="";for(var y=googieSpellEntitiesArr.length-1;y>=0&&Array.indexOf;y--){if(googieSpellEntitiesArr[y]==""||Array.indexOf(googieSpellEntitiesArr,googieSpellEntitiesArr[y])!=y){Array.removeAt(googieSpellEntitiesArr,y)}}for(var y=0;y<googieSpellEntitiesArr.length;y++){currElm=Array.indexOf?googieSpellEntitiesArr[y].trim():trim(googieSpellEntitiesArr[y]);if(document.getElementById(currElm)!=null){gs+="'"+currElm+"',"}}if(gs!=""){gs=gs.substr(0,gs.length-1);eval("googie.decorateTextareas("+gs+");")}}}}function isVisibleDynDiv(A){var C=A.text_area;ret=C!=null;while(ret&&C!=null&&C!="undefined"){try{ret=C.style.display.toUpperCase().indexOf("NONE")==-1&&C.style.visibility.toUpperCase().indexOf("HIDE")==-1&&C.style.visibility.toUpperCase().indexOf("HIDDEN")==-1}catch(B){ret=true}C=C.parentNode}return ret}var fn_no_more_errors=function(){if(googieAjax){if(bSpellShowCompletePrompts){$find(SpellNoMoreErrors).show()}else{executeSpellCheck()}}else{aspnet_confirmWindow("Spell Check","prompt_Spell_NoMoreErrors","window.opener.executeSpellCheck();","","",250,150,"OK","","","","",",","")}};function stopSpellCheck(){if(googie!=null&&googie.getState()=="resume_editing"){executeSpellCheck()}}function executeSpellCheck(){addSpellCheckerFinal();if(googie==null){if(googieAjax){$find(SpellNoFields).show()}else{aspnet_confirmWindow("Spell Check","prompt_Spell_NoFields","window.close();","","",250,150,"OK","","","","",",","true")}return }op="spell_check";if(googie.getState()=="spell_check"){op="checking_spell"}if(googieBeforeSpellCheck!=null){googieBeforeSpellCheck()}buts=googieButtons.split(",");for(x=0;x<buts.length;x++){if(buts[x]!=""){but=document.getElementById(buts[x]);if(but!=null){but.href="#";if(googieAjax){if(but.style.display!="none"){but.innerHTML="<img src='"+googieSpellURL+"spell/indicator.gif' border='0' />"}}else{but.childNodes[0].src=googieSpellURL+"spell/indicator.gif"}}}}document.body.style.cursor="wait";googie.spellCheckObserver(op);switchSpellCheckButtons(op)}function switchSpellCheckButtons(A){if(googie.getState()=="spell_check"||googie.getState()=="resume_editing"){bNoErrors=false;for(x=0;x<buts.length;x++){if(buts[x]!=""){but=document.getElementById(buts[x]);if(but!=null){if(googie.getState()=="spell_check"){if(googieAjax){if(but.style.display!="none"){but.innerHTML="Spell Check"}}else{but.childNodes[0].src=googieSpellURL+"spell_check.gif"}if(A=="checking_spell"){if(spellErrorOccured){spellErrorOccured=false}else{if(googieAjax){bNoErrors=true;if(bSpellShowCompletePrompts){$find(SpellNoErrors).show()}}else{aspnet_confirmWindow("Spell Check","prompt_Spell_NoErrors","window.close();","","",250,150,"OK","","","","",",","true")}}}}else{if(googieAjax){if(but.style.display!="none"){but.innerHTML="Stop Spell Check"}}else{but.childNodes[0].src=googieSpellURL+"stopspell.gif"}}but.href="javascript:executeSpellCheck()"}}}document.body.style.cursor="auto";if(googieAfterSpellCheck!=null){googieAfterSpellCheck(googie.getState()!="spell_check",bNoErrors)}}else{setTimeout("switchSpellCheckButtons('"+A+"')",50)}}function addSpellCheckerButton(A){if(googieButtons+",".indexOf(","+googieButtons+",")==-1){googieButtons+=","+A}};
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();