Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.SpellCheckService=function(){Telerik.Web.UI.SpellCheckService.initializeBase(this);
this._url="Telerik.Web.UI.SpellCheckHandler.axd";
this._language="en-US";
this._configuration=null;
};
Telerik.Web.UI.SpellCheckService.prototype={spellCheck:function(a){this._sendRequest(this._getPostData("SpellCheck",a));
},addCustomWord:function(a){this._sendRequest(this._getPostData("AddCustom",a));
},_processResponse:function(b,d){var c=b.get_statusCode();
if(b.get_responseAvailable()&&200==c&&b.get_responseData().length>0){var a=b.get_object();
if(a.badWords!=null){a.badWords=eval(a.badWords);
}if(a.wordOffsets!=null){a.wordOffsets=eval(a.wordOffsets);
}this.raise_complete(b.get_object());
}else{if(b.get_timedOut()){alert("Spell Check Request time out");
}else{if(b.get_aborted()){alert("Spell Check Request aborted");
}else{if(404==c){window.alert("Web.config registration missing!\n The spellchecking functionality requires a HttpHandler registration in web.config. Please, use the control Smart Tag to add the handler automatically, or see the help for more information.\n\n"+this.get_url());
}else{if(c>0&&c!=200){window.alert("Spell Check Handler Server Error:"+c+"\n"+b.get_responseData());
}}}}}},_sendRequest:function(c,a){var b=new Sys.Net.WebRequest();
b.set_url(this.get_url());
b.set_httpVerb("POST");
b.set_body(c);
b.add_completed(Function.createDelegate(this,this._processResponse));
b.invoke();
},_getPostData:function(b,a){return"DictionaryLanguage="+this._encode(this._language)+"&Configuration="+this._encode(this._configuration)+"&CommandArgument="+this.encodePostbackContent(a).replace(/%/g,"~")+"&CommandName="+b;
},_encode:function(d){var c=true;
try{var b=$telerik.isIE?document.charset:document.characterSet;
b=b+"";
if(b&&b.toLowerCase().indexOf("utf")==-1){c=false;
}}catch(a){}return(encodeURIComponent&&c)?encodeURIComponent(d):escape(d);
},initialize:function(){Telerik.Web.UI.SpellCheckService.callBaseMethod(this,"initialize");
},dispose:function(){Telerik.Web.UI.SpellCheckService.callBaseMethod(this,"dispose");
},get_url:function(){return this._url;
},set_url:function(a){this._url=a;
},get_language:function(){return this._language;
},set_language:function(a){this._language=a;
},get_configuration:function(){return this._configuration;
},set_configuration:function(a){this._configuration=a;
},add_complete:function(a){this.get_events().addHandler("complete",a);
},remove_complete:function(a){this.get_events().removeHandler("complete",a);
},raise_complete:function(b){var a=this.get_events().getHandler("complete");
if(a){if(!b){b=Sys.EventArgs.Empty;
}a(this,b);
}},_encodeHtmlContent:function(c,e){var a=new Array("%","<",">","!",'"',"#","$","&","'","(",")",",",":",";","=","?","[","]","\\","^","`","{","|","}","~","+");
var b=c;
var d;
if(e){for(d=0;
d<a.length;
d++){b=b.replace(new RegExp("\\x"+a[d].charCodeAt(0).toString(16),"ig"),"%"+a[d].charCodeAt(0).toString(16));
}}else{for(d=a.length-1;
d>=0;
d--){b=b.replace(new RegExp("%"+a[d].charCodeAt(0).toString(16),"ig"),a[d]);
}}return b;
},encodePostbackContent:function(a){return this._encodeHtmlContent(a,true);
},decodePostbackContent:function(a){return this._encodeHtmlContent(a,false);
}};
Telerik.Web.UI.SpellCheckService.registerClass("Telerik.Web.UI.SpellCheckService",Sys.Component);
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
