function AdfDhtmlNoteWindowPopupSelector(autoDismissType) {
  this.Init(autoDismissType);
}
AdfObject.createSubclass(AdfDhtmlNoteWindowPopupSelector, AdfDhtmlPopupSelector);
AdfDhtmlNoteWindowPopupSelector.InitClass = function() {
  this._STYLE_CLASS = "AFNoteWindow";
  this._RIGHT_STYLE_CLASS = "AFNoteWindowRight";
  this._CONE_STYLE_CLASS = "AFNoteWindowCone";
  this._CONE_STYLE_CLASS_TR = "AFNoteWindowConeTR";
  this._CONE_STYLE_CLASS_BR = "AFNoteWindowConeBR";
  this._CONE_STYLE_CLASS_BL = "AFNoteWindowConeBL";
  this._CONE_BORDER_STYLE_CLASS = "AFNoteWindowConeBorder";
  this._CONE_BORDER_RIGHT_STYLE_CLASS = "AFNoteWindowConeBorderRight";
  this._CONTENT_STYLE_CLASS = "AFNoteWindowContent";
  this._CONTENT_END_ID = "endContent";
};
AdfDhtmlNoteWindowPopupSelector.prototype.Init = function(autoDismissType) {
  AdfDhtmlNoteWindowPopupSelector.superclass.Init.call(this);
  this._autoDismissType = autoDismissType;
  this.setShadowAnchor(this.GetContentParent());
};
AdfDhtmlNoteWindowPopupSelector.prototype.setAccessibleAttrs = function(hints) {
  var wrapper = this.getElement();
  wrapper.setAttribute("role", "tooltip");
  var launchSourceId = null;
  var alignElement = null;
  if (hints) {
    alignElement = hints[AdfDhtmlPopupHints.ALIGN_ELEMENT];
    if (alignElement) {
      alignElement.setAttribute("aria-describedby", wrapper.id);
    } else {
      launchSourceId = hints[AdfRichPopup.HINT_LAUNCH_ID];
      if (launchSourceId) {
        var launchElement = AdfAgent.AGENT.getElementById(launchSourceId);
        if (launchElement) {
          launchElement.setAttribute("aria-describedby", wrapper.id);
        }
      }
    }
  }
};
AdfDhtmlNoteWindowPopupSelector.prototype.announceOpeningViaLiveRegion = function(hints) {
  var laf = AdfPage.PAGE.getLookAndFeel();
  var documentClientId = AdfPage.PAGE.getDocumentClientId();
  var liveContainerId = AdfRichUIPeer.CreateSubId(documentClientId, AdfDhtmlDocumentPeer._GLOBAL_LIVE_CONTAINER_ID);
  var liveContainer = AdfAgent.AGENT.getElementById(liveContainerId);
  var domWindow = AdfPage.PAGE.getDomWindow();
  var liveTextKey = domWindow.AdfSafariMobileAgent && AdfAgent.AGENT instanceof AdfSafariMobileAgent ? "AFTooltipLiveTextMobile" : "AFTooltipLiveText";
  var liveContent = laf.getTranslatedString(liveTextKey);
  AdfAgent.AGENT.setTextContent(liveContainer, liveContent);
};
AdfDhtmlNoteWindowPopupSelector.prototype.removeAccessibleAttrs = function() {
  var alignElement = this.getAlignElement();
  if (alignElement) {
    alignElement.removeAttribute("aria-describedby");
  } else {
    var launchSourceId = this.getLaunchSourceId();
    if (launchSourceId) {
      var launchElement = AdfAgent.AGENT.getElementById(launchSourceId);
      if (launchElement) {
        launchElement.removeAttribute("aria-describedby");
      }
    }
  }
  var documentClientId = AdfPage.PAGE.getDocumentClientId();
  var liveContainerId = AdfRichUIPeer.CreateSubId(documentClientId, AdfDhtmlDocumentPeer._GLOBAL_LIVE_CONTAINER_ID);
  var liveContainer = AdfAgent.AGENT.getElementById(liveContainerId);
  AdfAgent.AGENT.setTextContent(liveContainer, "");
};
AdfDhtmlNoteWindowPopupSelector.prototype.show = function(hints) {
  var launchSourceId = null;
  if (hints) {
    launchSourceId = hints[AdfRichPopup.HINT_LAUNCH_ID];
  }
  if (launchSourceId) {
    var launchElement = AdfAgent.AGENT.getElementById(launchSourceId);
    if (launchElement == null) {
      AdfLogger.LOGGER.warning("Attempting to show noteWindow but lauch element is not present.");
      hints[AdfRichPopup.HINT_LAUNCH_ID] = null;
      launchSourceId = null;
    }
  }
  if (launchSourceId) {
    if (!hints[AdfDhtmlPopupHints.ALIGN_ELEMENT]) {
      hints[AdfRichPopup.HINT_ALIGN_ID] = launchSourceId;
      hints[AdfDhtmlPopupHints.ALIGN_ELEMENT] = AdfAgent.AGENT.getElementById(launchSourceId);
    }
    var page = AdfPage.PAGE;
    var launchSource = page.findComponent(launchSourceId);
    if (launchSource) {
      launchSource.addEventListener(AdfUIInputEvent.KEY_UP_EVENT_TYPE, this._launchSourceHandleComponentKeyUp, this);
      launchSource.addEventListener(AdfUIInputEvent.KEY_DOWN_EVENT_TYPE, this._launchSourceHandleComponentKeyDown, this);
    }
  }
  AdfDhtmlNoteWindowPopupSelector.superclass.show.call(this, hints);
};
AdfDhtmlNoteWindowPopupSelector.prototype.hide = function() {
  var page = AdfPage.PAGE;
  var launchSourceId = this.getLaunchSourceId();
  if (launchSourceId) {
    var launchSource = page.findComponent(launchSourceId);
    if (launchSource) {
      launchSource.removeEventListener(AdfUIInputEvent.KEY_UP_EVENT_TYPE, this._launchSourceHandleComponentKeyUp, this);
      launchSource.removeEventListener(AdfUIInputEvent.KEY_DOWN_EVENT_TYPE, this._launchSourceHandleComponentKeyDown, this);
    }
  }
  AdfDhtmlNoteWindowPopupSelector.superclass.hide.call(this);
};
AdfDhtmlNoteWindowPopupSelector.createTextDom = function(noteText) {
  var noteTextDom = null;
  if (noteText.indexOf("\x3chtml\x3e") == 0 && noteText.lastIndexOf("\x3c/html\x3e") == noteText.length - 7) {
    noteTextDom = AdfDomUtils.cleanHtml(AdfPage.PAGE.getDocument(), noteText.substring(6, noteText.length - 7));
  } else {
    noteTextDom = AdfPage.PAGE.getDocument().createElement("div");
    AdfAgent.AGENT.setTextContent(noteTextDom, noteText);
  }
  return noteTextDom;
};
AdfDhtmlNoteWindowPopupSelector.prototype.CreateDomElement = function() {
  var agent = AdfAgent.AGENT;
  var page = AdfPage.PAGE;
  var domDocument = page.getDomDocument();
  var rootElement = domDocument.createElement("div");
  var table = this.CreateTable(1, 3);
  table.role = "presentation";
  rootElement.appendChild(table);
  var tds = table.rows[0].cells, cell0 = tds[0], cell2 = tds[2];
  cell0.onclick = cell2.onclick = this.createCallback(this._onClickConeCell);
  agent.addBubbleEventListener(cell0, "focusin", AdfAgent.eatEventCallback);
  agent.addBubbleEventListener(cell0, "focus", AdfAgent.eatEventCallback);
  agent.addBubbleEventListener(cell2, "focusin", AdfAgent.eatEventCallback);
  agent.addBubbleEventListener(cell2, "focus", AdfAgent.eatEventCallback);
  if (this._autoDismissType == AdfDhtmlPopupHints.AUTODISMISS_MOUSEOUT) {
    cell0.onmouseover = cell2.onmouseover = this.createCallback(this._onMouseOverConeCell);
    cell0.onmouseout = cell2.onmouseout = this.createCallback(this._onMouseOutConeCell);
  }
  var contentElement = tds[1];
  if (this.NeedsCloseLink()) {
    var linkDiv = domDocument.createElement("div");
    tds[1].appendChild(linkDiv);
    var laf = page.getLookAndFeel();
    var closeLabel = laf.getTranslatedString("af_popup.TIP_DISMISS");
    linkDiv.innerHTML = '\x3ca href\x3d"javascript:;" style\x3d"position:absolute;top:-990px;" ' + 'onclick\x3d"AdfPage.PAGE.getAutoDismissalManager().dismiss()"\x3e' + closeLabel + "\x3c/a\x3e";
    var contentDiv = domDocument.createElement("div");
    tds[1].appendChild(contentDiv);
    contentElement = contentDiv;
  }
  tds[2].className = "";
  tds[2].innerHTML = "\x26#160;";
  tds[1].className = AdfDhtmlNoteWindowPopupSelector._STYLE_CLASS;
  tds[0].className = AdfDhtmlNoteWindowPopupSelector._CONE_BORDER_STYLE_CLASS;
  this._coneElement = domDocument.createElement("div");
  this.SetContentParent(contentElement);
  return rootElement;
};
AdfDhtmlNoteWindowPopupSelector.prototype.GetAnimationDurationSkinProperty = function() {
  return ".AFNoteWindow-tr-open-animation-duration";
};
AdfDhtmlNoteWindowPopupSelector.prototype.GetAnimateSkinProperty = function() {
  return ".AFNoteWindow-tr-animate";
};
AdfDhtmlNoteWindowPopupSelector.prototype.setPosition = function(top, left) {
  var positionManagerIndex = this.GetPositionManagerIndex();
  if (positionManagerIndex >= 0) {
    var behavior = AdfPage.PAGE.getPositionManager().getComputedBehavior(positionManagerIndex);
    if (behavior) {
      var verticalAnchor = behavior.verticalBehavior.floatingElementAnchor;
      var horizontalAnchor = behavior.horizontalBehavior.floatingElementAnchor;
      var contentParent = this.GetContentParent();
      var tds = contentParent.parentNode.parentNode.parentNode;
      if (tds.tagName == "TABLE") {
        tds = tds.rows[0].cells;
      } else {
        tds = tds.parentNode.rows[0].cells;
      }
      var cell1 = tds[1];
      var isAchorRight = horizontalAnchor == AdfDhtmlPositionManager.RIGHT, isAchorBottom = verticalAnchor == AdfDhtmlPositionManager.BOTTOM;
      var cell0 = 0, cell2 = 2;
      if (!AdfPage.PAGE.getLocaleContext().isRightToLeft()) {
        cell0 = tds[0];
        cell2 = tds[2];
      } else {
        cell0 = tds[2];
        cell2 = tds[0];
      }
      if (isAchorRight) {
        cell0.className = "";
        cell0.innerHTML = "\x26#160;";
        cell1.className = AdfDhtmlNoteWindowPopupSelector._RIGHT_STYLE_CLASS;
        cell2.className = AdfDhtmlNoteWindowPopupSelector._CONE_BORDER_RIGHT_STYLE_CLASS;
        cell2.style.verticalAlign = isAchorBottom ? "bottom" : "top";
        this._coneElement.className = isAchorBottom ? AdfDhtmlNoteWindowPopupSelector._CONE_STYLE_CLASS_BR : AdfDhtmlNoteWindowPopupSelector._CONE_STYLE_CLASS_TR;
        cell2.innerHTML = "";
        cell2.appendChild(this._coneElement);
      } else {
        cell2.className = "";
        cell2.innerHTML = "\x26#160;";
        cell1.className = AdfDhtmlNoteWindowPopupSelector._STYLE_CLASS;
        cell0.className = AdfDhtmlNoteWindowPopupSelector._CONE_BORDER_STYLE_CLASS;
        cell0.style.verticalAlign = isAchorBottom ? "bottom" : "top";
        this._coneElement.className = isAchorBottom ? AdfDhtmlNoteWindowPopupSelector._CONE_STYLE_CLASS_BL : AdfDhtmlNoteWindowPopupSelector._CONE_STYLE_CLASS;
        cell0.innerHTML = "";
        cell0.appendChild(this._coneElement);
      }
    }
  }
  AdfDhtmlNoteWindowPopupSelector.superclass.setPosition.call(this, top, left);
};
AdfDhtmlNoteWindowPopupSelector.prototype._onClickConeCell = function(evt) {
  var agent = AdfAgent.AGENT;
  evt = evt || agent.getDomWindow().event;
  var pos = agent.getMousePosition(evt);
  AdfPage.PAGE.getAutoDismissalManager().dismiss(this.getElement().parentNode);
  var doc = AdfPage.PAGE.getDocument();
  var bottomElement = doc.elementFromPoint ? doc.elementFromPoint(pos.x, pos.y) : agent.elementFromPagePoint(pos.x, pos.y);
  if (bottomElement) {
    var eventObj = agent.copyEvent(evt);
    agent.dispatchEvent(bottomElement, eventObj);
    if (bottomElement.focus != null) {
      AdfFocusUtils.focusElement(bottomElement);
    }
    agent.eatEvent(evt);
  }
};
AdfDhtmlNoteWindowPopupSelector.prototype._onMouseOverConeCell = function(evt) {
  if (!this._onMOConeCellTimeoutCallback) {
    this._onMOConeCellTimeoutCallback = this.createCallback(this._onMOConeCellTimeout);
  }
  var domWindow = AdfPage.PAGE.getDomWindow();
  if (this._mouseOverTimeout) {
    domWindow.clearTimeout(this._mouseOverTimeout);
  }
  this._mouseOverTimeout = domWindow.setTimeout(this._onMOConeCellTimeoutCallback, 500);
};
AdfDhtmlNoteWindowPopupSelector.prototype._onMOConeCellTimeout = function() {
  delete this._mouseOverTimeout;
  AdfPage.PAGE.getAutoDismissalManager().dismiss(this.getElement().parentNode);
};
AdfDhtmlNoteWindowPopupSelector.prototype._onMouseOutConeCell = function(evt) {
  var domWindow = AdfPage.PAGE.getDomWindow();
  if (this._mouseOverTimeout) {
    domWindow.clearTimeout(this._mouseOverTimeout);
    delete this._mouseOverTimeout;
  }
};
AdfDhtmlNoteWindowPopupSelector.prototype.activate = function() {
  var focusHint = this.GetFocusOnOpen();
  this.SetFocusOnOpen(true);
  this.FocusOnFirstElement();
  this.SetFocusOnOpen(focusHint);
};
AdfDhtmlNoteWindowPopupSelector.prototype.HandleKeyNavigation = function(event) {
  var launchSourceId = this.getLaunchSourceId();
  if (launchSourceId) {
    var agent = AdfAgent.AGENT;
    var page = AdfPage.PAGE;
    var launcher = page.findComponent(launchSourceId);
    if (launcher) {
      launcher.focus();
      agent.eatEvent(event);
    }
  }
};
AdfDhtmlNoteWindowPopupSelector.prototype._launchSourceHandleComponentKeyDown = function(componentEvent) {
  if (!componentEvent.isCanceled()) {
    var keyCode = componentEvent.getKeyCode();
    if (keyCode == AdfKeyStroke.F6_KEY) {
      AdfAgent.AGENT.preventDefault(componentEvent.getNativeEvent());
      if (this.activate) {
        this.activate();
        componentEvent.cancel();
        componentEvent.stopBubbling();
      }
    }
  }
};
AdfDhtmlNoteWindowPopupSelector.prototype._launchSourceHandleComponentKeyUp = function(componentEvent) {
  if (!componentEvent.isCanceled()) {
    var evt = componentEvent.getNativeEvent();
    var keyCode = componentEvent.getKeyCode();
    if (evt.ctrlKey && evt.altKey && keyCode == AdfKeyStroke.W_KEY) {
      if (this.activate) {
        this.activate();
        componentEvent.cancel();
        componentEvent.stopBubbling();
      }
    }
  }
};
AdfDhtmlNoteWindowPopupSelector.prototype.autoSize = function() {
  AdfDhtmlNoteWindowPopupSelector.superclass.autoSize.call(this);
  var maxWidth = this.GetMaxWidth();
  if (maxWidth && this.getWidth() >= maxWidth) {
    var content = this.getContent();
    var msgContent = AdfDomUtils.getFirstElementMatch(content, false, AdfDhtmlNoteWindowPopupSelector._match);
    if (msgContent) {
      var msgContentStyle = msgContent.style;
      msgContentStyle.overflow = "hidden";
      var agent = AdfAgent.AGENT;
      var coneElement = this._coneElement;
      if (agent.getPlatform() == AdfAgent.IE_PLATFORM && coneElement) {
        var contentWidth = maxWidth - coneElement.offsetWidth;
        msgContentStyle.width = contentWidth + "px";
      }
    }
  }
};
AdfDhtmlNoteWindowPopupSelector._match = function(element) {
  var tagName = element.tagName;
  if (tagName == "DIV" && AdfDomUtils.containsCSSClassName(element, AdfDhtmlNoteWindowPopupSelector._CONTENT_STYLE_CLASS)) {
    return true;
  }
  return false;
};
AdfDhtmlNoteWindowPopupSelector._focusMatch = function(element) {
  var tagName = element.tagName;
  if (tagName == "DIV") {
    var computedStyle = AdfAgent.AGENT.getComputedStyle(element);
    if (computedStyle && computedStyle.visibility != "hidden" && computedStyle.display != "none") {
      return true;
    }
  }
  return false;
};
AdfDhtmlNoteWindowPopupSelector.prototype.GetFocusContent = function() {
  var content = this.getContent();
  return AdfDomUtils.getFirstElementMatch(content, false, AdfDhtmlNoteWindowPopupSelector._focusMatch);
};
