__aspxCaptchaRefreshCommand = "R";
__aspxCaptchaImageIDPostfix = "_IMG";
__aspxCaptchaTextBoxIDPostfix = "_TB";
__aspxCaptchaRefreshButtonIDPostfix = "_RB";
__aspxCaptchaRefreshButtonTextSpanIDPostfix = "_RTS";
ASPxClientCaptcha = _aspxCreateClass(ASPxClientControl, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.refreshButtonOnClick = new Function("aspxCaptchaRefresh('" + this.name + "')");
  var image = this.GetImage();
  _aspxAttachEventToElement(image, "load", new Function("aspxCaptchaImageLoaded('" + this.name + "')"));
  var refreshButton = this.GetRefreshButton();
  if(refreshButton != null)
   _aspxAttachEventToElement(refreshButton, "click", this.refreshButtonOnClick); 
  this.allowMultipleCallbacks = false;
 },
 GetImage: function() {
  return _aspxGetElementById(this.name + __aspxCaptchaImageIDPostfix);
 },
 GetRefreshButton: function() {
  return _aspxGetElementById(this.name + __aspxCaptchaRefreshButtonIDPostfix);
 },
 GetRefreshButtonTextSpan: function() {
  return _aspxGetElementById(this.name + __aspxCaptchaRefreshButtonTextSpanIDPostfix);
 },
 GetEditor: function() {
  return aspxGetControlCollection().Get(this.name + __aspxCaptchaTextBoxIDPostfix);
 },
 HideLoadingPanelOnCallback: function() {
  return false;
 },
 DoBeginCallback: function(command){
  var image = this.GetImage();
  var editor = this.GetEditor();
  var mainElement = this.GetMainElement();
  if(editor != null)
   editor.SetIsValid(true);
  image.style.visibility = "hidden";
  this.CreateLoadingDiv(mainElement, image);
  this.CreateLoadingPanelWithAbsolutePosition(mainElement, image);
  ASPxClientControl.prototype.DoBeginCallback.call(this, command);
 },
 OnCallback: function(result) {
  var image = this.GetImage();
  image.src = result;
  if(__aspxIE && __aspxBrowserVersion < 7) {
   image.alphaImageLoaderApplied = false;
   _aspxApplyAlphaImageLoaderToImage(image);
  }
 },
 SetEnabled: function(enabled) {
  if(enabled == this.clientEnabled)
   return;
  ASPxClientControl.prototype.SetEnabled.call(this, enabled);
  var refreshButton = this.GetRefreshButton();
  if(refreshButton == null)
   return;
  aspxGetStateController().SetElementEnabled(this.GetRefreshButton(), enabled);
  aspxGetStateController().SetElementEnabled(this.GetRefreshButtonTextSpan(), enabled);
  var eventsMethod = _aspxChangeEventsMethod(enabled);
  eventsMethod(refreshButton, "click", this.refreshButtonOnClick);
  refreshButton.style.cursor = enabled ? "pointer" : "default";
 },
 Refresh: function() {
  if(!_aspxIsExists(this.callBack)) {
   if(this.isInitialized)
    this.SendPostBack(__aspxCaptchaRefreshCommand);
   return;
  }
  this.CreateCallback(__aspxCaptchaRefreshCommand);
 }
});
ASPxClientCaptcha.Cast = ASPxClientControl.Cast;
function aspxCaptchaRefresh(name) {
 var control = aspxGetControlCollection().Get(name); 
 if(control != null)
  control.Refresh();
}
function aspxCaptchaImageLoaded(name) {
 var control = aspxGetControlCollection().Get(name); 
 if(control == null)
  return;
 var image = control.GetImage();
 control.HideLoadingDiv();
 control.HideLoadingPanel();
 image.style.visibility = "";
}
