Type.registerNamespace("Telerik.Web.UI.Editor");
Telerik.Web.UI.Editor.AjaxSpellCheck=function(_1){
Telerik.Web.UI.Editor.AjaxSpellCheck.initializeBase(this,[_1]);
this._language="";
this._editor=null;
this._originalHtml=null;
this._protectedData=[];
this._ignoreTags=new RegExp("(<!--)([\\s\\S]*?)(-->)","gi");
this._ignoreObjectTags=new RegExp("(<object)([\\s\\S]*?)(object>)","gi");
};
Telerik.Web.UI.Editor.AjaxSpellCheck.prototype={initialize:function(){
var _2=this.get_editor();
this._finalCheckMessage=_2.getLocalizedString("SpellCheckEnd","Finish spellchecking");
this._completeMessage=_2.getLocalizedString("SpellCheckComplete","Spellchecking complete!");
this._cancelMessage=_2.getLocalizedString("CancelButton","Cancel");
this._addWordSuccessMessage=_2.getLocalizedString("AddCustomWordSuccess");
this._spellingInProgressMessage=_2.getLocalizedString("SpellingInProgress");
this._spellingModeMessage=_2.getLocalizedString("SpellingMode");
this._noSpellingMistakesMessage=_2.getLocalizedString("NoSpellingMistakes","No mistakes found.");
this._loadingIconCss="rade_loading";
this._createUI();
},get_editor:function(){
return this._editor;
},set_editor:function(_3){
this._editor=_3;
},get_language:function(){
return this._language;
},set_language:function(_4){
this._language=_4;
},getSpellService:function(){
var _5=this.get_editor().get_spellCheckService();
var _6=this.get_language();
if(_6){
_5.set_language(_6);
}
return _5;
},dispose:function(){
if(this._cancelButton){
this._cancelButton.Parent=null;
this._cancelButton.onclick=null;
}
this._cancelButton=null;
if(this._finishButton){
this._finishButton.Parent=null;
this._finishButton.onclick=null;
}
this._finishButton=null;
if(this._spellEngine){
this._spellEngine.dispose();
}
this._editor=null;
this._topElement=null;
this._protectedData=null;
},raiseEvent:function(_7,_8){
var _9=this.get_events().getHandler(_7);
if(_9){
if(!_8){
_8=Sys.EventArgs.Empty;
}
_9(this,_8);
}
},add_spellCheckStart:function(_a){
this.get_events().addHandler("spellCheckStart",_a);
},remove_spellCheckStart:function(_b){
this.get_events().removeHandler("spellCheckStart",_b);
},add_spellCheckEnd:function(_c){
this.get_events().addHandler("spellCheckEnd",_c);
},remove_spellCheckEnd:function(_d){
this.get_events().removeHandler("spellCheckEnd",_d);
},spellCheck:function(){
if(!this._spellEngine){
this._spellEngine=new Telerik.Web.UI.Editor.SpellEngineUI(this.get_editor(),this);
this._spellEngine.onSpellCheckComplete=Function.createDelegate(this,function(){
this.finishSpellCheck();
alert(this._completeMessage);
});
this._spellEngine.onAddCustomWord=Function.createDelegate(this,function(_e){
this.addCustomWord(_e);
});
}
if(this._spellEngine._spellcheckComplete){
this.finishSpellCheck(false);
}
this._setVisible(true);
this._setLoadingIconVisible(true);
this._enableButtons(false);
this._originalHtml=this.get_editor().get_contentArea().innerHTML;
var _f=this.getSpellService();
var _10=Function.createDelegate(this,function(_11,_12){
_f.remove_complete(_10);
this.beginSpellCheck(_12);
});
_f.add_complete(_10);
this._saveSpecialContent();
_f.spellCheck(this._spellEngine._escapeNewLines(this._originalHtml));
},beginSpellCheck:function(_13){
this._setLoadingIconVisible(false);
this._enableButtons(true);
this.raiseEvent("spellCheckStart");
if(_13.badWords.length==0){
alert(this._noSpellingMistakesMessage);
this.finishSpellCheck();
}else{
this._spellEngine.initialize(_13,this._originalHtml);
}
},finishSpellCheck:function(_14){
this._setVisible(false);
this._spellEngine.finalize();
this.restoreSavedContent();
this._originalHtml=null;
if(false!=_14){
this.raiseEvent("spellCheckEnd");
}
},cancelSpellCheck:function(){
this._setVisible(false);
this._spellEngine.finalize(false);
if(null!=this._originalHtml){
Telerik.Web.UI.Editor.Utils.setElementInnerHtml(this.get_editor().get_contentArea(),this._originalHtml);
this._originalHtml=null;
}
this.restoreSavedContent();
var _15=this.get_editor().get_commandsManager();
var _16=_15.get_commands();
_15.removeCommandAt(_16.length-1);
this.raiseEvent("spellCheckEnd");
this.get_editor().raiseEvent("selectionChange",Sys.EventArgs.Empty);
},_saveSpecialContent:function(){
this._protectedData=[];
var _17=Function.createDelegate(this,function(_18,_19,_1a,_1b,_1c,_1d){
Array.add(this._protectedData,_19+_1a+_1b);
return "<RADEDITORFORMATTED_"+this._protectedData.length+"/>";
});
this._originalHtml=this._originalHtml.replace(this._ignoreTags,_17);
this._originalHtml=this._originalHtml.replace(this._ignoreObjectTags,_17);
},restoreSavedContent:function(){
if(this._protectedData&&this._protectedData.length>0){
var _1e=this.get_editor().get_contentArea().innerHTML;
for(var i=0;i<this._protectedData.length;i++){
var _20=new RegExp("<RADEDITORFORMATTED_"+(i+1)+"\\s*\\/>");
_1e=_1e.replace(_20,this._protectedData[i]);
}
Telerik.Web.UI.Editor.Utils.setElementInnerHtml(this.get_editor().get_contentArea(),_1e);
}
},addCustomWord:function(_21){
var _22=this.getSpellService();
var _23=this._spellEngine;
var _24=this._addWordSuccessMessage;
var _25=function(_26,_27){
_22.remove_complete(_25);
alert(_21+" "+_24);
_23.clearWrongWords(_21,_21);
var res=_23.isHighlightedRemaining();
if(!res){
_23._suggestionDropdown.hide();
_23.onSpellCheckComplete();
return;
}
_23.moveToNextWrongWord();
};
_22.add_complete(_25);
_22.addCustomWord(_21);
},_createUI:function(){
var _29=document;
var _2a=_29.createElement("table");
_2a.cellSpacing=2;
_2a.cellPadding=0;
_2a.className="rade_ajaxspell_wrapper";
_2a.style.width="100%";
_2a.style.backgroundColor="#ffffcc";
_2a.style.clear="both";
_2a.style.borderBottom="1px solid #adadad";
_2a.insertRow(-1);
var _2b=_2a.rows[0].insertCell(-1);
_2b.style.width="100%";
var _2c=_29.createElement("button");
_2c.className="rade_ajaxspell_button";
_2b=_2a.rows[0].insertCell(-1);
this._finishButton=_2c.cloneNode(true);
this._finishButton.Parent=this;
this._finishButton.innerHTML=this._finalCheckMessage;
this._finishButton.onclick=new Function("this.Parent.finishSpellCheck();return false;");
_2b.appendChild(this._finishButton);
_2b=_2a.rows[0].insertCell(-1);
this._cancelButton=_2c.cloneNode(true);
this._cancelButton.Parent=this;
this._cancelButton.innerHTML=this._cancelMessage;
this._cancelButton.onclick=new Function("this.Parent.cancelSpellCheck();return false;");
_2b.appendChild(this._cancelButton);
this._topElement=_2a;
this.get_element().appendChild(this._topElement);
},_setVisible:function(_2d){
this._topElement.style.display=_2d?"":"none";
},_enableButtons:function(_2e){
var _2f=this._topElement.getElementsByTagName("button");
for(var i=0;i<_2f.length;i++){
_2f[i].disabled=!_2e;
}
},_setLoadingIconVisible:function(_31){
var _32=this._topElement.rows[0].cells[0];
_32.innerHTML="";
if(_31){
var _33=document.createElement("SPAN");
_33.className=this._loadingIconCss;
_32.appendChild(_33);
_32.innerHTML+="<label>"+this._spellingInProgressMessage+"</label>";
}else{
_32.innerHTML="<label>"+this._spellingModeMessage+"</label>";
}
}};
Telerik.Web.UI.Editor.AjaxSpellCheck.registerClass("Telerik.Web.UI.Editor.AjaxSpellCheck",Sys.UI.Control);
Telerik.Web.UI.Editor.SpellEngineUI=function(_34,_35){
this._editor=_34;
this._parentControl=_35;
this._suggestionDropdown=null;
this._suggestionBox=null;
this._wrongWordCounter=0;
this._wrongWordsArray=null;
this._spanId="RadESpellError_";
this._selectedEditorElement=null;
this._spellcheckComplete=true;
this._automaticAdvance=true;
this._localizedCommandName=this._editor.getLocalizedString("spellCheck","Check spelling");
this._localizedName=this._editor.getLocalizedString("SpellingChange","Spelling Change");
this._noSuggestionsString=this._editor.getLocalizedString("NoSuggestions","(no suggestions)");
this._changeWordString=this._editor.getLocalizedString("ChangeWordString","Change");
this._ignoreAllString=this._editor.getLocalizedString("IgnoreAllString","Ignore All");
this._ignoreString=this._editor.getLocalizedString("IgnoreString","Ignore");
this._moreThanOnceMessage=this._editor.getLocalizedString("MoreThanOnceMessage","This word occurs more than once in the text. Would you like to replace all instances?");
this._undoDisabledMessage=this._editor.getLocalizedString("UndoDisabledMessage","You cannot undo further while in spellcheck mode. Please finish spellchecking first.");
this._addToDictionaryString=this._editor.getLocalizedString("AddToDictionary","Add to dictionary");
this._addIconCss="rade_ajaxspell_addicon";
this._okIconCss="rade_ajaxspell_okicon";
this._ignoreIconCss="rade_ajaxspell_ignoreicon";
};
Telerik.Web.UI.Editor.SpellEngineUI.prototype={onAddCustomWord:function(_36){
},onSpellCheckComplete:function(){
},dispose:function(){
this._editor=null;
this.onSpellCheckComplete=null;
},_configureUndo:function(_37){
if(_37){
this._editor.enableEditing(true);
var _38=this._editor.get_commandsManager();
var _39=_38.get_commands();
var i=this._currentUndoIndex;
while(i<_39.length){
_38.removeCommandAt(_39.length-1);
}
this._editor.executeCommand(this.SaveStateCmd);
if(this._onCommandExecutingDelegate){
this._editor.remove_commandExecuting(this._onCommandExecutingDelegate);
}
this._onCommandExecutingDelegate=null;
}else{
var _3b=this._editor.get_commandsManager();
this._currentUndoIndex=_3b.getCommandsToUndo().length;
this._onCommandExecutingDelegate=Function.createDelegate(this,function(_3c,_3d){
var _3e=_3d.get_commandName();
if(_3e=="Undo"&&this._currentUndoIndex>=_3b.getCommandsToUndo().length){
alert(this._undoDisabledMessage);
_3d.set_cancel(true);
}
});
this._editor.add_commandExecuting(this._onCommandExecutingDelegate);
this._editor.enableEditing(false,Telerik.Web.UI.EditingOptions.All,{"Undo":true,"Redo":true,"AjaxSpellCheck":true});
}
},finalize:function(_3f){
if(true!=this._initialized){
return;
}
if(false!=_3f){
this.clearWrongWords();
}
if(this._parentControl){
this._parentControl.restoreSavedContent();
this._parentControl=null;
}
var _40=this._editor;
if(this.OnMouseHandler){
_40.detachEventHandler("click",this.OnMouseHandler);
}
if(this.OnKeyDownHandler){
_40.detachEventHandler("keydown",this.OnKeyDownHandler);
}
if(this.OnContextMenu){
_40.detachEventHandler("contextmenu",this.OnContextMenu);
}
if(this.OnEditorSubmit){
_40.remove_submit(this.OnEditorSubmit);
}
this._configureUndo(true);
_40.setFocus();
_40.raiseEvent("selectionChange",Sys.EventArgs.Empty);
this._wrongWordsArray=null;
this._spellcheckComplete=true;
this._initialized=false;
},initialize:function(_41,_42){
this._initialized=true;
this._wrongWordsArray=_41.badWords;
this._wordOffsets=_41.wordOffsets;
var _43=this._editor;
this.SaveStateCmd=new Telerik.Web.UI.Editor.GenericCommand(this._localizedCommandName,_43.get_contentWindow());
this.markWrongWords(_42);
this._spellcheckComplete=false;
this._wrongWordCounter=0;
var _44=this;
this.OnEditorSubmit=function(){
_44.finalize();
};
this._editor.add_submit(this.OnEditorSubmit);
this.OnMouseHandler=function(e){
_44._showSuggestionDropdown();
return $telerik.cancelRawEvent(e);
};
this.OnKeyDownHandler=function(e){
if(e.keyCode==9){
_44.moveToNextWrongWord();
return $telerik.cancelRawEvent(e);
}
var _47=false;
if(_44._suggestionDropdown){
var _48=_44._suggestionDropdown;
var _49=(_48.isExpanded());
var _4a=e.keyCode;
if(_49){
if(38==_4a){
_48.selectPreviousItem();
_47=true;
}else{
if(40==_4a){
_48.selectNextItem();
_47=true;
}else{
if(13==_4a){
_48.hide();
if(_48.get_activeIndex){
_48.set_selectedIndex(_48.get_activeIndex());
}
_44._onDropDownValueSelected(_48);
try{
e.keyCode=123;
}
catch(e){
}
_47=true;
}else{
if(27==_4a){
_48.hide();
}
}
}
}
_47=true;
}
}
if(_47){
return $telerik.cancelRawEvent(e);
}
};
this.OnContextMenu=function(e){
if(this._editor.isIE){
_44.OnMouseHandler(e);
}
e.cancelBubble=true;
if(this._editor.isIE){
return false;
}
};
window.setTimeout(function(){
var ed=_44._editor;
ed.attachEventHandler("click",_44.OnMouseHandler);
ed.attachEventHandler("keydown",_44.OnKeyDownHandler);
ed.attachEventHandler("contextmenu",Function.createDelegate(_44,_44.OnContextMenu));
if(_44._automaticAdvance){
ed.setFocus();
if(ed.isIE){
try{
var _4d=ed.getSelection().getRange();
if(_4d){
_4d.moveToElementText(ed.get_contentArea());
_4d.collapse();
_4d.select();
}
}
catch(e){
}
}
_44.moveToNextWrongWord();
}
},50);
this._configureUndo(false);
},moveToNextWrongWord:function(){
var dir=-1;
var _4f=this._editor.getSelection();
var _50=_4f.getParentElement();
var _51=null;
if(this.isHighlightedWord(_50)&&!this._editor.getSelectionHtml()){
_51=_50;
}else{
_4f.Collapse();
var _52=this._editor;
var _53=this;
var _54=null;
function getWrongWord(){
var _55=_52.get_document().getElementsByTagName("SPAN");
var i=0;
var _57=_55[i];
_54=_52.getSelection().getRange();
while(_57!=null){
if(_53.isHighlightedWord(_57)){
var _58=null;
if(_52.isIE){
if(_54.duplicate){
tempRange=_54.duplicate();
}else{
tempRange=_52.get_contentArea().createTextRange();
}
if(tempRange.moveToElementText){
tempRange.moveToElementText(_57);
}
if(!_54.compareEndPoints){
break;
}
_58=_54.compareEndPoints("EndToStart",tempRange);
if(0==_58){
_51=_57;
break;
}
}else{
if(_54){
tempRange=_54.cloneRange();
tempRange.selectNodeContents(_57);
_58=_54.compareBoundaryPoints(Range.END_TO_START,tempRange);
}
}
if(dir==_58){
_51=_57;
break;
}
}
i++;
_57=_55[i];
}
return _57;
}
var _51=getWrongWord();
if(!_51){
var _59=_52.get_contentArea();
if(_59&&_59.createTextRange){
var _5a=_59.createTextRange();
_5a.moveToElementText(_59);
_5a.collapse(true);
_5a.select();
}else{
var _5b=_52.get_document().getElementsByTagName("SPAN")[0];
if(_5b){
_52.selectElement(_5b);
}
}
try{
var _54=_52.getSelection().getRange();
if(_54&&_54.moveStart){
_54.moveStart("character",-1);
_54.select();
}
}
catch(e){
}
_52.getSelection().Collapse(true);
_51=getWrongWord();
}
}
if(_51){
this._editor.selectElement(_51);
Telerik.Web.UI.Editor.Utils.scrollIntoView(_51);
this._showSuggestionDropdown();
}
},clearWrongWords:function(_5c,_5d){
var _5e=this._editor.get_document().getElementsByTagName("SPAN");
for(var i=0;i<_5e.length;i++){
var _60=_5e[i];
if(this.isHighlightedWord(_60)){
if(_5c){
if(_60.innerHTML==_5c){
this.clearHighlightedElement(_60,_5d);
i--;
}
continue;
}else{
this.clearHighlightedElement(_60);
}
i--;
}
}
},isHighlightedRemaining:function(){
var _61=this._editor.get_document().getElementsByTagName("SPAN");
for(var i=0;i<_61.length;i++){
var _63=_61[i];
if(this.isHighlightedWord(_63)){
return true;
}
}
return false;
},getCurrentWrongWord:function(){
var _64=this._selectedEditorElement;
var _65=_64.innerHTML.replace(/<\/?[^>]*>/ig,"");
return _65;
},isHighlightedWord:function(_66){
if(!_66||!_66.getAttribute){
return false;
}
var id=_66.getAttribute("id");
if(id&&id.indexOf(this._spanId)>-1){
return true;
}
return false;
},clearHighlightedElement:function(_68,_69,_6a){
var _6b=true;
if(_68!=this._selectedEditorElement){
_6b=false;
}
var _6c=_69?_69:_68.innerHTML.replace(/<\/?[^>]*>/ig,"");
var _6d=_69?true:false;
this._editor.selectElement(_68,false);
var _6e=new Telerik.Web.UI.Editor.GenericCommand(this._localizedName,this._editor.get_contentWindow());
var _6f=this._editor.get_document().createTextNode(_6c);
_68.parentNode.replaceChild(_6f,_68);
if(this._editor.isIE){
if(_6a){
this._editor.setActive();
}else{
range=this._editor.get_contentArea().createTextRange();
range.findText(_6f.data);
range.select();
}
}else{
this._editor.selectElement(_6f,false);
}
this._editor.getSelection().collapse();
if(_6d){
this._editor.executeCommand(_6e);
}
if(_6b){
this._selectedEditorElement=null;
}
},markWrongWords:function(_70){
var _71=function(_72,_73,_74,_75){
this.badWords=_72;
this._wordOffsets=_73;
this._spanId=_74;
this.Content=_75;
this.CurrentWordIndex=0;
this.Result=null;
};
_71.prototype={GetSplitContent:function(){
var _76=new Array(this.badWords.length*2+1);
for(var i=0;i<this.badWords.length;i++){
var _78=i*2;
_76[_78]=this.GetBeforeText(i);
_76[_78+1]=this.badWords[i].wordString;
}
_76[_76.length-1]=this.GetLastText();
return _76;
},GetMarkedSplitContent:function(_79){
for(var i=1;i<_79.length;i+=2){
_79[i]=this.GetMarkedWord(_79[i]);
this.CurrentWordIndex++;
}
return _79;
},GetBeforeText:function(_7b){
var _7c=0;
var _7d=this.GetWordStartIndex(this.badWords[_7b]);
if(_7b!=0){
badWordBefore=this.badWords[_7b-1];
_7c=this.GetWordEndCharIndex(badWordBefore);
}
return this.Content.substring(_7c,_7d);
},GetLastText:function(){
var _7e=this.badWords[this.badWords.length-1];
var _7f=this.GetWordEndCharIndex(_7e);
var _80=this.Content.length;
return this.GetSubContent(_7f,_80);
},GetWordEndCharIndex:function(_81){
return this.GetWordStartIndex(_81)+_81.wordString.length;
},GetSubContent:function(_82,_83){
return this.Content.substring(_82,_83);
},GetWordStartIndex:function(_84){
return this._wordOffsets[_84.textOffset];
},GetMarkedWord:function(_85){
return "<span class='RadEWrongWord' id='"+this._spanId+this.CurrentWordIndex+"'>"+_85+"</span>";
},GetResult:function(){
if(this.Result==null){
this.Result=this.GetMarkedSplitContent(this.GetSplitContent()).join("");
}
return this.Result;
}};
var _86=new _71(this._wrongWordsArray,this._wordOffsets,this._spanId,this._escapeNewLines(_70));
Telerik.Web.UI.Editor.Utils.setElementInnerHtml(this._editor.get_contentArea(),this._unescapeNewLines(_86.GetResult()));
},_escapeNewLines:function(_87){
var _88=_87.replace(/\n/gi,"<telerikcr />");
_88=_88.replace(/\r/gi,"<teleriklf />");
return _88;
},_unescapeNewLines:function(_89){
var _8a=_89.replace(/\<telerikcr\s*\/\>/gi,"\n");
var _8a=_8a.replace(/\<teleriklf\s*\/\>/gi,"\r");
return _8a;
},_getSuggestionsForWord:function(_8b){
var _8c=this._wrongWordsArray;
for(var i=0;i<_8c.length;i++){
var _8e=_8c[i].wordString;
if(_8e==_8b){
var _8f=_8c[i].suggestionsString;
if(_8f.length==0){
return [["",this._noSuggestionsString]];
}else{
_8f=_8f.concat([]);
for(var j=0;j<_8f.length;j++){
_8f[j]=[_8f[j],_8f[j]];
}
}
return _8f;
}
}
return [];
},_get_footerItems:function(_91){
var _92=[];
if(this._editor.get_spellAllowAddCustom()){
_92.splice(0,0,["rade_add_to_dictionary",this._addToDictionaryString,this._addIconCss]);
}
_92.splice(0,0,["rade_change",this._changeWordString,this._okIconCss]);
if(this._occursMoreThanOnce(_91)){
_92.splice(0,0,["rade_ignore_all",this._ignoreAllString,this._ignoreIconCss]);
}
_92.splice(0,0,["",this._ignoreString,this._ignoreIconCss]);
return _92;
},_occursMoreThanOnce:function(_93){
var _94=this._editor.get_text();
var re=new RegExp("(\\b)"+_93+"(\\b)","g");
var res=_94.match(re);
return (res&&res.length>1);
},fire:function(_97,_98){
var _99=_98.SelectedValue;
var _9a=this._selectedEditorElement&&this._selectedEditorElement.innerHTML?this._selectedEditorElement.innerHTML:"";
if(_99=="rade_add_to_dictionary"){
if(_9a.length>0){
this.onAddCustomWord(this.getCurrentWrongWord());
}
}else{
if(_99=="rade_ignore_all"){
this.clearWrongWords(_9a,"");
}else{
if(_99=="rade_change"){
this._showSuggestionBox(this._selectedEditorElement);
return;
}else{
var _9b=false;
if(_99){
var _9c=this._occursMoreThanOnce(_9a);
if(_9c){
var _9d=confirm(this._moreThanOnceMessage);
if(_9d){
this.clearWrongWords(_9a,_99);
_9b=true;
}
}
}
if(!_9b){
this.clearHighlightedElement(this._selectedEditorElement,_99,true);
}
}
}
}
var res=this.isHighlightedRemaining();
if(!res){
this.onSpellCheckComplete();
return;
}
this._editor.raiseEvent("selectionChange",Sys.EventArgs.Empty);
if(this._automaticAdvance){
this.moveToNextWrongWord();
}
},_onDropDownValueSelected:function(_9f,_a0){
var _a1=_9f.get_selectedItem();
this.fire("",{SelectedValue:_a1});
},_onDropDownBeforeShow:function(_a2,_a3){
var _a4=this.getCurrentWrongWord();
var _a5=this._getSuggestionsForWord(_a4);
_a2.set_items(_a5);
},_showSuggestionDropdown:function(){
var _a6=this._editor;
var _a7=_a6.getSelection().getParentElement();
if(!this.isHighlightedWord(_a7)){
return;
}
this._selectedEditorElement=_a7;
var _a8=this.getCurrentWrongWord();
if(!this._suggestionDropdown){
this._onDropDownValueSelectedDelegate=Function.createDelegate(this,this._onDropDownValueSelected);
this._onDropDownBeforeShowDelegate=Function.createDelegate(this,this._onDropDownBeforeShow);
var _a9={"valueSelected":this._onDropDownValueSelectedDelegate,"show":this._onDropDownBeforeShowDelegate};
var _aa={};
_aa["popupwidth"]="160px";
_aa["parentElement"]=_a6.get_contentAreaElement();
_aa["skin"]=_a6.get_skin();
_aa["sizetofit"]=true;
var _ab=$create(Telerik.Web.UI.EditorSpellSuggestionBox,_aa,_a9,null,document.createElement("SPAN"));
this._suggestionDropdown=_ab;
}
var _ab=this._suggestionDropdown;
_ab.hide();
_ab.set_footerItems(this._get_footerItems(_a8));
_ab.set_wrongWordWrapper(_a7);
_ab.show();
_ab.selectNextItem();
if(_a6.isIE){
_a6.setFocus();
}
},_onTextboxValueSelected:function(_ac,_ad){
var val=_ac.get_selectedItem();
this._editor.setFocus();
this.fire("",{SelectedValue:val});
},_showSuggestionBox:function(_af){
var _b0=this._editor;
if(!this._suggestionBox){
this._onTextboxValueSelectedDelegate=Function.createDelegate(this,this._onTextboxValueSelected);
var _b1={"valueSelected":this._onTextboxValueSelectedDelegate};
var _b2={};
_b2["parentElement"]=_b0.get_contentAreaElement();
_b2["skin"]=_b0.get_skin();
_b2["sizetofit"]=true;
var _b3=$create(Telerik.Web.UI.EditorAjaxSpellTextbox,_b2,_b1,null,document.createElement("SPAN"));
this._suggestionBox=_b3;
}
var _b4=this._suggestionBox;
var _b5=this.getCurrentWrongWord();
window.setTimeout(function(){
_b4.set_wrongWordWrapper(_af);
_b4.show();
_b4.setValue(_b5);
},10);
}};
Telerik.Web.UI.EditorSpellSuggestionBox=function(_b6){
Telerik.Web.UI.EditorSpellSuggestionBox.initializeBase(this,[_b6]);
this._parentElement=null;
this._wrongWordWrapper=null;
this._maxItemSize=5;
this._popupClassName="rade_AjaxSpellCheck";
};
Telerik.Web.UI.EditorSpellSuggestionBox.prototype={dispose:function(){
this._wrongWordWrapper=null;
Telerik.Web.UI.EditorSpellSuggestionBox.callBaseMethod(this,"dispose");
},initialize:function(){
},set_footerItems:function(_b7){
this._footerItems=_b7;
},renderChildren:function(){
Telerik.Web.UI.EditorSpellSuggestionBox.callBaseMethod(this,"renderChildren");
var _b8=20;
var _b9=this._items.length>this._maxItemSize?this._maxItemSize:this._items.length;
var _ba=_b9>1?(_b9*_b8):25;
var div=document.createElement("DIV");
div.style.overflow="auto";
div.style.height=_ba+"px";
div.className="rade_AjaxSpellCheckSuggestions";
var _bc=this._itemRootElement;
_bc.cellSpacing="0";
var _bd=_bc.parentNode;
_bd.removeChild(_bc);
div.appendChild(_bc);
div.style.overflowX="hidden";
div.style.width="100%";
var _be=this.renderItemRoot();
_be.cellSpacing="0";
_bd.appendChild(_be);
this.renderNewRow();
var _bf=this.renderItemContainer();
_bf.appendChild(div);
var _c0=document.createElement("DIV");
_c0.className="rade_AjaxSpellCheckSeparator";
_bf.appendChild(_c0);
var _c1=this._items.length;
for(var i=0;i<this._footerItems.length;i++){
this.renderNewRow();
var _c3=this.renderItemContainer();
this.markItemContainer(_c3,_c1);
this.renderChild(_c3,this._footerItems[i],_c1);
_c1++;
}
this._items=this._items.concat(this._footerItems);
},configurePopupPropertiesBeforeShow:function(){
var _c4=this._popupBehavior;
_c4.set_positioningMode(Telerik.Web.PositioningMode.Absolute);
var _c5=this.get_parentElement();
if(_c5){
_c4.set_parentElement(_c5);
}
var _c6=this.get_wrongWordWrapper();
if(_c6){
var _c7=$telerik.getBounds(_c6);
_c4.set_x(_c7.x);
_c4.set_y(_c7.y+_c7.height);
}
},get_parentElement:function(){
return this._parentElement;
},set_parentElement:function(_c8){
this._parentElement=_c8;
},get_maxItemSize:function(){
return this._maxItemSize;
},set_maxItemSize:function(_c9){
this._maxItemSize=_c9;
},get_wrongWordWrapper:function(){
return this._wrongWordWrapper;
},set_wrongWordWrapper:function(_ca){
this._wrongWordWrapper=_ca;
}};
Telerik.Web.UI.EditorSpellSuggestionBox.registerClass("Telerik.Web.UI.EditorSpellSuggestionBox",Telerik.Web.UI.EditorSplitButton);
Telerik.Web.UI.EditorAjaxSpellTextbox=function(_cb){
Telerik.Web.UI.EditorAjaxSpellTextbox.initializeBase(this,[_cb]);
};
Telerik.Web.UI.EditorAjaxSpellTextbox.prototype={dispose:function(){
if(null!=this._element){
this._element.onchange=null;
this._element.onkeypress=null;
this._element.onclick=null;
this._element.Parent=null;
}
this._element=null;
Telerik.Web.UI.EditorAjaxSpellTextbox.callBaseMethod(this,"dispose");
},setValue:function(_cc){
if(this._textElement){
this._textElement.value=_cc;
}
var _cd=this._textElement;
try{
if(_cd){
_cd.focus();
}
if(_cd&&_cd.setActive){
_cd.setActive();
var _ce=document.selection.createRange();
_ce.moveStart("word",1);
_ce.select();
_ce.collapse();
}
}
catch(e){
}
},get_selectedItem:function(){
return this._textElement.value;
},fire:function(){
this.hide();
this.raiseEvent("valueSelected");
},attachEventHandlers:function(){
},show:function(){
if(!this._rendered){
this.render();
}
this._show();
},configurePopupPropertiesBeforeShow:function(){
Telerik.Web.UI.EditorAjaxSpellTextbox.callBaseMethod(this,"configurePopupPropertiesBeforeShow");
var _cf=this._popupBehavior;
var _d0=this.get_wrongWordWrapper();
if(_d0){
var _d1=$telerik.getBounds(_d0);
_cf.set_y(_d1.y);
}
},renderChildren:function(){
},renderItemRoot:function(){
this._createBox();
this._itemRootElement=this._element;
return this._itemRootElement;
},_createBox:function(){
var _d2=document.createElement("INPUT");
_d2.setAttribute("size","20");
_d2.Parent=this;
var _d3=function(e,_d5,_d6){
if(_d6){
if(_d5.Executed){
_d5.Executed=false;
return $telerik.cancelRawEvent(e);
}
}
_d5.Executed=true;
_d5.Parent.fire();
return $telerik.cancelRawEvent(e);
};
_d2.onclick=new Function("this.focus();");
_d2.onkeypress=function(e){
if(!e){
e=window.event;
}
if(e&&e.keyCode==13){
return _d3(e,this);
}
};
this._textElement=_d2;
var _d8=document.createElement("div");
var _d9=document.createElement("button");
_d9.onmousedown=new Function("e","return false;");
_d9.onclick=new Function("e","this.parentNode.getElementsByTagName('input')[0].Parent.fire();return false;");
_d9.className="rade_ajaxspell_okicon";
_d8.appendChild(_d2);
_d8.appendChild(_d9);
this._element=_d8;
return this._element;
}};
Telerik.Web.UI.EditorAjaxSpellTextbox.registerClass("Telerik.Web.UI.EditorAjaxSpellTextbox",Telerik.Web.UI.EditorSpellSuggestionBox);

