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="RadEXhtmlButton";
_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);
var _5c=this._editor.getSelection().getRange();
if(_5c&&_5c.scrollIntoView&&_5c.select){
_5c.scrollIntoView(true);
_5c.select();
}else{
if(_51.scrollIntoView){
_51.scrollIntoView(false);
}
}
this._showSuggestionDropdown();
}
},clearWrongWords:function(_5d,_5e){
var _5f=this._editor.get_document().getElementsByTagName("SPAN");
for(var i=0;i<_5f.length;i++){
var _61=_5f[i];
if(this.isHighlightedWord(_61)){
if(_5d){
if(_61.innerHTML==_5d){
this.clearHighlightedElement(_61,_5e);
i--;
}
continue;
}else{
this.clearHighlightedElement(_61);
}
i--;
}
}
},isHighlightedRemaining:function(){
var _62=this._editor.get_document().getElementsByTagName("SPAN");
for(var i=0;i<_62.length;i++){
var _64=_62[i];
if(this.isHighlightedWord(_64)){
return true;
}
}
return false;
},getCurrentWrongWord:function(){
var _65=this._selectedEditorElement;
var _66=_65.innerHTML.replace(/<\/?[^>]*>/ig,"");
return _66;
},isHighlightedWord:function(_67){
if(!_67||!_67.getAttribute){
return false;
}
var id=_67.getAttribute("id");
if(id&&id.indexOf(this._spanId)>-1){
return true;
}
return false;
},clearHighlightedElement:function(_69,_6a,_6b){
var _6c=true;
if(_69!=this._selectedEditorElement){
_6c=false;
}
var _6d=_6a?_6a:_69.innerHTML.replace(/<\/?[^>]*>/ig,"");
var _6e=_6a?true:false;
this._editor.selectElement(_69,false);
var _6f=new Telerik.Web.UI.Editor.GenericCommand(this._localizedName,this._editor.get_contentWindow());
var _70=this._editor.get_document().createTextNode(_6d);
_69.parentNode.replaceChild(_70,_69);
if(this._editor.isIE){
if(_6b){
this._editor.setActive();
}else{
range=this._editor.get_contentArea().createTextRange();
range.findText(_70.data);
range.select();
}
}else{
this._editor.selectElement(_70,false);
}
this._editor.getSelection().collapse();
if(_6e){
this._editor.executeCommand(_6f);
}
if(_6c){
this._selectedEditorElement=null;
}
},markWrongWords:function(_71){
var _72=function(_73,_74,_75,_76){
this.badWords=_73;
this._wordOffsets=_74;
this._spanId=_75;
this.Content=_76;
this.CurrentWordIndex=0;
this.Result=null;
};
_72.prototype={GetSplitContent:function(){
var _77=new Array(this.badWords.length*2+1);
for(var i=0;i<this.badWords.length;i++){
var _79=i*2;
_77[_79]=this.GetBeforeText(i);
_77[_79+1]=this.badWords[i].wordString;
}
_77[_77.length-1]=this.GetLastText();
return _77;
},GetMarkedSplitContent:function(_7a){
for(var i=1;i<_7a.length;i+=2){
_7a[i]=this.GetMarkedWord(_7a[i]);
this.CurrentWordIndex++;
}
return _7a;
},GetBeforeText:function(_7c){
var _7d=0;
var _7e=this.GetWordStartIndex(this.badWords[_7c]);
if(_7c!=0){
badWordBefore=this.badWords[_7c-1];
_7d=this.GetWordEndCharIndex(badWordBefore);
}
return this.Content.substring(_7d,_7e);
},GetLastText:function(){
var _7f=this.badWords[this.badWords.length-1];
var _80=this.GetWordEndCharIndex(_7f);
var _81=this.Content.length;
return this.GetSubContent(_80,_81);
},GetWordEndCharIndex:function(_82){
return this.GetWordStartIndex(_82)+_82.wordString.length;
},GetSubContent:function(_83,_84){
return this.Content.substring(_83,_84);
},GetWordStartIndex:function(_85){
return this._wordOffsets[_85.textOffset];
},GetMarkedWord:function(_86){
return "<span class='RadEWrongWord' id='"+this._spanId+this.CurrentWordIndex+"'>"+_86+"</span>";
},GetResult:function(){
if(this.Result==null){
this.Result=this.GetMarkedSplitContent(this.GetSplitContent()).join("");
}
return this.Result;
}};
var _87=new _72(this._wrongWordsArray,this._wordOffsets,this._spanId,this._escapeNewLines(_71));
Telerik.Web.UI.Editor.Utils.setElementInnerHtml(this._editor.get_contentArea(),this._unescapeNewLines(_87.GetResult()));
},_escapeNewLines:function(_88){
var _89=_88.replace(/\n/gi,"<telerikcr />");
_89=_89.replace(/\r/gi,"<teleriklf />");
return _89;
},_unescapeNewLines:function(_8a){
var _8b=_8a.replace(/\<telerikcr\s*\/\>/gi,"\n");
var _8b=_8b.replace(/\<teleriklf\s*\/\>/gi,"\r");
return _8b;
},_getSuggestionsForWord:function(_8c){
var _8d=this._wrongWordsArray;
for(var i=0;i<_8d.length;i++){
var _8f=_8d[i].wordString;
if(_8f==_8c){
var _90=_8d[i].suggestionsString;
if(_90.length==0){
return [["",this._noSuggestionsString]];
}else{
_90=_90.concat([]);
for(var j=0;j<_90.length;j++){
_90[j]=[_90[j],_90[j]];
}
}
return _90;
}
}
return [];
},_get_footerItems:function(_92){
var _93=[];
if(this._editor.get_spellAllowAddCustom()){
_93.splice(0,0,["rade_add_to_dictionary",this._addToDictionaryString,this._addIconCss]);
}
_93.splice(0,0,["rade_change",this._changeWordString,this._okIconCss]);
if(this._occursMoreThanOnce(_92)){
_93.splice(0,0,["rade_ignore_all",this._ignoreAllString,this._ignoreIconCss]);
}
_93.splice(0,0,["",this._ignoreString,this._ignoreIconCss]);
return _93;
},_occursMoreThanOnce:function(_94){
var _95=this._editor.get_text();
var re=new RegExp("(\\b)"+_94+"(\\b)","g");
var res=_95.match(re);
return (res&&res.length>1);
},fire:function(_98,_99){
var _9a=_99.SelectedValue;
var _9b=this._selectedEditorElement&&this._selectedEditorElement.innerHTML?this._selectedEditorElement.innerHTML:"";
if(_9a=="rade_add_to_dictionary"){
if(_9b.length>0){
this.onAddCustomWord(this.getCurrentWrongWord());
}
}else{
if(_9a=="rade_ignore_all"){
this.clearWrongWords(_9b,"");
}else{
if(_9a=="rade_change"){
this._showSuggestionBox(this._selectedEditorElement);
return;
}else{
var _9c=false;
if(_9a){
var _9d=this._occursMoreThanOnce(_9b);
if(_9d){
var _9e=confirm(this._moreThanOnceMessage);
if(_9e){
this.clearWrongWords(_9b,_9a);
_9c=true;
}
}
}
if(!_9c){
this.clearHighlightedElement(this._selectedEditorElement,_9a,true);
}
}
}
}
var res=this.isHighlightedRemaining();
if(!res){
this.onSpellCheckComplete();
return;
}
this._editor.raiseEvent("selectionChange",Sys.EventArgs.Empty);
if(this._automaticAdvance){
this.moveToNextWrongWord();
}
},_onDropDownValueSelected:function(_a0,_a1){
var _a2=_a0.get_selectedItem();
this.fire("",{SelectedValue:_a2});
},_onDropDownBeforeShow:function(_a3,_a4){
var _a5=this.getCurrentWrongWord();
var _a6=this._getSuggestionsForWord(_a5);
_a3.set_items(_a6);
},_showSuggestionDropdown:function(){
var _a7=this._editor;
var _a8=_a7.getSelection().getParentElement();
if(!this.isHighlightedWord(_a8)){
return;
}
this._selectedEditorElement=_a8;
var _a9=this.getCurrentWrongWord();
if(!this._suggestionDropdown){
this._onDropDownValueSelectedDelegate=Function.createDelegate(this,this._onDropDownValueSelected);
this._onDropDownBeforeShowDelegate=Function.createDelegate(this,this._onDropDownBeforeShow);
var _aa={"valueSelected":this._onDropDownValueSelectedDelegate,"show":this._onDropDownBeforeShowDelegate};
var _ab={};
_ab["popupwidth"]="160px";
_ab["parentElement"]=_a7.get_contentAreaElement();
_ab["skin"]=_a7.get_skin();
_ab["sizetofit"]=true;
var _ac=$create(Telerik.Web.UI.EditorSpellSuggestionBox,_ab,_aa,null,document.createElement("SPAN"));
this._suggestionDropdown=_ac;
}
var _ac=this._suggestionDropdown;
_ac.hide();
_ac.set_footerItems(this._get_footerItems(_a9));
_ac.set_wrongWordWrapper(_a8);
_ac.show();
_ac.selectNextItem();
if(_a7.isIE){
_a7.setFocus();
}
},_onTextboxValueSelected:function(_ad,_ae){
var val=_ad.get_selectedItem();
this._editor.setFocus();
this.fire("",{SelectedValue:val});
},_showSuggestionBox:function(_b0){
var _b1=this._editor;
if(!this._suggestionBox){
this._onTextboxValueSelectedDelegate=Function.createDelegate(this,this._onTextboxValueSelected);
var _b2={"valueSelected":this._onTextboxValueSelectedDelegate};
var _b3={};
_b3["parentElement"]=_b1.get_contentAreaElement();
_b3["skin"]=_b1.get_skin();
_b3["sizetofit"]=true;
var _b4=$create(Telerik.Web.UI.EditorAjaxSpellTextbox,_b3,_b2,null,document.createElement("SPAN"));
this._suggestionBox=_b4;
}
var _b5=this._suggestionBox;
var _b6=this.getCurrentWrongWord();
window.setTimeout(function(){
_b5.set_wrongWordWrapper(_b0);
_b5.show();
_b5.setValue(_b6);
},10);
}};
Telerik.Web.UI.EditorSpellSuggestionBox=function(_b7){
Telerik.Web.UI.EditorSpellSuggestionBox.initializeBase(this,[_b7]);
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(_b8){
this._footerItems=_b8;
},renderChildren:function(){
Telerik.Web.UI.EditorSpellSuggestionBox.callBaseMethod(this,"renderChildren");
var _b9=20;
var _ba=this._items.length>this._maxItemSize?this._maxItemSize:this._items.length;
var _bb=_ba>1?(_ba*_b9):25;
var div=document.createElement("DIV");
div.style.overflow="auto";
div.style.height=_bb+"px";
div.className="rade_AjaxSpellCheckSuggestions";
var _bd=this._itemRootElement;
_bd.cellSpacing="0";
var _be=_bd.parentNode;
_be.removeChild(_bd);
div.appendChild(_bd);
div.style.overflowX="hidden";
div.style.width="100%";
var _bf=this.renderItemRoot();
_bf.cellSpacing="0";
_be.appendChild(_bf);
this.renderNewRow();
var _c0=this.renderItemContainer();
_c0.appendChild(div);
var _c1=document.createElement("DIV");
_c1.className="rade_AjaxSpellCheckSeparator";
_c0.appendChild(_c1);
var _c2=this._items.length;
for(var i=0;i<this._footerItems.length;i++){
this.renderNewRow();
var _c4=this.renderItemContainer();
this.markItemContainer(_c4,_c2);
this.renderChild(_c4,this._footerItems[i],_c2);
_c2++;
}
this._items=this._items.concat(this._footerItems);
},configurePopupPropertiesBeforeShow:function(){
var _c5=this._popupBehavior;
_c5.set_positioningMode(Telerik.Web.PositioningMode.Absolute);
var _c6=this.get_parentElement();
if(_c6){
_c5.set_parentElement(_c6);
}
var _c7=this.get_wrongWordWrapper();
if(_c7){
var _c8=$telerik.getBounds(_c7);
_c5.set_x(_c8.x);
_c5.set_y(_c8.y+_c8.height);
}
},get_parentElement:function(){
return this._parentElement;
},set_parentElement:function(_c9){
this._parentElement=_c9;
},get_maxItemSize:function(){
return this._maxItemSize;
},set_maxItemSize:function(_ca){
this._maxItemSize=_ca;
},get_wrongWordWrapper:function(){
return this._wrongWordWrapper;
},set_wrongWordWrapper:function(_cb){
this._wrongWordWrapper=_cb;
}};
Telerik.Web.UI.EditorSpellSuggestionBox.registerClass("Telerik.Web.UI.EditorSpellSuggestionBox",Telerik.Web.UI.EditorSplitButton);
Telerik.Web.UI.EditorAjaxSpellTextbox=function(_cc){
Telerik.Web.UI.EditorAjaxSpellTextbox.initializeBase(this,[_cc]);
};
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(_cd){
if(this._textElement){
this._textElement.value=_cd;
}
var _ce=this._textElement;
try{
if(_ce){
_ce.focus();
}
if(_ce&&_ce.setActive){
_ce.setActive();
var _cf=document.selection.createRange();
_cf.moveStart("word",1);
_cf.select();
_cf.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 _d0=this._popupBehavior;
var _d1=this.get_wrongWordWrapper();
if(_d1){
var _d2=$telerik.getBounds(_d1);
_d0.set_y(_d2.y);
}
},renderChildren:function(){
},renderItemRoot:function(){
this._createBox();
this._itemRootElement=this._element;
return this._itemRootElement;
},_createBox:function(){
var _d3=document.createElement("INPUT");
_d3.setAttribute("size","20");
_d3.Parent=this;
var _d4=function(e,_d6,_d7){
if(_d7){
if(_d6.Executed){
_d6.Executed=false;
return $telerik.cancelRawEvent(e);
}
}
_d6.Executed=true;
_d6.Parent.fire();
return $telerik.cancelRawEvent(e);
};
_d3.onclick=new Function("this.focus();");
_d3.onkeypress=function(e){
if(!e){
e=window.event;
}
if(e&&e.keyCode==13){
return _d4(e,this);
}
};
this._textElement=_d3;
var _d9=document.createElement("div");
var _da=document.createElement("button");
_da.onmousedown=new Function("e","return false;");
_da.onclick=new Function("e","this.parentNode.getElementsByTagName('input')[0].Parent.fire();return false;");
_da.className="rade_ajaxspell_okicon";
_d9.appendChild(_d3);
_d9.appendChild(_da);
this._element=_d9;
return this._element;
}};
Telerik.Web.UI.EditorAjaxSpellTextbox.registerClass("Telerik.Web.UI.EditorAjaxSpellTextbox",Telerik.Web.UI.EditorSpellSuggestionBox);

