function AdfAgent(version, domWindow) {
  this.Init(AdfAgent.UNKNOWN_PLATFORM, AdfAgent.guessOS(), version, domWindow)
}
AdfAgent.setInstance = function(instance) {
  AdfAgent.AGENT = AdfAgent["AGENT"] = instance
};
AdfObject.createSubclass(AdfAgent);
AdfAgent.IE_PLATFORM = "ie";
AdfAgent.GECKO_PLATFORM = "gecko";
AdfAgent.WEBKIT_PLATFORM = "webkit";
AdfAgent.OPERA_PLATFORM = "opera";
AdfAgent.EDGE_PLATFORM = "edge";
AdfAgent.UNKNOWN_PLATFORM = "unknown";
AdfAgent.WINDOWS_OS = "Windows";
AdfAgent.SOLARIS_OS = "Solaris";
AdfAgent.MAC_OS = "Mac";
AdfAgent.UNKNOWN_OS = "Unknown";
AdfAgent.ANDROID_OS = "Android";
AdfAgent.CAP_TOUCH_SCREEN = "touchScreen";
AdfAgent.CAP_TOUCH_SCREEN_NONE = "none";
AdfAgent.CAP_TOUCH_SCREEN_SINGLE = "single";
AdfAgent.CAP_TOUCH_SCREEN_MULTIPLE = "multiple";
AdfAgent._LOG_WRITERS = null;
AdfAgent.getAgent = function(domWindow) {
  if(!AdfAgent._agent) {
    AdfAssert.assert(domWindow != null);
    var version;
    try {
      var userAgent = navigator.userAgent;
      var agentClassName = AdfAgent.getAgentClassNameFromAgentString(userAgent);
      var agentClass = window[agentClassName];
      if(agentClass == null) {
        AdfLogger.LOGGER.severe(AdfAgent._AGENT_CLASS_NAME_NOT_FOUND, agentClassName);
        agentClass = this
      }
      version = agentClass.__getAgentVersion(userAgent);
      var supported = agentClass.__getSupported(userAgent, version);
      if(checkAgentSupport && !supported) {
        alert(AdfAgent._UNSUPPORTED_BROWSER_ALERT)
      }
      var specificAgentClassName = agentClass.__getSpecificAgentClassName(userAgent, version);
      var specificAgentClass = window[specificAgentClassName];
      if(specificAgentClass == null) {
        AdfLogger.LOGGER.severe(AdfAgent._AGENT_CLASS_NAME_NOT_FOUND, specificAgentClassName);
        AdfAgent._agent = new AdfAgent(version, domWindow)
      }else {
        AdfAgent._agent = new specificAgentClass(version, domWindow)
      }
    }catch(e) {
      AdfAgent._agent = new AdfAgent(version, domWindow);
      AdfLogger.LOGGER.logError(e, AdfLogger.SEVERE, "Unable to initialize specific AdfAgent")
    }
  }
  return AdfAgent._agent
};
AdfAgent.getAgentClassNameFromAgentString = function(userAgent) {
  var name = "AdfAgent";
  if(userAgent.indexOf("Opera") != -1) {
    name = "AdfOperaAgent"
  }else {
    if(userAgent.indexOf("Trident") != -1) {
      name = "AdfIEAgent"
    }else {
      if(userAgent.indexOf("MSIE") != -1) {
        name = "AdfIEAgent"
      }else {
        if(userAgent.indexOf("Edge") != -1) {
          name = "AdfEdgeAgent"
        }else {
          if(userAgent.indexOf("AppleWebKit") != -1 || userAgent.indexOf("Safari") != -1) {
            name = "AdfSafariAgent"
          }else {
            if(userAgent.indexOf("Gecko/") != -1) {
              name = "AdfGeckoAgent"
            }
          }
        }
      }
    }
  }
  return name
};
AdfAgent.guessOS = function() {
  var agentName = navigator.userAgent.toLowerCase();
  if(agentName.indexOf("win") != -1) {
    return AdfAgent.WINDOWS_OS
  }else {
    if(agentName.indexOf("mac") != -1) {
      return AdfAgent.MAC_OS
    }else {
      if(agentName.indexOf("sunos") != -1) {
        return AdfAgent.SOLARIS_OS
      }else {
        if(agentName.indexOf("android") != -1) {
          return AdfAgent.ANDROID_OS
        }
      }
    }
  }
};
AdfAgent.guessVersion = function() {
  return parseFloat(navigator.appVersion)
};
AdfAgent.InitClass = function() {
  AdfAgent._agent = null;
  var keyEvents = AdfAgent.KEY_EVENTS;
  for(var eventIndex = 0;eventIndex < keyEvents.length;eventIndex++) {
    keyEvents[keyEvents[eventIndex]] = eventIndex
  }
  var modifierDisplayStrings = new Array;
  modifierDisplayStrings[AdfKeyStroke.CTRL_MASK] = "Ctrl";
  modifierDisplayStrings[AdfKeyStroke.SHIFT_MASK] = "Shift";
  modifierDisplayStrings[AdfKeyStroke.ALT_MASK] = "Alt";
  modifierDisplayStrings[AdfKeyStroke.META_MASK] = "Meta";
  this._MODIFIER_DISPLAY_NAMES = modifierDisplayStrings;
  this._SETTABLE_STYLE_PROPS = null
};
AdfAgent.prototype.Init = function(platform, os, version, domWindow) {
  AdfAgent.superclass.Init.call(this);
  if(!platform) {
    platform = AdfAgent.UNKNOWN_PLATFORM
  }
  if(!os) {
    os = AdfAgent.UNKNOWN_OS
  }
  this._platform = platform;
  this._os = os;
  this._version = version;
  this._window = domWindow;
  this._document = domWindow.document;
  this._oldBodyCursor = null;
  this._busyCursorShown = false;
  var c = this._capabilities = {};
  c[AdfAgent.CAP_TOUCH_SCREEN] = this.GetTouchCapability();
  this._modernize()
};
AdfAgent.prototype.GetTouchCapability = function() {
  var touchCapability = AdfAgent.CAP_TOUCH_SCREEN_NONE;
  if(navigator.maxTouchPoints) {
    touchCapability = navigator.maxTouchPoints > 1 ? AdfAgent.CAP_TOUCH_SCREEN_MULTIPLE : AdfAgent.CAP_TOUCH_SCREEN_SINGLE
  }
  return touchCapability
};
AdfAgent.prototype._modernize = function() {
  AdfAgent._addIfNotPresent(Array.prototype, {every:AdfAgent._arrayEvery, filter:AdfAgent._arrayFilter, forEach:AdfAgent._arrayForEach, indexOf:AdfAgent._arrayIndexOf, lastIndexOf:AdfAgent._arrayLastIndexOf, map:AdfAgent._arrayMap, reduce:AdfAgent._arrayReduce, reduceRight:AdfAgent._arrayReduceRight, some:AdfAgent._arraySome});
  AdfAgent._addIfNotPresent(Array, {isArray:AdfAgent._arrayIsArray})
};
AdfAgent._addIfNotPresent = function(target, funcMap) {
  for(i in funcMap) {
    if(!target[i]) {
      target[i] = funcMap[i]
    }
  }
};
AdfAgent._arrayEvery = function(everyFunc, thisArg) {
  return AdfAgent._arrayVisit(everyFunc, thisArg, false, true)
};
AdfAgent._arrayForEach = function(someFunc, thisArg) {
  AdfAgent._arrayVisit(someFunc, thisArg, true, false)
};
AdfAgent._arraySome = function(someFunc, thisArg) {
  return AdfAgent._arrayVisit(someFunc, thisArg, true, true)
};
AdfAgent._arrayVisit = function(everyFunc, thisArg, breakIf, breakEarly) {
  var length = this.length;
  for(var i = 0;i < length;i++) {
    if(i in this) {
      var value = this[i];
      var funcResult = everyFunc.call(thisArg, value, i, this);
      if(funcResult === breakIf && breakEarly) {
        return breakIf
      }
    }
  }
  return!breakIf
};
AdfAgent._arrayIndexOf = function(searchValue, startIndex) {
  var length = this.length;
  if(!startIndex) {
    startIndex = 0
  }else {
    if(startIndex < 0) {
      startIndex = length + startIndex;
      if(startIndex < 0) {
        startIndex = 0
      }
    }
  }
  for(var i = startIndex;i < length;i++) {
    if(i in this && this[i] === searchValue) {
      return i
    }
  }
  return-1
};
AdfAgent._arrayLastIndexOf = function(searchValue, startIndex) {
  var length = this.length;
  if(startIndex === undefined || startIndex > length) {
    startIndex = length
  }else {
    if(startIndex < 0) {
      startIndex = length + startIndex
    }
  }
  for(var i = startIndex;i >= 0;i--) {
    if(i in this && this[i] === searchValue) {
      return i
    }
  }
  return-1
};
AdfAgent._arrayFilter = function(filterFunc, thisArg) {
  var filteredArray = [];
  var length = this.length;
  for(var i = 0;i < length;i++) {
    if(i in this) {
      var value = this[i];
      if(filterFunc.call(thisArg, value, i, this)) {
        filteredArray.push(value)
      }
    }
  }
  return filteredArray
};
AdfAgent._arrayMap = function(mapFunc, thisArg) {
  var mappedArray = [];
  var length = this.length;
  for(var i = 0;i < length;i++) {
    if(i in this) {
      var value = this[i];
      mappedArray[i] = mapFunc.call(thisArg, value, i, this)
    }
  }
  return mappedArray
};
AdfAgent._arrayReduce = function(reduceFunc, initialValue) {
  var length = this.length;
  var prevValue = initialValue;
  if(length > 0) {
    var i = 0;
    if(arguments.length == 1) {
      for(;i < length;i++) {
        if(i in this) {
          prevValue = this[i];
          i++;
          break
        }
      }
    }
    for(;i < length;i++) {
      if(i in this) {
        prevValue = reduceFunc(prevValue, this[i], i, this)
      }
    }
  }
  return prevValue
};
AdfAgent._arrayReduceRight = function(reduceFunc, initialValue) {
  var length = this.length;
  var prevValue = initialValue;
  if(length > 0) {
    var i = length - 1;
    if(arguments.length == 1) {
      for(;i >= 0;i--) {
        if(i in this) {
          prevValue = this[i];
          i--;
          break
        }
      }
    }
    for(;i >= 0;i--) {
      if(i in this) {
        prevValue = reduceFunc(prevValue, this[i], i, this)
      }
    }
  }
  return prevValue
};
AdfAgent._arrayIsArray = function(target) {
  return Object.prototype.toString.call(target) === "[object Array]"
};
AdfAgent.prototype.createXMLHttpRequest = function() {
  if(window.XMLHttpRequest) {
    return new XMLHttpRequest
  }else {
    return null
  }
};
AdfAgent.prototype.isInlineDialogRepositioningOnScroll = function() {
  if(AdfPage.PAGE.isPortlet()) {
    return false
  }
  return true
};
AdfAgent.prototype.removeResizeListener = function(id) {
  AdfAssert.assertString(id);
  var resizeEventMap = this._resizeEventMap;
  AdfAssert.assertObject(resizeEventMap, "no resize listeners registered");
  var domElement = this.getElementById(id);
  if(domElement) {
    var resizeEvents = this.GetResizeEvents();
    var onResizeHandlerCallback = this._onResizeHandlerCallback;
    AdfAssert.assertFunction(onResizeHandlerCallback, "no resize listeners registered");
    for(var i = 0;i < resizeEvents.length;i++) {
      this.removeBubbleEventListener(domElement, resizeEvents[i], onResizeHandlerCallback)
    }
  }
  AdfAssert.assertObject(resizeEventMap[id], "no resize listener registered by id, " + id);
  delete resizeEventMap[id]
};
AdfAgent.prototype.addResizeListener = function(id, listener) {
  AdfAssert.assertString(id);
  AdfAssert.assertFunction(listener);
  var domElement = this.getElementById(id);
  AdfAssert.assertDomNode(domElement);
  var resizeEventMap = this._resizeEventMap;
  if(!resizeEventMap) {
    resizeEventMap = this._resizeEventMap = {}
  }
  if(resizeEventMap[id]) {
    AdfAssert.assert(false, "already registered by id, " + id)
  }
  var onResizeHandlerCallback = this._onResizeHandlerCallback;
  if(!onResizeHandlerCallback) {
    onResizeHandlerCallback = this._onResizeHandlerCallback = this.createCallback(this._onResizeHandler)
  }
  resizeEventMap[id] = {listener:listener, origOffsetWidth:domElement.offsetWidth, origOffsetHeight:domElement.offsetHeight};
  var resizeEvents = this.GetResizeEvents();
  for(var i = 0;i < resizeEvents.length;i++) {
    this.addBubbleEventListener(domElement, resizeEvents[i], onResizeHandlerCallback)
  }
};
AdfAgent.prototype._onResizeHandler = function(event) {
  var resizeEventMap = this._resizeEventMap;
  AdfAssert.assertObject(resizeEventMap, "no resize listeners registered");
  var domElement = this.getEventTarget(event);
  AdfAssert.assertDomNode(domElement, "resize dom node not found");
  var resizeEventContext;
  var id;
  while(domElement) {
    id = domElement.id;
    if(id && (resizeEventContext = resizeEventMap[id])) {
      break
    }else {
      domElement = domElement.parentNode
    }
  }
  if(resizeEventContext && !resizeEventContext.onResizeTimeout) {
    var page = AdfPage.PAGE;
    var state = {id:id, myself:this};
    if(resizeEventContext.origOffsetWidth != domElement.offsetWidth || resizeEventContext.origOffsetHeight != domElement.offsetHeight) {
      resizeEventContext.onResizeTimeout = page.scheduleTimer(this, AdfAgent._onResizeHandlerTimeout, state, 100)
    }
  }
};
AdfAgent._onResizeHandlerTimeout = function(state) {
  var myself = state.myself;
  var id = state.id;
  var resizeEventMap = myself._resizeEventMap;
  AdfAssert.assertObject(resizeEventMap, "no resize listeners registered");
  var resizeEventContext = resizeEventMap[id];
  if(!resizeEventContext) {
    return
  }
  var domElement = myself.getElementById(id);
  if(!domElement) {
    delete resizeEventMap[id];
    return
  }
  if(resizeEventContext.origOffsetWidth != domElement.offsetWidth || resizeEventContext.origOffsetHeight != domElement.offsetHeight) {
    resizeEventContext.listener();
    resizeEventContext.origOffsetWidth = domElement.offsetWidth;
    resizeEventContext.origOffsetHeight = domElement.offsetHeight
  }
  delete resizeEventContext.onResizeTimeout
};
AdfAgent.prototype.GetResizeEvents = function() {
  return AdfAgent._RESIZE_EVENTS
};
AdfAgent.prototype.getPlatform = function() {
  return this._platform
};
AdfAgent.prototype.getOS = function() {
  return this._os
};
AdfAgent.prototype.getVersion = function() {
  return this._version
};
AdfAgent.prototype.getDomWindow = function() {
  return this._window
};
AdfAgent.prototype.getDomDocument = function() {
  return this._document
};
AdfAgent.prototype.atLeast = function(platform, version) {
  return(!platform || platform == this.getPlatform()) && (!version || version <= this.getVersion())
};
AdfAgent.prototype.getElementById = function(id) {
  return this._document.getElementById(id)
};
AdfAgent.prototype.getElementsByName = function(name) {
  return this._document.getElementsByName(name)
};
AdfAgent.prototype.elementsRemoved = function(element) {
};
AdfAgent.prototype.allElementsRemoved = function() {
};
AdfAgent.prototype.isSessionStorageEnabled = function(propKey) {
  if(this._isSessionStorageEnabled === undefined) {
    try {
      sessionStorage.setItem("_adfTestKey", "on");
      sessionStorage.removeItem("_adfTestKey");
      this._isSessionStorageEnabled = true
    }catch(e) {
      AdfLogger.LOGGER.fine("Access to sessionStorage failed for some unexpected reason. As " + "a result user activity monitoring has been disabled. Name: " + e.name + ", Message: " + e.message);
      this._isSessionStorageEnabled = false
    }
  }
  return this._isSessionStorageEnabled
};
AdfAgent.prototype.getSessionStorageProperty = function(propKey) {
  AdfAssert.assertString(propKey);
  try {
    return sessionStorage.getItem(propKey)
  }catch(e) {
    AdfLogger.LOGGER.logErrorAsInfo(e, "An error occurred trying to access DOM sessionStorage.");
    throw e;
  }
};
AdfAgent.prototype.removeSessionStorageProperty = function(propKey) {
  AdfAssert.assertString(propKey);
  try {
    sessionStorage.removeItem(propKey)
  }catch(e) {
    AdfLogger.LOGGER.logErrorAsInfo(e, "An error occurred trying to access DOM sessionStorage.");
    throw e;
  }
};
AdfAgent.prototype.setSessionStorageProperty = function(propKey, propValue) {
  AdfAssert.assertString(propKey);
  AdfAssert.assertString(propValue);
  try {
    sessionStorage.setItem(propKey, propValue)
  }catch(e) {
    AdfLogger.LOGGER.logErrorAsInfo(e, "An error occurred trying to access DOM sessionStorage.");
    throw e;
  }
};
AdfAgent.prototype.elementsAdded = function(element) {
};
AdfAgent.prototype.getDescendantComponentsForNode = function(node, children) {
  if(!children) {
    children = new Array
  }
  if(node.firstChild) {
    var page = AdfPage.PAGE;
    var idNodes = this.getDomDocument().evaluate(".//*[@id]", node, null, XPathResult.ANY_TYPE, null);
    var currNode = idNodes.iterateNext();
    while(currNode) {
      var comp = page.findComponent(currNode.id);
      if(comp) {
        children.push(comp)
      }
      currNode = idNodes.iterateNext()
    }
  }
  return children
};
AdfAgent.prototype.setTextContent = function(node, newText) {
  AdfAssert.assertDomNode(node);
  if(newText === null) {
    newText = ""
  }
  node.textContent = newText
};
AdfAgent.prototype.getTextContent = function(node) {
  return node.textContent
};
AdfAgent.prototype.setButtonTextContent = function(node, newText) {
  this.setTextContent(node, newText)
};
AdfAgent.prototype.getWindowHeight = function() {
  return this._window.innerHeight
};
AdfAgent.prototype.getWindowWidth = function() {
  return this._window.innerWidth
};
AdfAgent.prototype.getElementLeft = function(element) {
  AdfAssert.assertDomElement(element);
  var boundingRect = element.getBoundingClientRect();
  var elemLeft = boundingRect["left"];
  var docElement = element.ownerDocument.documentElement;
  elemLeft -= docElement.clientLeft - this.getBrowserViewportScrollLeft();
  return elemLeft
};
AdfAgent.prototype.getElementTop = function(element) {
  AdfAssert.assertDomElement(element);
  var boundingRect = element.getBoundingClientRect();
  var elemTop = boundingRect["top"];
  var docElement = element.ownerDocument.documentElement;
  elemTop -= docElement.clientTop - this.getBrowserViewportScrollTop();
  return elemTop
};
AdfAgent.prototype.getElementPageBounds = function(domElement) {
  AdfAssert.assertDomElement(domElement);
  var boundingRect = domElement.getBoundingClientRect();
  var docElement = domElement.ownerDocument.documentElement;
  deltaX = docElement.clientLeft - this.getBrowserViewportScrollLeft();
  deltaY = docElement.clientTop - this.getBrowserViewportScrollTop();
  return{"top":boundingRect.top - deltaY, "left":boundingRect.left - deltaX, "bottom":boundingRect.bottom - deltaY, "right":boundingRect.right - deltaX}
};
AdfAgent.prototype.pointInElementBounds = function(element, pageX, pageY) {
  var pageTop = this.getElementTop(element);
  if(pageY >= pageTop) {
    var pageLeft = this.getElementLeft(element);
    if(pageX >= pageLeft) {
      return pageY <= pageTop + element.offsetHeight && pageX <= pageLeft + element.offsetWidth
    }
  }
  return false
};
AdfAgent.prototype.pointInElementOrChildBounds = function(element, pageX, pageY) {
  return this.pointInElementBounds(element, pageX, pageY)
};
AdfAgent.getCSSLengthAsInt = function(cssLength) {
  if(typeof cssLength === "number") {
    return cssLength
  }
  if(cssLength.length > 0 && cssLength != "auto") {
    var intLength = parseInt(cssLength);
    if(isNaN(intLength)) {
      intLength = 0
    }
    return intLength
  }else {
    return 0
  }
};
AdfAgent.prototype.getBoxSizing = function(element, currentStyle) {
  if(!currentStyle) {
    currentStyle = this.getComputedStyle(element)
  }
  return currentStyle.boxSizing
};
AdfAgent.prototype.getOuterWidth = function(element, innerWidth, currentStyle) {
  if(!currentStyle) {
    currentStyle = this.getComputedStyle(element)
  }
  if(this.getBoxSizing(element, currentStyle) == "border-box") {
    return innerWidth
  }
  var cssLengthAsInt = AdfAgent.getCSSLengthAsInt;
  var width = innerWidth + cssLengthAsInt(currentStyle.paddingLeft) + cssLengthAsInt(currentStyle.paddingRight) + cssLengthAsInt(currentStyle.marginLeft) + cssLengthAsInt(currentStyle.marginRight);
  if(element.tagName.toUpperCase() != "TABLE") {
    width += cssLengthAsInt(currentStyle.borderLeftWidth) + cssLengthAsInt(currentStyle.borderRightWidth)
  }
  return width
};
AdfAgent.prototype.getOuterHeight = function(element, innerHeight, currentStyle) {
  if(!currentStyle) {
    currentStyle = this.getComputedStyle(element)
  }
  if(this.getBoxSizing(element, currentStyle) == "border-box") {
    return innerHeight
  }
  var cssLengthAsInt = AdfAgent.getCSSLengthAsInt;
  var height = innerHeight - cssLengthAsInt(currentStyle.paddingTop) + cssLengthAsInt(currentStyle.paddingBottom) + cssLengthAsInt(currentStyle.marginTop) + cssLengthAsInt(currentStyle.marginBottom);
  if(element.tagName.toUpperCase() != "TABLE") {
    height += cssLengthAsInt(currentStyle.borderTopWidth) + cssLengthAsInt(currentStyle.borderBottomWidth)
  }
  return height
};
AdfAgent.prototype.setOuterWidth = function(element, outerWidth) {
  var currentStyle = this.getComputedStyle(element);
  if(this.getBoxSizing(element, currentStyle) == "border-box") {
    element.style.width = outerWidth + "px";
    return
  }
  var width = this._getOuterWidth(element, outerWidth, currentStyle);
  element.style.width = width + "px"
};
AdfAgent.prototype.setOuterMaxWidth = function(element, outerMaxWidth) {
  var currentStyle = this.getComputedStyle(element);
  if(this.getBoxSizing(element, currentStyle) == "border-box") {
    element.style.maxWidth = outerMaxWidth + "px";
    return
  }
  var maxWidth = this._getOuterWidth(element, outerMaxWidth, currentStyle);
  element.style.maxWidth = maxWidth + "px"
};
AdfAgent.prototype._getOuterWidth = function(element, outerWidth, currentStyle) {
  var cssLengthAsInt = AdfAgent.getCSSLengthAsInt;
  var width = outerWidth - cssLengthAsInt(currentStyle.paddingLeft) - cssLengthAsInt(currentStyle.paddingRight) - cssLengthAsInt(currentStyle.marginLeft) - cssLengthAsInt(currentStyle.marginRight);
  if(element.tagName.toUpperCase() != "TABLE") {
    width -= cssLengthAsInt(currentStyle.borderLeftWidth) + cssLengthAsInt(currentStyle.borderRightWidth)
  }
  if(width < 0) {
    width = 0
  }
  return width
};
AdfAgent.prototype.getDomForCSSPropertyName = function(cssPropertyName) {
  var cssToDomPropertyNameMap = this.GetCssToDomPropertyNameMap();
  var domPropertyName = cssToDomPropertyNameMap[cssPropertyName];
  if(domPropertyName) {
    return domPropertyName
  }
  var words = cssPropertyName.split("-");
  len = words.length;
  var camelCasedStyle = words[0];
  for(var j = 1;j < len;j++) {
    camelCasedStyle += words[j].charAt(0).toUpperCase() + words[j].substring(1)
  }
  return camelCasedStyle
};
AdfAgent.prototype.GetCssToDomPropertyNameMap = function() {
  return AdfAgent._CSS_TO_DOM_MAP
};
AdfAgent.prototype.getStyleProperty = function(style, propertyName) {
  return style.getPropertyValue(propertyName)
};
AdfAgent.prototype.setOuterHeight = function(element, outerHeight) {
  var currentStyle = this.getComputedStyle(element);
  if(this.getBoxSizing(element, currentStyle) == "border-box") {
    element.style.height = outerHeight + "px";
    return
  }
  var height = this._getOuterHeight(element, outerHeight, currentStyle);
  element.style.height = height + "px"
};
AdfAgent.prototype.setOuterMaxHeight = function(element, outerHeight) {
  var currentStyle = this.getComputedStyle(element);
  if(this.getBoxSizing(element, currentStyle) == "border-box") {
    element.style.maxHeight = outerHeight + "px";
    return
  }
  var maxHeight = this._getOuterHeight(element, outerHeight, currentStyle);
  element.style.maxHeight = maxHeight + "px"
};
AdfAgent.prototype._getOuterHeight = function(element, outerHeight, currentStyle) {
  var cssLengthAsInt = AdfAgent.getCSSLengthAsInt;
  var height = outerHeight - cssLengthAsInt(currentStyle.paddingTop) - cssLengthAsInt(currentStyle.paddingBottom) - cssLengthAsInt(currentStyle.marginTop) - cssLengthAsInt(currentStyle.marginBottom);
  if(element.tagName.toUpperCase() != "TABLE") {
    height -= cssLengthAsInt(currentStyle.borderTopWidth) + cssLengthAsInt(currentStyle.borderBottomWidth)
  }
  if(height < 0) {
    height = 0
  }
  return height
};
AdfAgent.prototype.getWindowClientWidth = function(domWindow) {
  return domWindow.document.documentElement.clientWidth
};
AdfAgent.prototype.getWindowClientHeight = function(domWindow) {
  return domWindow.document.documentElement.clientHeight
};
AdfAgent.prototype.getWindowScrollWidth = function(domWindow) {
  return domWindow.document.documentElement.scrollWidth
};
AdfAgent.prototype.getWindowScrollHeight = function(domWindow) {
  return domWindow.document.documentElement.scrollHeight
};
AdfAgent.prototype.getBrowserViewportScrollTop = function() {
  var domDoc = this.getDomDocument();
  var docElement = domDoc.documentElement;
  return docElement.scrollTop
};
AdfAgent.prototype.getBrowserViewportScrollLeft = function() {
  var domDoc = this.getDomDocument();
  var docElement = domDoc.documentElement;
  return docElement.scrollLeft
};
AdfAgent.prototype.getOverrideStyle = function(element) {
  var mutableStyle = element.style;
  if(!mutableStyle) {
    element.setAttribute("style", "");
    mutableStyle = element.getAttribute("style")
  }
  return mutableStyle
};
AdfAgent.prototype.getComputedStyle = function(element) {
  return element.ownerDocument.defaultView.getComputedStyle(element, null)
};
AdfAgent.prototype.copyStyle = function(sourceElement, targetElement) {
  AdfAssert.assertDomElement(targetElement);
  AdfAssert.assertDomElement(sourceElement);
  var targetStyle = targetElement.style;
  var sourceStyle = this.getComputedStyle(sourceElement);
  var settableStyleProps = AdfAgent._SETTABLE_STYLE_PROPS;
  if(settableStyleProps == null) {
    settableStyleProps = new Array;
    var regexFilter = /^[^0-9]/;
    for(var styleProp in sourceStyle) {
      var styleValue = sourceStyle[styleProp];
      if(styleProp != "cssText" && typeof styleValue != "function" && regexFilter.test(styleProp)) {
        try {
          if(styleValue != null && styleValue.length > 0) {
            targetStyle[styleProp] = styleValue
          }
        }catch(e) {
          continue
        }
        settableStyleProps.push(styleProp)
      }
    }
    AdfAgent._SETTABLE_STYLE_PROPS = settableStyleProps
  }else {
    var propCount = settableStyleProps.length;
    for(var i = 0;i < propCount;i++) {
      var currProp = settableStyleProps[i];
      if(sourceStyle[currProp] != null && sourceStyle[currProp].length > 0) {
        targetStyle[currProp] = sourceStyle[currProp]
      }
    }
  }
};
AdfAgent.prototype.addBubbleEventListener = function(nodeOrWindow, eventType, listener) {
  AdfAssert.assertString(eventType);
  AdfAssert.assertFunction(listener);
  nodeOrWindow.addEventListener(eventType, listener, false)
};
AdfAgent.prototype.removeBubbleEventListener = function(nodeOrWindow, eventType, listener) {
  AdfAssert.assertString(eventType);
  AdfAssert.assertFunction(listener);
  nodeOrWindow.removeEventListener(eventType, listener, false)
};
AdfAgent.prototype.addEventCaptures = function(node, listener) {
  AdfAssert.assertDomNode(node);
  AdfAssert.assertFunction(listener);
  var events = AdfAgent.REDISTRIBUTE_EVENTS;
  var eventCount = events.length;
  for(var eventIndex = 0;eventIndex < eventCount;eventIndex++) {
    node.addEventListener(events[eventIndex], listener, true)
  }
};
AdfAgent.prototype.removeEventCaptures = function(node, listener) {
  AdfAssert.assertDomNode(node);
  AdfAssert.assertFunction(listener);
  var events = AdfAgent.REDISTRIBUTE_EVENTS;
  var eventCount = events.length;
  for(var eventIndex = 0;eventIndex < eventCount;eventIndex++) {
    node.removeEventListener(events[eventIndex], listener, true)
  }
};
AdfAgent.prototype.addEventBubbles = function(node, listener) {
  AdfAgent._addEventListeners(node, AdfAgent.REDISTRIBUTE_EVENTS, listener, false);
  AdfAgent._addEventListeners(node, AdfAgent._REDISTRIBUTE_CAPTURE_EVENTS, listener, true);
  if(this._capabilities[AdfAgent.CAP_TOUCH_SCREEN] != AdfAgent.CAP_TOUCH_SCREEN_NONE) {
    AdfAgent._addEventListeners(node, AdfAgent._REDISTRIBUTE_TOUCH_EVENTS, listener, false)
  }
};
AdfAgent.prototype.removeEventBubbles = function(node, listener) {
  AdfAgent._removeEventListeners(node, AdfAgent.REDISTRIBUTE_EVENTS, listener, false);
  AdfAgent._removeEventListeners(node, AdfAgent._REDISTRIBUTE_CAPTURE_EVENTS, listener, true);
  if(this._capabilities[AdfAgent.CAP_TOUCH_SCREEN] != AdfAgent.CAP_TOUCH_SCREEN_NONE) {
    AdfAgent._removeEventListeners(node, AdfAgent._REDISTRIBUTE_TOUCH_EVENTS, listener, false)
  }
};
AdfAgent.prototype.addKeyEventListener = function(element, listener) {
  element.addEventListener("keydown", listener, false)
};
AdfAgent.prototype.removeKeyEventListener = function(element, listener) {
  element.removeEventListener("keydown", listener, false)
};
AdfAgent.prototype.startDocumentKeyEventCapture = function(listenerMap, focusProxy) {
  AdfAssert.assert(listenerMap);
  AdfAssert.assertDomElement(focusProxy);
  var ownerDoc = focusProxy.ownerDocument;
  var keyEvents = AdfAgent.KEY_EVENTS;
  var eventCount = keyEvents.length;
  for(var eventIndex = 0;eventIndex < eventCount;eventIndex++) {
    var currEventName = keyEvents[eventIndex];
    var currListener = listenerMap[currEventName];
    if(currListener) {
      AdfAssert.assertFunction(currListener);
      ownerDoc.addEventListener(currEventName, currListener, true)
    }
  }
  return null
};
AdfAgent.prototype.endDocumentKeyEventCapture = function(listenerMap, focusProxy) {
  AdfAssert.assert(listenerMap);
  AdfAssert.assertDomElement(focusProxy);
  var ownerDoc = focusProxy.ownerDocument;
  var keyEvents = AdfAgent.KEY_EVENTS;
  var eventCount = keyEvents.length;
  for(var eventIndex = 0;eventIndex < eventCount;eventIndex++) {
    var currEventName = keyEvents[eventIndex];
    ownerDoc.removeEventListener(currEventName, listenerMap[currEventName], true)
  }
};
AdfAgent.prototype.beginDirtyStateTracking = function(component, domElement) {
  AdfLogger.LOGGER.warning("Deprecated usage of AdfAgent beginDirtyStateTracking")
};
AdfAgent.prototype.endDirtyStateTracking = function(component, domElement) {
  AdfLogger.LOGGER.warning("Deprecated usage of AdfAgent endDirtyStateTracking")
};
AdfAgent.prototype.isDirty = function(component, domElement) {
  AdfLogger.LOGGER.warning("Deprecated usage of AdfAgent isDirty");
  var element = domElement == null ? component.getPeer().getDomElement() : domElement;
  var dirtyStateService = AdfPage.PAGE.getDirtyStateService();
  return dirtyStateService.hasDirtyData(element)
};
AdfAgent.prototype.setDirty = function(component, domElement, dirty) {
  AdfLogger.LOGGER.warning("Deprecated usage of AdfAgent setDirty");
  AdfPage.PAGE.getDirtyStateService().setDirty(component, true)
};
AdfAgent.prototype.getKeyCode = function(keyEvent) {
  return keyEvent.keyCode
};
AdfAgent.prototype.isFunctionKey = function(keyEvent) {
  return keyEvent.charCode == 0
};
AdfAgent.prototype.getModifierDisplayName = function(modifier) {
  return AdfAgent._MODIFIER_DISPLAY_NAMES[modifier]
};
AdfAgent.prototype.getEventTarget = function(event) {
  return event.target
};
AdfAgent.prototype._getEventRelatedTarget = function(nativeEvent) {
  var relatedTarget = nativeEvent.relatedTarget;
  try {
    if(relatedTarget && relatedTarget.nodeType) {
      return relatedTarget
    }
  }catch(e) {
    relatedTarget = null
  }
  return relatedTarget
};
AdfAgent.prototype.getEventToElement = function(nativeEvent) {
  var domEventType = nativeEvent.type;
  if(domEventType == "mouseover") {
    return this.getEventTarget()
  }else {
    if(domEventType == "mouseout") {
      return this._getEventRelatedTarget(nativeEvent)
    }
  }
  return null
};
AdfAgent.prototype.getEventFromElement = function(nativeEvent) {
  var domEventType = nativeEvent.type;
  if(domEventType == "mouseover") {
    return this._getEventRelatedTarget(nativeEvent)
  }else {
    if(domEventType == "mouseout") {
      return this.getEventTarget()
    }
  }
  return null
};
AdfAgent.prototype.getComponentEvent = function(component, nativeEvent, prevComponent) {
  var type = this.mapNativeToComponentEventType(nativeEvent.type);
  if(type) {
    if(type == AdfComponentEvent.FOCUS_EVENT_TYPE) {
      if(prevComponent === undefined) {
        return new AdfDomComponentEvent(component, type, nativeEvent)
      }
      return new AdfDomComponentFocusEvent(prevComponent, component, type, nativeEvent)
    }else {
      if(type == AdfComponentEvent.BLUR_EVENT_TYPE) {
        return new AdfDomComponentEvent(component, type, nativeEvent)
      }else {
        if(type == AdfComponentEvent.CONTEXT_MENU_EVENT_TYPE) {
          return new AdfDomShowContextMenuEvent(component, type, nativeEvent)
        }else {
          if(AdfAgent._NATIVE_TOUCH_TO_COMPONENT_MAPPINGS[nativeEvent.type] != undefined) {
            return new AdfComponentTouchEvent(component, type, nativeEvent)
          }else {
            return this.CreateUIInputEvent(component, type, nativeEvent)
          }
        }
      }
    }
  }else {
    AdfLogger.LOGGER.warning("unmapped event:", AdfUIUtils.getPropertiesAsString(nativeEvent));
    return null
  }
};
AdfAgent.prototype.CreateUIInputEvent = function(component, type, nativeEvent) {
  return new AdfDomUIInputEvent(component, type, nativeEvent)
};
AdfAgent.prototype.elementFromPagePoint = function(pageX, pageY, hintElement, exclusionContext, exclusionCallback) {
  AdfAssert.assertNumber(pageX);
  AdfAssert.assertNumber(pageY);
  AdfAssert.assertFunctionOrNull(exclusionCallback);
  var theDocument = this._document;
  var bodyElement = theDocument.body;
  var excludeChild = null;
  if(hintElement) {
    if(hintElement.parentNode != theDocument.documentElement) {
      var checkElement = hintElement;
      hintElement = null;
      do {
        if(this.pointInElementBounds(checkElement, pageX, pageY)) {
          if(!hintElement) {
            hintElement = checkElement
          }else {
            if(this.pointInElementChrome(checkElement, pageX, pageY)) {
              hintElement = checkElement
            }
          }
        }else {
          hintElement = null;
          excludeChild = checkElement
        }
        checkElement = checkElement.parentNode
      }while(checkElement != bodyElement)
    }else {
      hintElement = null
    }
  }
  if(hintElement) {
    if(this.pointInElementChrome(hintElement, pageX, pageY)) {
      return hintElement
    }
  }
  var data = {target:hintElement, zIndex:0, done:false};
  this._elementFromPagePointImpl(hintElement ? hintElement : bodyElement, pageX, pageY, data, false, excludeChild, exclusionContext, exclusionCallback);
  var elementAtPoint = data.target;
  if(!elementAtPoint) {
    data.zIndex = 0;
    this._elementFromPagePointImpl(bodyElement, pageX, pageY, data, true, null, exclusionContext, exclusionCallback);
    elementAtPoint = data.target
  }
  return elementAtPoint
};
AdfAgent.prototype._elementFromPagePointImpl = function(fromElem, x, y, data, ignoreParentBounds, excludeChild, exclusionContext, exclusionCallback) {
  var currChild = fromElem.firstChild;
  while(currChild && !data.done) {
    if(currChild.nodeType == 1 && currChild != excludeChild && (exclusionCallback == null || !exclusionCallback.call(exclusionContext, currChild))) {
      var childStyle = this.getComputedStyle(currChild);
      if(childStyle && childStyle.display != "none") {
        var childZIndex = childStyle.zIndex;
        if(childZIndex == "auto") {
          childZIndex = null
        }
        if(childStyle.visibility != "hidden" && (childZIndex && childZIndex >= data.zIndex || !childZIndex && data.zIndex < 1)) {
          var checkChildren = ignoreParentBounds;
          var targetIsSet = false;
          var top = this.getElementTop(currChild);
          if(top <= y) {
            var offsetHeight = currChild.offsetHeight;
            var zeroHeight = offsetHeight == 0;
            if(zeroHeight || top + offsetHeight >= y) {
              var left = this.getElementLeft(currChild);
              if(left <= x) {
                var offsetWidth = currChild.offsetWidth;
                var zeroWidth = offsetWidth == 0;
                if(zeroWidth || left + offsetWidth >= x) {
                  checkChildren = true;
                  targetIsSet = !zeroWidth && !zeroHeight;
                  if(this.pointInElementChrome(currChild, x, y)) {
                    targetIsSet = true;
                    data.done = true
                  }
                  if(targetIsSet) {
                    data.target = currChild
                  }
                }
              }
            }
          }
          if(checkChildren && !data.done) {
            var oldZIndex;
            var oldTarget;
            if(!targetIsSet) {
              oldTarget = data.target;
              oldZIndex = data.zIndex
            }
            if(childZIndex) {
              data.zIndex = childZIndex
            }
            this._elementFromPagePointImpl(currChild, x, y, data, ignoreParentBounds, null, exclusionContext, exclusionCallback);
            if(!targetIsSet && oldTarget == data.target) {
              data.zIndex = oldZIndex
            }
          }
        }
      }
    }
    currChild = currChild.nextSibling
  }
};
AdfAgent.prototype.getNodeType = function(element) {
  if(element) {
    return element.nodeType
  }
  return undefined
};
AdfAgent.prototype.getNodeName = function(element) {
  return element.nodeName
};
AdfAgent.prototype.getLocalName = function(element) {
  return element.localName
};
AdfAgent.prototype.getNodeXml = function(node) {
  var serializer = new XMLSerializer;
  var xmlString = serializer.serializeToString(node);
  return xmlString
};
AdfAgent.prototype.getPrefix = function(element) {
  return element.prefix
};
AdfAgent.prototype.isElementHTML = function(element) {
  AdfAssert.assertDomNode(element);
  return true
};
AdfAgent.prototype.setCssFloat = function(element, value) {
  element.style.cssFloat = value
};
AdfAgent.prototype.getAttributeName = function(attr) {
  return attr.name
};
AdfAgent.prototype.getAttribute = function(node, attrName) {
  return node.getAttribute(attrName)
};
AdfAgent.prototype.hasAttribute = function(element, attribute) {
  AdfAssert.assertDomElement(element);
  return element.hasAttribute(attribute.name)
};
AdfAgent.prototype.isAttributeSpecified = function(attribute) {
  return attribute.specified
};
AdfAgent.prototype.replaceNode = function(sourceNode, targetNode) {
  return targetNode.parentNode.replaceChild(sourceNode, targetNode)
};
AdfAgent.prototype.setAttribute = function(element, attrName, attrValue) {
  var propValue = element[attrName];
  if(propValue == undefined || typeof propValue != "boolean" || attrValue != "false") {
    element.setAttribute(attrName, attrValue)
  }
};
AdfAgent.prototype.getIntAttribute = function(element, attrName, defaultValue) {
  AdfAssert.assertDomElement(element);
  if(defaultValue == undefined) {
    defaultValue = null
  }
  if(element.hasAttribute(attrName)) {
    var value = element.getAttribute(attrName);
    value = parseInt(value);
    if(isNaN(value)) {
      value = defaultValue;
      AdfLogger.LOGGER.warning("The value of attribute named ", attrName, " cannot be converted into an integer.")
    }
  }else {
    value = defaultValue
  }
  return value
};
AdfAgent.prototype.getBooleanAttribute = function(element, attrName, defaultValue) {
  AdfAssert.assert(element);
  if(defaultValue == undefined) {
    defaultValue = null
  }
  var value = element.getAttribute(attrName);
  if(value == null) {
    value = defaultValue
  }else {
    if(value == "true") {
      value = true
    }else {
      if(value == "false") {
        value = false
      }else {
        value = defaultValue;
        AdfLogger.LOGGER.warning("The value of attribute named ", attrName, " cannot be converted into a boolean.")
      }
    }
  }
  return value
};
AdfAgent.prototype.enableUserSelect = function(element) {
};
AdfAgent.prototype.disableUserSelect = function(element) {
};
AdfAgent.prototype.createTouchMoveManager = function(element, handlerCallback, touchCount) {
  return new AdfTouchMoveManager(element, handlerCallback, touchCount)
};
AdfAgent.prototype.stopPropagation = function(evt) {
  evt.stopPropagation()
};
AdfAgent.prototype.preventDefault = function(evt) {
  evt.preventDefault()
};
AdfAgent.prototype.isDefaultPrevented = function(evt) {
  return evt.defaultPrevented
};
AdfAgent.prototype.eatEvent = function(evt) {
  this.stopPropagation(evt);
  this.preventDefault(evt)
};
AdfAgent.prototype.getMousePosition = function(evt) {
  if((evt.type == "touchstart" || evt.type == "touchmove") && evt.targetTouches && evt.targetTouches.length > 0) {
    var touchEvt = evt.targetTouches[0];
    return{x:touchEvt.pageX, y:touchEvt.pageY}
  }
  if(evt.type == "touchend" && evt.changedTouches && evt.changedTouches.length > 0) {
    var touchEvt = evt.changedTouches[0];
    return{x:touchEvt.pageX, y:touchEvt.pageY}
  }
  return{x:evt.pageX, y:evt.pageY}
};
AdfAgent.prototype.isEventInElement = function(event, element) {
  var mousePosition = this.getMousePosition(event);
  var elementPosition = this.getElementPosition(element);
  var mouseX = mousePosition.x;
  var elementX = elementPosition.x;
  if(mouseX >= elementX && mouseX <= elementX + element.offsetWidth) {
    var mouseY = mousePosition.y;
    var elementY = elementPosition.y;
    if(mouseY >= elementY && mouseY <= elementY + element.offsetHeight) {
      return true
    }
  }
  return false
};
AdfAgent.prototype.getElementPosition = function(element) {
  AdfAssert.assertDomElement(element);
  var boundingRect = element.getBoundingClientRect();
  var elemTop = boundingRect["top"];
  var elemLeft = boundingRect["left"];
  var docElement = element.ownerDocument.documentElement;
  elemLeft -= docElement.clientLeft - this.getBrowserViewportScrollLeft();
  elemTop -= docElement.clientTop - this.getBrowserViewportScrollTop();
  return{"x":elemLeft, "y":elemTop}
};
AdfAgent.prototype.isMouseEvent = function(event) {
  return AdfAgent._MOUSE_EVENTS[event.type] != undefined
};
AdfAgent.prototype.isKeyboardEvent = function(event) {
  if(event != null) {
    return AdfAgent._KEYBOARD_EVENTS[event.type] != undefined
  }
  return false
};
AdfAgent.prototype.isChromeEvent = function(domEvent) {
  return false
};
AdfAgent.prototype.pointInElementChrome = function(element, pageX, pageY) {
  return false
};
AdfAgent.prototype.cloneEvent = function(event, newTarget) {
  if(this.isMouseEvent(event) || this.isKeyboardEvent(event)) {
    var eventType = event.type;
    var newEvent;
    if(this.isMouseEvent(event)) {
      newEvent = this._copyMouseEvent(event, eventType, newTarget)
    }else {
      if(this.isKeyboardEvent(event)) {
        newEvent = this._copyKeyboardEvent(event, eventType, newTarget)
      }
    }
    var targetNode = newTarget ? newTarget : event.target;
    var targetDocument = targetNode.ownerDocument;
    targetDocument.addEventListener(eventType, this.stopPropagation, true);
    try {
      targetNode.dispatchEvent(newEvent)
    }finally {
      targetDocument.removeEventListener(eventType, this.stopPropagation, true)
    }
    return newEvent
  }else {
    return event
  }
};
AdfAgent.prototype.copyEvent = function(event) {
  if(this.isMouseEvent(event) || event.type == "contextmenu") {
    var eventType = event.type;
    newEvent = this._copyMouseEvent(event, eventType);
    return newEvent
  }else {
    return event
  }
};
AdfAgent.prototype._copyMouseEvent = function(event, eventType, newTarget) {
  var targetNode = newTarget ? newTarget : event.target;
  var targetDocument = targetNode.ownerDocument;
  var newEvent = targetDocument.createEvent("MouseEvents");
  newEvent.initMouseEvent(eventType, event.bubbles, event.cancelable, targetDocument.contentWindow, event.detail, event.screenX, event.screenY, event.clientX, event.clientY, event.ctrlKey, event.altKey, event.shiftKey, event.metaKey, event.button, event.relatedTarget);
  return newEvent
};
AdfAgent.prototype._copyKeyboardEvent = function(event, eventType, newTarget) {
  var targetNode = newTarget ? newTarget : event.target;
  var targetDocument = targetNode.ownerDocument;
  var newEvent = targetDocument.createEvent("Event");
  newEvent.initEvent(eventType, true, true);
  newEvent.altGraphKey = event.altGraphKey;
  newEvent.altKey = event.altKey;
  newEvent.ctrlKey = event.ctrlKey;
  newEvent.keyCode = event.keyCode;
  newEvent.keyIdentifier = event.keyIdentifier;
  newEvent.keyLocation = event.keyLocation;
  newEvent.shiftKey = event.shiftKey;
  newEvent.view = event.view;
  newEvent.which = event.which;
  return newEvent
};
AdfAgent.prototype.dispatchEvent = function(targetElement, event) {
  return targetElement.dispatchEvent(event)
};
AdfAgent.prototype.checkMouseOutEvent = function(element, evt) {
  var inside = false;
  var pos = this.getElementPosition(element);
  var mousePos = this.getMousePosition(evt);
  inside = mousePos.x > pos.x && mousePos.x < pos.x + element.offsetWidth && mousePos.y > pos.y && mousePos.y < pos.y + element.offsetHeight;
  return!inside
};
AdfAgent.prototype.isLeftButton = function(evt) {
  return evt.button == 0
};
AdfAgent.prototype.isSelectionToggle = function(evt) {
  var isToggle = false;
  var isMac = AdfAgent.MAC_OS == this.getOS();
  if(isMac && evt.metaKey) {
    isToggle = true
  }else {
    if(!isMac && evt.ctrlKey) {
      isToggle = true
    }
  }
  return isToggle
};
AdfAgent.prototype.disableSelectionToggleOnEditableCell = function() {
  return false
};
AdfAgent.prototype.isLeftButtonClick = function(evt) {
  return evt.type == "click"
};
AdfAgent.prototype.startMouseEventCapture = function(listenerMap) {
  for(type in listenerMap) {
    if(!(type in AdfAgent.KEY_EVENTS)) {
      this._document.addEventListener(type, listenerMap[type], true)
    }
  }
};
AdfAgent.prototype.stopMouseEventCapture = function(listenerMap) {
  for(type in listenerMap) {
    if(!(type in AdfAgent.KEY_EVENTS)) {
      this._document.removeEventListener(type, listenerMap[type], true)
    }
  }
};
AdfAgent.prototype.mapNativeToComponentEventType = function(eventType) {
  var baseEvent = AdfAgent._NATIVE_TO_COMPONENT_MAPPINGS[eventType];
  if(baseEvent) {
    return baseEvent
  }
  if(this._capabilities[AdfAgent.CAP_TOUCH_SCREEN] != AdfAgent.CAP_TOUCH_SCREEN_NONE) {
    return AdfAgent._NATIVE_TOUCH_TO_COMPONENT_MAPPINGS[eventType]
  }
};
AdfAgent.prototype.createDefaultLogWriter = function() {
  var nativeLogWriter = this.CreateNativeLogWriter();
  var logWritersString = AdfAgent["_LOG_WRITERS"];
  var domWindow = this._window;
  var logWriterCtor = domWindow[logWritersString];
  if(typeof logWriterCtor == "function" && AdfLogWriter.prototype.isPrototypeOf(logWriterCtor.prototype)) {
    return new logWriterCtor(domWindow, nativeLogWriter)
  }else {
    if(logWritersString != "NativeLogWriter") {
      AdfLogger.LOGGER.warning('"', AdfAgent.logWritersString, '", is an undefined LogWriter or is not a subclass of AdfLogWriter. ', "Now using the native log writer. Set the Log Writer parameter in the ", "web.xml file to use a specific LogWriter.")
    }
    return this.CreateDefaultLogWriter(nativeLogWriter)
  }
};
AdfAgent.prototype.CreateDefaultLogWriter = function(nativeLogWriter) {
  if(AdfAssert.DEBUG) {
    return new AdfConsoleLogWriter(this._window, nativeLogWriter)
  }else {
    return nativeLogWriter
  }
};
AdfAgent.prototype.CreateNativeLogWriter = function() {
  return new AdfAlertLogWriter
};
AdfAgent.prototype.setImageSource = function(img, src) {
  img.src = src
};
AdfAgent.prototype.setImageTooltip = function(img, tooltip) {
  img.alt = tooltip
};
AdfAgent.prototype.createXmlDocument = function() {
  return this.getDomDocument().implementation.createDocument("", "", null)
};
AdfAgent.prototype.getFormElement = function(form, elementName) {
  return form.elements[elementName]
};
AdfAgent.prototype.showBusyCursor = function(ownerDocument, show) {
  AdfAssert.assertBoolean(show);
  if(show) {
    if(this._busyCursorShown) {
      return
    }
    this._oldBodyCursor = ownerDocument.body.style.cursor;
    this._busyCursorShown = true;
    ownerDocument.body.style.cursor = "wait"
  }else {
    this._busyCursorShown = false;
    if(ownerDocument.body.style.cursor == "wait") {
      if(!this._oldBodyCursor) {
        this._oldBodyCursor = "auto"
      }
      ownerDocument.body.style.cursor = this._oldBodyCursor
    }
  }
};
AdfAgent.prototype.forceCursorChange = function(ownerDocument) {
};
AdfAgent.prototype.setCursor = function(domElement, cursor, onTargetElement) {
  AdfAssert.assertDomElement(domElement);
  AdfAssert.assertString(cursor);
  domElement.style.cursor = cursor
};
AdfAgent.eatEventCallback = function(event) {
  var agent = AdfAgent.AGENT;
  var targetEvent = event != null ? event : agent.getDomWindow().event;
  if(targetEvent) {
    agent.eatEvent(targetEvent)
  }
  return false
};
AdfAgent.preventDefaultCallback = function(event) {
  var agent = AdfAgent.AGENT;
  var targetEvent = event != null ? event : agent.getDomWindow().event;
  if(targetEvent) {
    agent.preventDefault(targetEvent)
  }
  return false
};
AdfAgent.prototype.installKeyboardBlocker = function(ownerDocument, install) {
  if(install) {
    ownerDocument.addEventListener("keypress", AdfAgent.eatEventCallback, true);
    ownerDocument.addEventListener("keyup", AdfAgent.eatEventCallback, true);
    ownerDocument.addEventListener("keydown", AdfAgent.eatEventCallback, true)
  }else {
    ownerDocument.removeEventListener("keypress", AdfAgent.eatEventCallback, true);
    ownerDocument.removeEventListener("keyup", AdfAgent.eatEventCallback, true);
    ownerDocument.removeEventListener("keydown", AdfAgent.eatEventCallback, true)
  }
};
AdfAgent.prototype.setOpacity = function(element, opacityPercent) {
  element.style.opacity = opacityPercent / 100
};
AdfAgent.prototype.disableBrowserContextMenu = function(ownerDocument, disable) {
  if(disable) {
    this.addBubbleEventListener(ownerDocument, "contextmenu", this.preventDefault)
  }else {
    this.removeBubbleEventListener(ownerDocument, "contextmenu", this.preventDefault)
  }
};
AdfAgent.prototype.execScript = function(ownerWindow, scriptText) {
  ownerWindow.eval(scriptText)
};
AdfAgent.prototype.createStyle = function(content) {
  var style = document.createElement("style");
  style.setAttribute("type", "text/css");
  style.appendChild(document.createTextNode(content));
  var head = AdfDomUtils.getFirstDescendentElement(AdfAgent.AGENT.getDomDocument().documentElement, "HEAD");
  head.appendChild(style);
  return style
};
AdfAgent.prototype.setExpandoProperty = function(element, propertyName, propertyValue) {
  AdfAssert.assertDomElement(element);
  AdfAssert.assertString(propertyName);
  element[propertyName] = propertyValue;
  AdfAssert.assert(this.getExpandoProperty(element, propertyName) == propertyValue)
};
AdfAgent.prototype.getExpandoProperty = function(element, propertyName, defaultValue) {
  AdfAssert.assertDomElement(element);
  AdfAssert.assertString(propertyName);
  var value = element[propertyName];
  if(value != undefined) {
    return value
  }else {
    return defaultValue
  }
};
AdfAgent.prototype.getCursor = function(cursorName) {
  return cursorName
};
AdfAgent.getCSS2Cursor = function(cursorName) {
  return AdfAgent._CSS3_TO_CSS2_MAP[cursorName]
};
AdfAgent.prototype.scrollToPos = function(element, posX, posY) {
  if(posY != null) {
    element.scrollTop = posY
  }
  if(posX != null) {
    element.scrollLeft = posX
  }
};
AdfAgent.prototype.isClipped = function(element) {
  if(element.scrollWidth > element.offsetWidth || element.scrollHeight > element.offsetHeight) {
    return true
  }
  var body = this._document.body;
  if(element == body || element == this._document) {
    return false
  }
  var currParent = element.offsetParent;
  var currLeft = element.offsetLeft;
  var currTop = element.offsetTop;
  var outerWidth = element.offsetWidth;
  var outerHeight = element.offsetHeight;
  var computedStyle = this.getComputedStyle(element);
  var paddingLeft = AdfAgent.getCSSLengthAsInt(computedStyle.paddingLeft);
  var paddingRight = AdfAgent.getCSSLengthAsInt(computedStyle.paddingRight);
  var paddingTop = AdfAgent.getCSSLengthAsInt(computedStyle.paddingTop);
  var paddingBottom = AdfAgent.getCSSLengthAsInt(computedStyle.paddingBottom);
  currTop += paddingTop;
  currLeft += paddingLeft;
  outerHeight -= paddingTop + paddingBottom;
  outerWidth -= paddingLeft + paddingRight;
  var clippingMargin = 2;
  var checkElement = element;
  var isAbsolutePositioned = computedStyle.position == "absolute";
  while(currParent && currParent != body) {
    if(currParent.clientHeight > 0 && currParent.clientWidth > 0) {
      if(currLeft + clippingMargin < currParent.scrollLeft || currTop + clippingMargin < currParent.scrollTop) {
        return true
      }
      if(currLeft + outerWidth - clippingMargin > currParent.scrollLeft + currParent.clientWidth || currTop + outerHeight - clippingMargin > currParent.scrollTop + currParent.clientHeight) {
        if(!isAbsolutePositioned || this.getComputedStyle(currParent).overflow != "visible") {
          return true
        }
      }
    }
    checkElement = currParent;
    var offsetLeft;
    var offsetTop;
    computedStyle = this.getComputedStyle(checkElement);
    if(computedStyle.position == "absolute") {
      offsetLeft = AdfAgent.getCSSLengthAsInt(computedStyle.left);
      offsetTop = AdfAgent.getCSSLengthAsInt(computedStyle.top);
      isAbsolutePositioned = true
    }else {
      offsetLeft = checkElement.offsetLeft;
      offsetTop = checkElement.offsetTop;
      isAbsolutePositioned = false
    }
    currLeft += offsetLeft - checkElement.scrollLeft;
    currTop += offsetTop - checkElement.scrollTop;
    currParent = currParent.offsetParent
  }
  return false
};
AdfAgent.prototype.getPreferredKeyEventForRepetition = function() {
  if(this.getOS() == AdfAgent.MAC_OS) {
    return AdfUIInputEvent.KEY_PRESS_EVENT_TYPE
  }
  return AdfUIInputEvent.KEY_DOWN_EVENT_TYPE
};
AdfAgent.prototype.isDisabledOptionSupported = function() {
  return true
};
AdfAgent.prototype.resizeStretchedChild = function(childElement, parentPadding) {
};
AdfAgent.prototype.resizeStretchedElement = function(element, width, height) {
};
AdfAgent.prototype.prepareStretchedChild = function(childElement, parentPadding) {
  AdfAssert.assert(parentPadding != null, "parent padding not specified");
  var childStyle = childElement.style;
  childStyle.position = "absolute";
  childStyle.width = "auto";
  childStyle.height = "auto";
  childStyle.left = parentPadding;
  childStyle.top = parentPadding;
  childStyle.bottom = parentPadding;
  childStyle.right = parentPadding
};
AdfAgent.prototype.repositionStretchedElement = function(element, topPixels, bottomPixels, leftPixels, rightPixels) {
  if(element) {
    var style = element.style;
    if(topPixels) {
      style.top = topPixels
    }
    if(leftPixels) {
      style.left = leftPixels
    }
    if(bottomPixels) {
      style.height = "auto";
      style.bottom = bottomPixels
    }
    if(rightPixels) {
      style.width = "auto";
      style.right = rightPixels
    }
  }
};
AdfAgent.prototype.isEqualIcon = function(firstIcon, secondIcon) {
  return firstIcon.parentNode.innerHTML == secondIcon.parentNode.innerHTML
};
AdfAgent.prototype.addOption = function(element, label, value, selected, disabled, description, index) {
  var optionElement = this._document.createElement("option");
  element.options.add(optionElement, index);
  if(value != null) {
    optionElement.value = value
  }
  if(label) {
    AdfAgent.AGENT.setTextContent(optionElement, label)
  }
  optionElement.selected = selected;
  optionElement.disabled = disabled;
  if(description) {
    optionElement.title = description
  }
};
AdfAgent.prototype.removeIdsFromDomSubTree = function(subTreeRoot) {
  var rootId = subTreeRoot.id;
  if(rootId != null && rootId != "") {
    subTreeRoot.id = ""
  }
  var rawNodes = subTreeRoot.childNodes;
  for(var nodeIndex = 0, len = rawNodes.length;nodeIndex < len;nodeIndex++) {
    var node = rawNodes[nodeIndex];
    if(node.nodeType == 1) {
      this.removeIdsFromDomSubTree(node)
    }
  }
};
AdfAgent.prototype.modifyIdsInDomSubTree = function(subTreeRoot, prepend, idString) {
  var rootId = subTreeRoot.id;
  if(rootId != null && rootId != "") {
    subTreeRoot.id = prepend ? idString + "::" + rootId : rootId + "::" + idString
  }
  var rawNodes = subTreeRoot.childNodes;
  for(var nodeIndex = 0, len = rawNodes.length;nodeIndex < len;nodeIndex++) {
    var node = rawNodes[nodeIndex];
    if(node.nodeType == 1) {
      this.modifyIdsInDomSubTree(node, prepend, idString)
    }
  }
};
AdfAgent.prototype.removeStyleProperty = function(element, styleProperty) {
  element.style.removeProperty(styleProperty)
};
AdfAgent.prototype.setTableRowHeight = function(row, height) {
  row.style.height = height + "px"
};
AdfAgent.prototype.autoCompleteForm = function(htmlForm) {
};
AdfAgent.prototype.getTableRows = function(tableElement) {
  return tableElement.rows
};
AdfAgent.prototype.getTableRowCells = function(tableRow) {
  return tableRow.cells
};
AdfAgent.prototype.getTableRow = function(tableElement, rowIndex) {
  return tableElement.rows[rowIndex]
};
AdfAgent.prototype.parseXML = function(xmlString) {
  var doc = null;
  if(xmlString && xmlString.length) {
    var parser = new DOMParser;
    try {
      doc = parser.parseFromString(xmlString, "text/xml")
    }catch(e) {
    }
  }
  return doc
};
AdfAgent.prototype.cloneNode = function(domNode) {
  return domNode.cloneNode(true)
};
AdfAgent.prototype.clearSubtreeIds = function(element) {
  if(element.id) {
    element.id = ""
  }
  if(element.name) {
    element.name = ""
  }
  var currChild = element.firstChild;
  while(currChild) {
    if(currChild.nodeType == 1) {
      this.clearSubtreeIds(currChild)
    }
    currChild = currChild.nextSibling
  }
};
AdfAgent.prototype.getCapabilities = function() {
  return this._capabilities
};
AdfAgent.prototype.isDragPrepEvent = function(componentEvent) {
  if(componentEvent instanceof AdfUIInputEvent) {
    var eventType = componentEvent.getType();
    if(eventType == AdfUIInputEvent.MOUSE_DOWN_EVENT_TYPE) {
      return componentEvent.isLeftButtonPressed()
    }
    if(eventType == AdfComponentTouchEvent.TOUCH_START_EVENT_TYPE) {
      return componentEvent.getTouchCount() == 1
    }
  }
  return false
};
AdfAgent.prototype.createContextMenuEventGenerator = function() {
  return new AdfTouchContextMenuManager
};
AdfAgent.prototype.createDraggableNode = function(domNode) {
  var dragContent = this.cloneNode(domNode);
  if(dragContent.nodeType == 1) {
    this.clearSubtreeIds(dragContent)
  }
  AdfDomUtils.addCSSClassName(domNode, AdfAgent.DRAG_GHOST_STYLECLASS);
  this.copyStyle(domNode, dragContent);
  AdfDomUtils.removeCSSClassName(domNode, AdfAgent.DRAG_GHOST_STYLECLASS);
  if(dragContent.nodeType == 1) {
    var ownerDocument = domNode.ownerDocument;
    var sourceTable;
    var localContent;
    if(dragContent.nodeName == "TD" || dragContent.nodeName == "TH") {
      sourceTable = domNode.parentNode.parentNode.parentNode;
      localContent = ownerDocument.createElement("TR");
      localContent.appendChild(dragContent);
      dragContent = localContent
    }
    if(dragContent.nodeName == "TR") {
      if(domNode.nodeName == "TR") {
        sourceTable = domNode.parentNode.parentNode;
        var sourceCells = this.getTableRowCells(domNode);
        var dragCells = this.getTableRowCells(dragContent);
        var ce1lCount = sourceCells.length;
        var useOffsetWidth = this.IsComputedWidthAuto();
        for(var i = 0;i < ce1lCount;i++) {
          if(useOffsetWidth) {
            dragCells[i].width = sourceCells[i].offsetWidth
          }else {
            dragCells[i].style.width = this.getComputedStyle(sourceCells[i]).width
          }
          dragCells[i].noWrap = true
        }
      }
      localContent = ownerDocument.createElement("TBODY");
      localContent.appendChild(dragContent);
      dragContent = localContent
    }
    if(dragContent.nodeName == "TBODY" || dragContent.nodeName == "THEAD" || dragContent.nodeName == "TFOOT") {
      if(!sourceTable) {
        sourceTable = domNode.parentNode
      }
      localContent = ownerDocument.createElement("TABLE");
      localContent.cellSpacing = sourceTable.cellSpacing;
      localContent.cellPadding = sourceTable.cellPadding;
      localContent.border = sourceTable.border;
      this.copyStyle(sourceTable, localContent);
      localContent.appendChild(dragContent);
      dragContent = localContent
    }
  }
  this.CopyDragSize(domNode, dragContent);
  return dragContent
};
AdfAgent.prototype.CopyDragSize = function(sourceElement, clonedElement) {
  var cloneStyle = clonedElement.style;
  cloneStyle.position = "absolute";
  cloneStyle.width = sourceElement.offsetWidth + "px";
  cloneStyle.height = sourceElement.offsetHeight + "px";
  cloneStyle.top = "auto";
  cloneStyle.left = "auto";
  cloneStyle.right = "auto";
  cloneStyle.bottom = "auto";
  if(cloneStyle.margin == "auto") {
    cloneStyle.margin = ""
  }
};
AdfAgent.prototype.IsComputedWidthAuto = function() {
  return false
};
AdfAgent.prototype.showTooltip = function(componentEvent) {
};
AdfAgent.prototype.slice = function(file, startByte, stopByte) {
  if(typeof Blob === "undefined" || typeof Blob.prototype.slice === "undefined") {
    return undefined
  }
  if(file == null) {
    return null
  }
  if(file.slice) {
    return file.slice(startByte, stopByte)
  }
  return undefined
};
AdfAgent.prototype.supportsTransientStyleClasses = function() {
  return true
};
AdfAgent.prototype.getScrollLeft = function(element) {
  AdfAssert.assertDomNode(element);
  if(AdfPage.PAGE.getLocaleContext().isRightToLeft()) {
    return element.scrollWidth - element.scrollLeft - element.clientWidth
  }
  return element.scrollLeft
};
AdfAgent.prototype.setScrollLeft = function(element, value) {
  AdfAssert.assertDomNode(element);
  if(AdfPage.PAGE.getLocaleContext().isRightToLeft()) {
    value = element.scrollWidth - value - element.clientWidth
  }
  element.scrollLeft = value
};
AdfAgent.prototype.toISOString = function(date) {
  AdfAssert.assert(date != null);
  return date.toISOString()
};
AdfAgent.prototype.isTouchFirstDevice = function() {
  if(this.getCapabilities()["touchScreen"] && this.getCapabilities()["touchScreen"] != "none") {
    return true
  }else {
    return false
  }
};
AdfAgent.__getAgentVersion = function(userAgent) {
  return AdfAgent.__parseFloatVersion(userAgent, /Mozilla\/(\d+([.]\d+)*)/)
};
AdfAgent.__getSupported = function(userAgent, version) {
  return false
};
AdfAgent.__getSpecificAgentClassName = function(userAgent, version) {
  return"AdfAgent"
};
AdfAgent.__parseFloatVersion = function(agentName, versionNumberPattern) {
  var matches = agentName.match(versionNumberPattern);
  if(matches) {
    var versionString = matches[1];
    if(versionString) {
      return parseFloat(versionString)
    }
  }
  return undefined
};
AdfAgent._addEventListeners = function(node, eventTypes, listener, capture) {
  AdfAssert.assertDomNode(node);
  AdfAssert.assertArray(eventTypes);
  AdfAssert.assertFunction(listener);
  AdfAssert.assertBoolean(capture);
  var typeCount = eventTypes.length;
  for(var typeIndex = 0;typeIndex < typeCount;typeIndex++) {
    node.addEventListener(eventTypes[typeIndex], listener, capture)
  }
};
AdfAgent._removeEventListeners = function(node, eventTypes, listener, capture) {
  AdfAssert.assertDomNode(node);
  AdfAssert.assertArray(eventTypes);
  AdfAssert.assertFunction(listener);
  AdfAssert.assertBoolean(capture);
  var typeCount = eventTypes.length;
  for(var typeIndex = 0;typeIndex < typeCount;typeIndex++) {
    node.removeEventListener(eventTypes[typeIndex], listener, capture)
  }
};
AdfAgent._NATIVE_TO_COMPONENT_MAPPINGS = {"blur":AdfComponentEvent.BLUR_EVENT_TYPE, "focus":AdfComponentEvent.FOCUS_EVENT_TYPE, "focusin":AdfComponentEvent.FOCUS_EVENT_TYPE, "focusout":AdfComponentEvent.BLUR_EVENT_TYPE, "click":AdfUIInputEvent.CLICK_EVENT_TYPE, "dblclick":AdfUIInputEvent.DOUBLE_CLICK_EVENT_TYPE, "mousedown":AdfUIInputEvent.MOUSE_DOWN_EVENT_TYPE, "mouseup":AdfUIInputEvent.MOUSE_UP_EVENT_TYPE, "mousemove":AdfUIInputEvent.MOUSE_MOVE_EVENT_TYPE, "mouseover":AdfUIInputEvent.MOUSE_IN_EVENT_TYPE, 
"mouseout":AdfUIInputEvent.MOUSE_OUT_EVENT_TYPE, "keydown":AdfUIInputEvent.KEY_DOWN_EVENT_TYPE, "keyup":AdfUIInputEvent.KEY_UP_EVENT_TYPE, "keypress":AdfUIInputEvent.KEY_PRESS_EVENT_TYPE, "contextmenu":AdfComponentEvent.CONTEXT_MENU_EVENT_TYPE};
AdfAgent._NATIVE_TOUCH_TO_COMPONENT_MAPPINGS = {"touchstart":AdfComponentTouchEvent.TOUCH_START_EVENT_TYPE, "touchmove":AdfComponentTouchEvent.TOUCH_MOVE_EVENT_TYPE, "touchend":AdfComponentTouchEvent.TOUCH_END_EVENT_TYPE, "touchcancel":AdfComponentTouchEvent.TOUCH_CANCEL_EVENT_TYPE};
AdfAgent.REDISTRIBUTE_EVENTS = ["click", "dblclick", "keydown", "keypress", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "contextmenu"];
AdfAgent._REDISTRIBUTE_TOUCH_EVENTS = ["touchstart", "touchmove", "touchend", "touchcancel"];
AdfAgent._REDISTRIBUTE_CAPTURE_EVENTS = ["focus", "blur"];
AdfAgent.KEY_EVENTS = ["keydown", "keypress", "keyup"];
AdfAgent._MOUSE_EVENTS = {click:1, dblclick:1, mousedown:1, mouseup:1, mouseover:1, mousemove:1, mouseout:1};
AdfAgent._KEYBOARD_EVENTS = {keydown:1, keyup:1, keypress:1};
AdfAgent._CSS3_TO_CSS2_MAP = {"auto":"auto", "default":"default", "none":"default", "context-menu":"default", "help":"help", "pointer":"pointer", "progress":"wait", "wait":"wait", "cell":"crosshair", "crosshair":"crosshair", "text":"text", "vertical-text":"text", "alias":"crosshair", "copy":"crosshair", "move":"move", "no-drop":"move", "not-allowed":"move ", "e-resize":"e-resize", "n-resize":"n-resize", "ne-resize":"ne-resize", "nw-resize":"nw-resize", "s-resize":"s-resize", "se-resize":"se-resize", 
"sw-resize":"sw-resize", "w-resize":"w-resize", "ew-resize":"e-resize", "ns-resize":"s-resize", "nesw-resize":"move", "col-resize":"e-resize", "row-resize":"s-resize", "all-scroll":"move", "inherit":"inherit"};
AdfAgent._CSS_TO_DOM_MAP = {};
AdfAgent._RESIZE_EVENTS = ["DOMAttrModified", "DOMSubtreeModified"];
AdfAgent.DRAG_GHOST_STYLECLASS = "p_AFDragGhost";
AdfAgent._AGENT_CLASS_NAME_NOT_FOUND = "Falling back to AdfAgent, didn't find agent class name: ";
