Type.registerNamespace("Telerik.Web.UI");
function GetRadSpell(_1){
return $find(_1);
}
Telerik.Web.UI.RadSpell=function(_2){
Telerik.Web.UI.RadSpell.initializeBase(this,[_2]);
this._dictionaryLanguage=null;
this._languagesDropDown=null;
this._textSource=null;
this._controlToCheck=null;
this._ajaxUrl=null;
this._clientTextSource=null;
};
Telerik.Web.UI.RadSpell.prototype={initialize:function(){
Telerik.Web.UI.RadSpell.callBaseMethod(this,"initialize");
this._languagesDropDown=$get(this.get_id()+"Language");
this._spellCheckButton=$get(this.get_id()+"SpellCheck");
if(this._spellCheckButton){
$addHandlers(this._spellCheckButton,{click:this.startSpellCheck},this);
if(this._spellCheckButton.tagName&&this._spellCheckButton.tagName.toLowerCase()!="input"){
$addHandlers(this._spellCheckButton,{keypress:this.startSpellCheck},this);
}
}
this.set_spellChecked(false);
this.add_clientCheckFinished(this.checkFinishedHandler);
this.add_clientCheckStarted(this.checkStartedHandler);
},dispose:function(){
this._controlToCheck=null;
this._dialogOpener=null;
if(this._spellCheckButton){
$clearHandlers(this._spellCheckButton);
}
this.remove_clientCheckFinished(this.checkFinishedHandler);
this.remove_clientCheckStarted(this.checkStartedHandler);
Telerik.Web.UI.RadSpell.callBaseMethod(this,"dispose");
},checkFinishedHandler:function(_3,_4){
_3.set_spellChecked(true);
},checkStartedHandler:function(_5,_6){
_5.set_spellChecked(false);
},startSpellCheck:function(){
var _7=this.get_textSource();
if(_7!=null){
this.spellCheck(_7);
}else{
alert("Cannot find a TextSource. Please, set the ControlToCheck server-side property, or use the SetTextSource() client-side method.");
}
},spellCheck:function(_8){
var _9=new Sys.CancelEventArgs();
this.raiseEvent("clientCheckStarted",_9);
if(!_9.get_cancel()){
var _a={dictionaryLanguage:this.get_selectedLanguage(),textSource:_8,spell:this};
this.get_dialogOpener().open("SpellCheckDialog",_a);
}
},get_selectedLanguage:function(){
if(this.get_dictionaryLanguage()){
return this.get_dictionaryLanguage();
}
if(!this._languagesDropDown){
return null;
}
var _b=this._languagesDropDown.options[this._languagesDropDown.selectedIndex];
return _b!=null?_b.value:null;
},get_textSource:function(){
if(this._textSource==null){
if(this.get_controlToCheck()){
var _c=document.getElementById(this.get_controlToCheck());
this.set_textSource($create(Telerik.Web.UI.Spell.HtmlElementTextSource,{element:_c},null,null));
}else{
if(this.get_clientTextSource()){
this.set_textSource(eval(this.get_clientTextSource()));
}
}
}
return this._textSource;
},set_textSource:function(_d){
this._textSource=_d;
},get_spellChecked:function(){
return this._spellChecked;
},set_spellChecked:function(_e){
$get(this.get_id()+"SpellChecked").value=_e?"true":"";
this._spellChecked=_e;
},get_dialogOpener:function(){
return this._dialogOpener;
},set_dialogOpener:function(_f){
this._dialogOpener=_f;
},get_dictionaryLanguage:function(){
return this._dictionaryLanguage;
},set_dictionaryLanguage:function(_10){
this._dictionaryLanguage=_10;
},get_controlToCheck:function(){
return this._controlToCheck;
},set_controlToCheck:function(_11){
this._controlToCheck=_11;
},get_clientTextSource:function(){
return this._clientTextSource;
},set_clientTextSource:function(_12){
this._clientTextSource=_12;
},get_ajaxUrl:function(){
return this._ajaxUrl;
},set_ajaxUrl:function(_13){
this._ajaxUrl=_13;
},add_clientDialogClosing:function(_14){
this.get_events().addHandler("clientDialogClosing",_14);
},remove_clientDialogClosing:function(_15){
this.get_events().removeHandler("clientDialogClosing",_15);
},add_clientCheckCancelled:function(_16){
this.get_events().addHandler("clientCheckCancelled",_16);
},remove_clientCheckCancelled:function(_17){
this.get_events().removeHandler("clientCheckCancelled",_17);
},add_clientCheckFinished:function(_18){
this.get_events().addHandler("clientCheckFinished",_18);
},remove_clientCheckFinished:function(_19){
this.get_events().removeHandler("clientCheckFinished",_19);
},add_clientCheckStarted:function(_1a){
this.get_events().addHandler("clientCheckStarted",_1a);
},remove_clientCheckStarted:function(_1b){
this.get_events().removeHandler("clientCheckStarted",_1b);
}};
Telerik.Web.UI.RadSpell.registerClass("Telerik.Web.UI.RadSpell",Telerik.Web.UI.RadWebControl);
Type.registerNamespace("Telerik.Web.UI.Spell");
Telerik.Web.UI.Spell.HtmlElementTextSource=function(_1c){
Telerik.Web.UI.Spell.HtmlElementTextSource.initializeBase(this);
this._element=_1c;
};
Telerik.Web.UI.Spell.HtmlElementTextSource.prototype={initialize:function(){
Telerik.Web.UI.Spell.HtmlElementTextSource.callBaseMethod(this,"initialize");
var _1d=this.get_element();
if(_1d==null){
alert("Could not find target HTML element. Please verify that ControlToCheck points to a valid control.");
this.set_element({value:""});
}else{
if(_1d.nodeName=="IFRAME"&&_1d.contentWindow!=null){
this.set_element(_1d.contentWindow.document.body);
}
}
_1d=null;
},dispose:function(){
this._element=null;
Telerik.Web.UI.Spell.HtmlElementTextSource.callBaseMethod(this,"dispose");
},get_text:function(){
var _1e="";
if(this.get_element().value!=null){
try{
_1e=this.get_element().value;
}
catch(exc){
alert("Error getting text from control.\n"+exc.message);
}
}else{
if(this.get_element().innerHTML!=null){
try{
_1e=this.get_element().innerHTML;
}
catch(exc){
alert("Error getting HTML from the control.\n"+exc.message);
}
}else{
alert("No value or innerHTML attribute. Cannot access text.");
}
}
return _1e;
},set_text:function(_1f){
if(this.get_element()==null){
return;
}
if(this.get_element().value!=null){
this.get_element().value=_1f;
}else{
if(this.get_element().innerHTML!=null){
this.get_element().innerHTML=_1f;
}else{
alert("No value or innerHTML attribute. Cannot access text.");
}
}
},get_element:function(){
return this._element;
},set_element:function(_20){
this._element=_20;
}};
Telerik.Web.UI.Spell.HtmlElementTextSource.registerClass("Telerik.Web.UI.Spell.HtmlElementTextSource",Sys.Component);

