function AdfJsfClientBehavior(eventType, script, isSubmitting) {
  this.Init(eventType, script, isSubmitting);
}
AdfObject.createSubclass(AdfJsfClientBehavior, AdfClientBehavior);
AdfJsfClientBehavior.prototype.initialize = function(component) {
  component.addEventListener(this._eventType, this._invokeBehavior, this);
};
AdfJsfClientBehavior.prototype._invokeBehavior = function(event) {
  if (event.isCanceled()) {
    return;
  }
  var nativeEvent = event instanceof AdfDomComponentEvent ? event.getNativeEvent() : AdfPage.PAGE.__getLastDomEvent();
  var result = this._behavior(nativeEvent, event);
  if (result == false || this._submitting && this._eventType == "action") {
    event.cancel();
  }
};
AdfJsfClientBehavior.prototype.Init = function(eventType, script, isSubmitting) {
  AdfJsfClientBehavior.superclass.Init.call(this);
  AdfAssert.assert(script != null);
  this._eventType = eventType;
  if (script && script.indexOf("mojarra") > -1) {
    this._behavior = function anonymous(event, componentEvent) {
      var args = script.substring(script.indexOf("(") + 1, script.lastIndexOf(")"));
      var argsArr = args.split(",");
      mojarra.ab(argsArr[0], event, eventType, argsArr[3], argsArr[4]);
    };
  } else {
    if (script && script.indexOf("return") > -1) {
      this._behavior = function anonymous(event, componentEvent) {
        var funcName = script.substring(script.indexOf(" ") + 1, script.lastIndexOf("("));
        return window[funcName](componentEvent);
      };
    } else {
      this._behavior = new Function("event", "componentEvent", script);
    }
  }
  this._submitting = isSubmitting;
};
