function AdfDhtmlPopupWindow() {
  this.Init()
}
AdfObject.createSubclass(AdfDhtmlPopupWindow, AdfAbstractFloatingElement);
AdfDhtmlPopupWindow.__CANCELED_EXPANDO = "data-afr-iscanceled";
AdfDhtmlPopupWindow.__REPLACEDOM_EXPANDO = "data-afr-isreplacedom";
AdfDhtmlPopupWindow.__POPUPID_EXPANDO = "data-afr-popupid";
AdfDhtmlPopupWindow.__POPUP_CONTAINER_ID = "popup-container";
AdfDhtmlPopupWindow.InitClass = function() {
  this._SCROLL_POSITION_EXPANDO = "data-afr-sclptn";
  this._ANIMATE_WRAPPER_EXPANDO = "data-afr-taw"
};
AdfDhtmlPopupWindow.prototype.Init = function() {
  AdfDhtmlPopupWindow.superclass.Init.call(this, AdfDhtmlZOrderManager.FLOATINGTYPE_WINDOW);
  var rootElement = this.CreateDomElement();
  this.setElement(rootElement);
  rootElement.style.display = "none";
  AdfPopupScopingUtils.markAsScopingContainer(rootElement);
  var capabilities = AdfAgent.AGENT.getCapabilities();
  this._isTouchScreen = capabilities[AdfAgent.CAP_TOUCH_SCREEN] != AdfAgent.CAP_TOUCH_SCREEN_NONE
};
AdfDhtmlPopupWindow.prototype.CreateDomElement = function() {
  AdfAssert.failedInAbstractFunction()
};
AdfDhtmlPopupWindow.prototype.ShouldHideOnClip = function() {
  return!this._isTouchScreen
};
AdfDhtmlPopupWindow.prototype.NeedsCloseLink = function() {
  var domWindow = AdfPage.PAGE.getDomWindow();
  return Boolean(domWindow.AdfSafariMobileAgent && AdfAgent.AGENT instanceof AdfSafariMobileAgent)
};
AdfDhtmlPopupWindow.prototype.show = function(hints) {
  AdfAssert.assertObject(hints, "Cannot show a popup element without hints");
  AdfPage.PAGE.__perfTimings(false, false, true, "popup show called");
  var componentId = hints[AdfDhtmlPopupHints.COMPONENT_CLIENT_ID];
  this._componentId = componentId;
  var alignElement = hints[AdfDhtmlPopupHints.ALIGN_ELEMENT];
  this.setAlignElement(alignElement);
  var align = hints[AdfRichPopup.HINT_ALIGN];
  var restoreImmediate = hints[AdfDhtmlPopupHints.RESTORE_IMMEDIATE];
  this._isOpening = true;
  var openedHandler = hints[AdfDhtmlPopupHints.OPENED_HANDLER];
  var openedParams = hints[AdfDhtmlPopupHints.OPENED_HANDLER_PARAM];
  if(openedHandler) {
    this.addOpenedHandler(openedHandler, openedParams)
  }
  var mousePosition = hints[AdfDhtmlPopupHints.MOUSEPOSITION];
  var autoDismiss = hints[AdfDhtmlPopupHints.AUTODISMISS];
  if(autoDismiss === true) {
    hints[AdfDhtmlPopupHints.AUTODISMISS] = AdfDhtmlPopupHints.AUTODISMISS_ALWAYS
  }
  var closeOnEscape = hints[AdfDhtmlPopupHints.CLOSE_ON_ESCAPE];
  if(closeOnEscape == null) {
    closeOnEscape = true
  }
  this._closeOnEscape = closeOnEscape;
  this._launchSourceId = hints[AdfRichPopup.HINT_LAUNCH_ID];
  var maxWidth = hints[AdfDhtmlPopupHints.MAX_WIDTH];
  if(maxWidth) {
    AdfAssert.assertNumeric(maxWidth, "AdfDhtmlPopupHints.MAX_WIDTH");
    this._maxWidth = maxWidth
  }
  var page = AdfPage.PAGE;
  var component = page.findComponent(componentId);
  this.getElement().id = AdfRichUIPeer.CreateSubId(componentId, AdfDhtmlPopupWindow.__POPUP_CONTAINER_ID);
  AdfAssert.assert(component != null, "Cannot show a popup element without a valid component");
  var focusHint = hints[AdfDhtmlPopupHints.FOCUS];
  if(focusHint == null) {
    focusHint = true
  }
  var domWindow = AdfPage.PAGE.getDomWindow();
  if(focusHint == false && domWindow.AdfSafariMobileAgent && AdfAgent.AGENT instanceof AdfSafariMobileAgent) {
    focusHint = true
  }
  focusHint = focusHint;
  if(restoreImmediate) {
    focusHint = false
  }
  if(focusHint) {
    var activeDomElement = page.getActiveDomElement();
    if(activeDomElement) {
      var activeDomId = activeDomElement.id;
      if(!activeDomId) {
        activeDomId = activeDomElement.id = (new Date).getTime()
      }
      this._restoreFocusId = activeDomId
    }
  }
  this.SetFocusOnOpen(focusHint);
  var content = hints[AdfDhtmlPopupHints.CONTENT];
  if(content) {
    if(this._maxWidth) {
      content.style.maxWidth = this._maxWidth + "px"
    }
    if(!this.ImmediateZorderRegistration()) {
      var zorderManager = page.getZOrderManager();
      var element = this.getElement();
      var floatingType = this.GetFloatingType();
      var zorderScope = this._zorderScope = hints[AdfDhtmlPopupHints.ZORDER_SCOPE];
      switch(zorderScope) {
        case AdfDhtmlPopupHints.ZORDER_SCOPE_CONTAINED_FORM:
          var containedFormId = AdfDhtmlPopupWindow._getFormElementId(content);
          zorderManager.addElementToLayer(element, floatingType, null, containedFormId);
          break;
        case AdfDhtmlPopupHints.ZORDER_SCOPE_BODY:
          zorderManager.addElementToLayer(element, floatingType);
          break;
        default:
          var firstFormId = this.GetFirstFormId();
          zorderManager.addElementToLayer(element, floatingType, null, firstFormId)
      }
    }
    content = hints[AdfDhtmlPopupHints.CONTENT] = this.WrapContent(hints, content);
    this.setContent(content)
  }
  this.setAccessibleAttrs(hints);
  var animateHint = hints[AdfDhtmlPopupHints.ANIMATE];
  if(page.isAnimationEnabled() && animateHint != AdfRichPopup.ANIMATE_FALSE) {
    var animProperty = this.GetAnimationDurationSkinProperty(hints);
    if(animProperty) {
      var animationDuration = parseInt(page.getLookAndFeel().getSkinProperty(animProperty));
      if(animationDuration > 0) {
        animProperty = this.GetAnimateSkinProperty();
        var animatePropertyValue = animProperty ? page.getLookAndFeel().getSkinProperty(animProperty) : null;
        if(animatePropertyValue != AdfRichPopup.ANIMATE_FALSE || animateHint == AdfRichPopup.ANIMATE_TRUE) {
          this._animationDuration = animationDuration
        }
      }
    }
  }
  this.setCloseHandler(hints[AdfDhtmlPopupHints.CLOSE_HANDLER]);
  this.setCloseHandlerParam(hints[AdfDhtmlPopupHints.CLOSE_HANDLER_PARAM]);
  this.getElement().style.visibility = "hidden";
  if(align) {
    this.Position(align)
  }else {
    if(mousePosition) {
      this._positionAtMousePointer(mousePosition)
    }
  }
  this.DoShow(hints);
  page.getAutoDismissalManager().addBehavior(component, hints);
  var activeDomElementIdKey = AdfDhtmlPopupWindow._createFocusPagePropertyKey(componentId);
  if(!restoreImmediate) {
    this._sizeTimeout = page.scheduleTimer(this, this.createCallback(this._size), hints, 1, {"isSynchronized":true})
  }else {
    this._sizeTimeout = 0;
    this._size(hints);
    var activeDomElementId = page.getPageProperty(activeDomElementIdKey);
    if(activeDomElementId) {
      var restoreFocusElement = AdfAgent.AGENT.getElementById(activeDomElementId);
      if(restoreFocusElement && AdfDomUtils.isAncestor(content, restoreFocusElement) && AdfFocusUtils.isFocusable(restoreFocusElement)) {
        AdfFocusUtils.focusElement(restoreFocusElement)
      }
    }
  }
  page.setPageProperty(activeDomElementIdKey, null);
  if(componentId) {
    var rootElement = this.getElement();
    rootElement.setAttribute(AdfDhtmlPopupWindow.__POPUPID_EXPANDO, componentId)
  }
};
AdfDhtmlPopupWindow._getFormElementId = function(node) {
  AdfAssert.assertDomNode(node);
  var formId;
  var ourDocument = node.ownerDocument;
  var agent = AdfAgent.AGENT;
  while(node && node != ourDocument) {
    if(agent.getNodeName(node) == "FORM") {
      formId = node.getAttribute("id");
      break
    }
    node = node.parentNode
  }
  return formId
};
AdfDhtmlPopupWindow.prototype.getPopupClientId = function() {
  return this._componentId
};
AdfDhtmlPopupWindow.prototype.OpenedPopup = function(hints) {
  if(!this._isOpening) {
    return
  }
  delete this._isOpening;
  this.announceOpeningViaLiveRegion(hints);
  this._registerEventHandlers(hints);
  var openedHandlers = this._openedHandlers;
  var openedHandlerParams = this._openedHandlerParams;
  delete this._openedHandlers;
  delete this._openedHandlerParams;
  if(hints) {
    var domElement = this.getContent();
    if(!openedHandlers) {
      this.FocusOnFirstElement();
      AdfPage.PAGE.__perfTimings(false, false, true, "popup opened no handler present: id\x3d" + this._componentId);
      return
    }
    this.RestoreScrollValues(domElement);
    this.FocusOnFirstElement()
  }
  if(!openedHandlers) {
    AdfPage.PAGE.__perfTimings(false, false, true, "popup opened no handler present: id\x3d" + this._componentId);
    return
  }
  for(var i = 0;i < openedHandlers.length;i++) {
    try {
      var openedHandler = openedHandlers[i];
      var openedHandlerParam = openedHandlerParams[i];
      openedHandler(openedHandlerParam)
    }catch(e) {
      AdfLogger.LOGGER.logErrorAsWarning(e, "popup opened handler failed.")
    }
  }
  AdfPage.PAGE.__perfTimings(false, false, true, "popup opened handler present")
};
AdfDhtmlPopupWindow.prototype.WrapContent = function(hints, content) {
  var page = AdfPage.PAGE;
  var doc = page.getDomDocument();
  var table = doc.createElement("table");
  this._resizeAnchorId = table.id = AdfRichUIPeer.CreateSubId(this._componentId, "" + (new Date).getTime());
  AdfAgent.AGENT.elementsAdded(table);
  table.cellPadding = table.cellSpacing = 0;
  table.insertRow(0).insertCell(0).appendChild(content);
  table.style.position = "relative";
  table.role = "presentation";
  return table
};
AdfDhtmlPopupWindow.prototype._registerEventHandlers = function(hints) {
  var page = AdfPage.PAGE;
  var doc = page.getDomDocument();
  var agent = AdfAgent.AGENT;
  var domElement = this.getContent();
  if(!hints || !hints[AdfDhtmlPopupHints.COMPONENT_EVENTS_ENABLED]) {
    var keyUpCallback = this._keyUpCallback = this.createCallback(this._handleKeyUp);
    agent.addBubbleEventListener(doc, "keyup", keyUpCallback);
    var keyDownCallback = this._keyDownCallback = this.createCallback(this._handleKeyDown);
    agent.addBubbleEventListener(domElement, "keydown", keyDownCallback)
  }
  var resizeCallback = this._resizeCallback = this.createCallback(this._handleResize);
  agent.addResizeListener(this._resizeAnchorId, resizeCallback)
};
AdfDhtmlPopupWindow.prototype._handleResize = function() {
  this.autoSize();
  var content = this.getContent();
  this.DoResizeNotifyDom(content);
  if(this._positionManagerIndex != null) {
    AdfPage.PAGE.getPositionManager().validatePosition(this._positionManagerIndex)
  }
};
AdfDhtmlPopupWindow.prototype._unregisterEventHandlers = function() {
  var page = AdfPage.PAGE;
  var doc = page.getDomDocument();
  var agent = AdfAgent.AGENT;
  var domElement = this.getContent();
  var keyUpCallback = this._keyUpCallback;
  if(keyUpCallback) {
    agent.removeBubbleEventListener(doc, "keyup", keyUpCallback);
    delete this._keyUpCallback
  }
  var keyDownCallback = this._keyDownCallback;
  if(keyDownCallback) {
    agent.removeBubbleEventListener(domElement, "keydown", keyDownCallback);
    delete this._keyDownCallback
  }
  var resizeCallback = this._resizeCallback;
  if(resizeCallback) {
    agent.removeResizeListener(this._resizeAnchorId);
    delete this._resizeAnchorId;
    delete this._resizeCallback
  }
};
AdfDhtmlPopupWindow.prototype._toggleOffAnimating = function() {
  delete this._animating
};
AdfDhtmlPopupWindow.prototype.hide = function() {
  if(this._isHiding) {
    return
  }
  this._isHiding = true;
  if(this._animating) {
    this._toggleOffAnimating();
    var elementParent = this.getElement().parentNode;
    var needsRootRestored = "true" == elementParent.getAttribute(AdfDhtmlPopupWindow._ANIMATE_WRAPPER_EXPANDO);
    if(needsRootRestored) {
      AdfDhtmlPopupWindow._restoreRootPostAnimation(elementParent)
    }
  }
  var page = AdfPage.PAGE;
  var domElement = this.getContent();
  this.removeAccessibleAttrs();
  this.SaveScrollValues(domElement);
  var component = page.findComponent(this._componentId);
  var popupId = AdfDhtmlPopupWindow._getInternalPopupId(this, component);
  page.getAutoDismissalManager().removeBehavior(component, popupId);
  var isRestoring = this._isRestoring(component);
  if(!isRestoring && (page.getActiveDomElement() == null || AdfFocusUtils.containsFocus(this.getElement())) && !AdfFocusUtils.isFocusChangePending()) {
    try {
      this._restoreFocus()
    }catch(e) {
      AdfLogger.LOGGER.logErrorAsWarning(e, "restoring popup focus")
    }
  }
  var closeHandler = this._closeHandler;
  if(closeHandler) {
    delete this._closeHandler;
    closeHandler(this._closeHandlerParam);
    delete this._closeHandlerParam
  }
  this.destroy();
  delete this._isHiding;
  page.__perfTimings(false, false, true, "popup hidden")
};
AdfDhtmlPopupWindow._getInternalPopupId = function(popupWindow, component) {
  if(component) {
    var peer = component.getPeer();
    if(peer) {
      var popupList = peer.getAllPopups(component);
      if(popupList) {
        for(popupId in popupList) {
          if(popupList[popupId] === popupWindow) {
            return popupId
          }
        }
      }
    }
  }
  return null
};
AdfDhtmlPopupWindow.prototype._isRestoring = function(component) {
  var isRestoring = false;
  if(component instanceof AdfRichPopup && component.getAutoCancel() == AdfRichPopup.AUTO_CANCEL_DISABLED) {
    var key = AdfDhtmlPopupWindow._createFocusPagePropertyKey(component.getClientId());
    var activeDomElementId = page.getPageProperty(key);
    isRestoring = activeDomElementId ? true : false
  }
  return isRestoring
};
AdfDhtmlPopupWindow.prototype.cancel = function(replaceDom) {
  var closeHandlerParam = this._closeHandlerParam;
  var contentDom = closeHandlerParam["contentDom"];
  contentDom.setAttribute(AdfDhtmlPopupWindow.__CANCELED_EXPANDO, true);
  contentDom.setAttribute(AdfDhtmlPopupWindow.__REPLACEDOM_EXPANDO, replaceDom ? true : false);
  if(replaceDom && AdfFocusUtils.containsFocus(this.getElement())) {
    var poppupId = this.getPopupClientId();
    var key = AdfDhtmlPopupWindow._createFocusPagePropertyKey(poppupId);
    var page = AdfPage.PAGE;
    var activeDomElement = page.getActiveDomElement();
    if(activeDomElement && activeDomElement.id) {
      page.setPageProperty(key, activeDomElement.id)
    }
  }
  AdfDhtmlPopupWindow.superclass.cancel.call(this)
};
AdfDhtmlPopupWindow._createFocusPagePropertyKey = function(clientId) {
  AdfAssert.assertString(clientId);
  var tokens = clientId.split(":");
  return tokens.join("$") + "$restoreFocus"
};
AdfDhtmlPopupWindow.prototype._restoreFocus = function() {
  var agent = AdfAgent.AGENT;
  var page = AdfPage.PAGE;
  var focusContextCache = new Object;
  var restoreFocusElement;
  var element = this.getElement();
  if(agent.getPlatform() == AdfAgent.IE_PLATFORM) {
    var isaDialog = this instanceof AdfDhtmlSimpleFloat;
    if(!isaDialog) {
      var clickEvent = page.getDomWindow().event;
      if(clickEvent) {
        var eventTarget = agent.getEventTarget(clickEvent);
        if(eventTarget && AdfFocusUtils.isFocusable(eventTarget) && !AdfDomUtils.isAncestorOrSelf(element, eventTarget)) {
          restoreFocusElement = eventTarget
        }
      }
    }
  }
  if(!restoreFocusElement) {
    restoreFocusElement = this.getAlignElement()
  }
  if(this._restoreFocusId && (!restoreFocusElement || !AdfFocusUtils.isFocusable(restoreFocusElement, focusContextCache))) {
    restoreFocusElement = agent.getDomDocument().getElementById(this._restoreFocusId)
  }
  if(!restoreFocusElement || !AdfFocusUtils.isFocusable(restoreFocusElement, focusContextCache)) {
    restoreFocusElement = this.GetLaunchSourceElement()
  }
  if(restoreFocusElement) {
    if(agent.getPlatform() == AdfAgent.IE_PLATFORM) {
      var focusParams = new Object;
      focusParams["focusElement"] = restoreFocusElement;
      focusParams["popupElement"] = element;
      page.scheduleTimer(this, this._delayedCheckedFocus, focusParams, 10, {"isSynchronized":true});
      return
    }else {
      if(AdfFocusUtils.isFocusable(restoreFocusElement, focusContextCache)) {
        AdfFocusUtils.focusElement(restoreFocusElement);
        return
      }
    }
    AdfFocusUtils.focusNextTabStop(restoreFocusElement);
    return
  }
  AdfFocusUtils.focusFirstDocumentTabStop()
};
AdfDhtmlPopupWindow.prototype._delayedCheckedFocus = function(params) {
  if(!AdfFocusUtils.isFocusable(AdfPage.PAGE.getActiveDomElement()) && !AdfDomUtils.isAncestorOrSelf(params["popupElement"], params["focusElement"])) {
    AdfFocusUtils.focusElement(params["focusElement"])
  }
};
AdfDhtmlPopupWindow.prototype.GetLaunchSourceElement = function() {
  var launchSourceId = this._launchSourceId;
  return launchSourceId ? AdfAgent.AGENT.getElementById(launchSourceId) : null
};
AdfDhtmlPopupWindow.prototype.setContent = function(selectorContent) {
  var contentElement = this.GetContentParent();
  if(contentElement.firstChild) {
    contentElement.removeChild(contentElement.firstChild)
  }
  contentElement.appendChild(selectorContent)
};
AdfDhtmlPopupWindow.prototype.setAccessibleAttrs = function(hints) {
};
AdfDhtmlPopupWindow.prototype.removeAccessibleAttrs = function() {
};
AdfDhtmlPopupWindow.prototype.announceOpeningViaLiveRegion = function(hints) {
};
AdfDhtmlPopupWindow.prototype.getContent = function() {
  return this.GetContentParent().firstChild
};
AdfDhtmlPopupWindow.prototype.GetContentParent = function() {
  AdfAssert.failedInAbstractFunction()
};
AdfDhtmlPopupWindow.prototype.setCloseHandler = function(handler) {
  this._closeHandler = handler
};
AdfDhtmlPopupWindow.prototype.setCloseHandlerParam = function(param) {
  this._closeHandlerParam = param
};
AdfDhtmlPopupWindow.prototype.isVisible = function() {
  return this.getElement().style.display != "none"
};
AdfDhtmlPopupWindow.prototype.DoShow = function(hints) {
  AdfDhtmlPopupWindow.superclass.show.call(this);
  this.raiseToFront()
};
AdfDhtmlPopupWindow.prototype.CreateShadow = function(afterAnimation) {
  if(this.HasShadow() && (!this._animationDuration || afterAnimation)) {
    AdfDhtmlShadowDecorator.createShadowDecorator(this.getShadowAnchor(), this.getElement().parentNode)
  }
};
AdfDhtmlPopupWindow.prototype.HasShadow = function() {
  return true
};
AdfDhtmlPopupWindow.prototype.shouldInvertPosition = function() {
  return true
};
AdfDhtmlPopupWindow.prototype.destroy = function() {
  var agent = AdfAgent.AGENT;
  var page = AdfPage.PAGE;
  this._unregisterEventHandlers();
  agent.elementsRemoved(this.getElement());
  this._restoreFocusElement = null;
  if(this._sizeTimeout != null) {
    page.cancelTimer(this._sizeTimeout);
    delete this._sizeTimeout
  }
  var shadowAnchor = this.getShadowAnchor();
  if(AdfDhtmlShadowDecorator.hasShadowDecorator(shadowAnchor)) {
    AdfDhtmlShadowDecorator.removeShadowDecorator(shadowAnchor)
  }
  if(this._positionManagerIndex != null) {
    page.getPositionManager().removeElement(this._positionManagerIndex)
  }
  this.setAlignElement(null);
  AdfDhtmlPopupWindow.superclass.destroy.call(this)
};
AdfDhtmlPopupWindow.prototype.isAnimating = function() {
  return this._animating || this._isOpening
};
AdfDhtmlPopupWindow.prototype.GetPositionManagerIndex = function() {
  return this._positionManagerIndex
};
AdfDhtmlPopupWindow.prototype._handleKeyDown = function(event) {
  var agent = AdfAgent.AGENT;
  var targetElement = agent.getEventTarget(event);
  if(event.keyCode == AdfKeyStroke.TAB_KEY) {
    var content = this.getContent();
    var firstFocusableElementInPopup = AdfFocusUtils.getFirstTabStop(content);
    var lastElement = AdfFocusUtils.getLastTabStop(content);
    if(event.shiftKey) {
      if(targetElement == firstFocusableElementInPopup) {
        AdfFocusUtils.focusPreviousTabStop(targetElement, content);
        agent.eatEvent(event)
      }
    }else {
      if(lastElement == targetElement) {
        AdfFocusUtils.focusNextTabStop(targetElement, content);
        agent.eatEvent(event)
      }
    }
  }
  if(event.keyCode == AdfKeyStroke.F6_KEY) {
    if(AdfDomUtils.isAncestorOrSelf(this.getElement(), targetElement)) {
      this.HandleKeyNavigation(event)
    }
  }
};
AdfDhtmlPopupWindow.prototype._handleKeyUp = function(event) {
  var agent = AdfAgent.AGENT;
  var keyCode = agent.getKeyCode(event);
  var targetElement = agent.getEventTarget(event);
  if(keyCode == AdfKeyStroke.ESC_KEY) {
    if(this._closeOnEscape) {
      var invokeEscapeHandler = false;
      var launchSourceId = this._launchSourceId;
      if(AdfDomUtils.isAncestorOrSelf(this.getElement(), targetElement)) {
        invokeEscapeHandler = true
      }else {
        if(launchSourceId) {
          var launchElement = agent.getElementById(launchSourceId);
          if(launchElement && AdfDomUtils.isAncestorOrSelf(launchElement, targetElement)) {
            invokeEscapeHandler = true
          }
        }
      }
      if(invokeEscapeHandler) {
        this.HandleEscapeKey(event)
      }
    }
  }
  if(event.ctrlKey && event.altKey && keyCode == AdfKeyStroke.W_KEY) {
    if(AdfDomUtils.isAncestorOrSelf(this.getElement(), targetElement)) {
      this.HandleKeyNavigation(event)
    }
  }
};
AdfDhtmlPopupWindow.prototype.HandleEscapeKey = function(event) {
  this.cancel();
  AdfAgent.AGENT.eatEvent(event)
};
AdfDhtmlPopupWindow.prototype.HandleKeyNavigation = function(event) {
};
AdfDhtmlPopupWindow.prototype._size = function(hints) {
  if(this._sizeTimeout == null) {
    return
  }
  delete this._sizeTimeout;
  var domElement = this.getContent();
  this.DoResizeNotifyDom(domElement);
  var element = this.getElement(), elementStyle = element.style;
  var maxWidth = this._maxWidth;
  if(maxWidth) {
    elementStyle.width = Math.min(element.offsetWidth, maxWidth) + "px"
  }else {
    var agent = AdfAgent.AGENT;
    if(agent.getPlatform() == AdfAgent.IE_PLATFORM && agent.getVersion() > 8) {
      elementStyle.width = element.offsetWidth + 1 + "px"
    }else {
      elementStyle.width = element.offsetWidth + "px"
    }
  }
  if(this._positionManagerIndex != null) {
    AdfPage.PAGE.getPositionManager().validatePosition(this._positionManagerIndex)
  }
  var animationDuration = this._animationDuration;
  if(animationDuration > 0) {
    this.AnimateOpening(animationDuration, hints)
  }else {
    elementStyle.visibility = "";
    this.CreateShadow();
    this.OpenedPopup(hints)
  }
};
AdfDhtmlPopupWindow.prototype.AnimateOpening = function(animationDuration, hints) {
  this._animating = true;
  var isAnchorRight = false, isAnchorBottom = false;
  var positionManagerIndex = this.GetPositionManagerIndex();
  if(positionManagerIndex >= 0) {
    var behavior = AdfPage.PAGE.getPositionManager().getComputedBehavior(positionManagerIndex);
    if(behavior) {
      isAnchorRight = behavior.horizontalBehavior.floatingElementAnchor == AdfDhtmlPositionManager.RIGHT;
      isAnchorBottom = behavior.verticalBehavior.floatingElementAnchor == AdfDhtmlPositionManager.BOTTOM
    }
  }
  this.AnimateUsingWrapper(animationDuration, isAnchorRight, isAnchorBottom, hints)
};
AdfDhtmlPopupWindow.prototype.AnimateUsingWrapper = function(animationDuration, isAchorRight, isAchorBottom, hints) {
  var rootElement = this.getElement();
  var ownerDoc = rootElement.ownerDocument;
  var wrapper = ownerDoc.createElement("div");
  wrapper.setAttribute(AdfDhtmlPopupWindow._ANIMATE_WRAPPER_EXPANDO, true);
  var wrapperStyle = wrapper.style;
  var rootStyle = rootElement.style;
  var finalHeight = rootElement.offsetHeight;
  var finalWidth = rootElement.offsetWidth;
  var finalLeft = parseInt(rootStyle.left);
  var finalTop = parseInt(rootStyle.top);
  if(isAchorRight) {
    wrapperStyle.left = finalLeft + finalWidth - 1 + "px"
  }else {
    wrapperStyle.left = rootStyle.left
  }
  if(isAchorBottom) {
    wrapperStyle.top = finalTop + finalHeight + 1 + "px"
  }else {
    wrapperStyle.top = rootStyle.top
  }
  wrapperStyle.overflow = "hidden";
  wrapperStyle.position = "absolute";
  wrapperStyle.height = "1px";
  wrapperStyle.width = "1px";
  rootStyle.left = rootStyle.top = "0px";
  wrapperStyle.zIndex = rootStyle.zIndex;
  this.SaveScrollValues(rootElement);
  rootElement.parentNode.replaceChild(wrapper, rootElement);
  wrapper.appendChild(rootElement);
  rootStyle.visibility = "";
  var properties = {"height":finalHeight, "width":finalWidth};
  if(isAchorBottom) {
    properties.top = finalTop
  }
  if(isAchorRight) {
    properties.left = finalLeft
  }
  AdfPage.PAGE.prepareMaskingFrame(rootElement);
  AdfDhtmlElementAnimator.animate(AdfDhtmlElementAnimator.FRAME_METHOD_CONSTANT_SPEED, animationDuration, [{"element":wrapper, "properties":properties}], null, AdfDhtmlPopupWindow.AnimationComplete, {"wrapper":wrapper, "myself":this, "hints":hints})
};
AdfDhtmlPopupWindow._restoreRootPostAnimation = function(wrapper) {
  var wrapperStyle = wrapper.style;
  var rootElement = wrapper.firstChild;
  var rootStyle = rootElement.style;
  rootStyle.right = wrapperStyle.right;
  rootStyle.left = wrapperStyle.left;
  rootStyle.top = wrapperStyle.top;
  wrapper.parentNode.replaceChild(rootElement, wrapper)
};
AdfDhtmlPopupWindow.AnimationComplete = function(context) {
  var wrapper = context["wrapper"];
  var myself = context["myself"];
  var hints = context["hints"];
  if(!myself._animating) {
    return
  }
  delete myself._animator;
  AdfDhtmlPopupWindow._restoreRootPostAnimation(wrapper);
  myself.CreateShadow(true);
  myself.OpenedPopup(hints);
  if(AdfAgent.AGENT.getPlatform() == AdfAgent.IE_PLATFORM) {
    AdfPage.PAGE.scheduleTimer(myself, myself.createCallback(myself._toggleOffAnimating), null, 1, {"isSynchronized":true})
  }else {
    myself._toggleOffAnimating()
  }
};
AdfDhtmlPopupWindow.prototype.GetAnimationDuration = function() {
  return this._animationDuration
};
AdfDhtmlPopupWindow.prototype.GetAnimationDurationSkinProperty = function(hints) {
  return null
};
AdfDhtmlPopupWindow.prototype.GetAnimateSkinProperty = function() {
  return null
};
AdfDhtmlPopupWindow.prototype.autoSize = function() {
  var isOpening = this._isOpening;
  if(!this.isVisible() || isOpening) {
    return
  }
  var element = this.getElement(), elementStyle = element.style;
  elementStyle.width = "auto";
  var maxWidth = this._maxWidth;
  if(maxWidth) {
    elementStyle.width = Math.min(element.offsetWidth, maxWidth) + "px"
  }else {
    elementStyle.width = element.offsetWidth + "px"
  }
  var anchor = this.getShadowAnchor();
  if(AdfDhtmlShadowDecorator.hasShadowDecorator(anchor)) {
    AdfDhtmlShadowDecorator.moveShadowDecorator(anchor);
    AdfDhtmlShadowDecorator.showShadowDecorator(anchor, true)
  }
};
AdfDhtmlPopupWindow.prototype.FocusOnFirstElement = function(force) {
  var focusHint = this.GetFocusOnOpen();
  if(!force && !focusHint) {
    return
  }
  var focusContentElement = this.GetFocusContent();
  var firstFocus = AdfFocusUtils.getFirstTabStop(focusContentElement);
  if(!firstFocus) {
    var rootElement = this.getElement();
    if(rootElement != focusContentElement) {
      firstFocus = AdfFocusUtils.getFirstTabStop(rootElement)
    }
    if(!firstFocus) {
      focusContentElement.tabIndex = 0;
      firstFocus = focusContentElement
    }
  }
  if(firstFocus) {
    var agent = AdfAgent.AGENT;
    if(AdfAgent.IE_PLATFORM == agent.getPlatform() && agent.getVersion() == 8) {
      AdfFocusUtils.focusElementDelayed(firstFocus, 1E3)
    }else {
      AdfFocusUtils.focusElement(firstFocus)
    }
  }
};
AdfDhtmlPopupWindow.prototype.GetFocusContent = function() {
  var element = this.getElement();
  return element
};
AdfDhtmlPopupWindow.prototype.Position = function(hintAlign) {
  var page = AdfPage.PAGE;
  var positionManager = page.getPositionManager();
  var positionManagerIndex = this._positionManagerIndex;
  if(positionManagerIndex) {
    positionManager.removeElement(positionManagerIndex);
    delete this._positionManagerIndex
  }
  this._positionManagerIndex = positionManager.addFloatingElement(this, hintAlign)
};
AdfDhtmlPopupWindow.prototype._positionAtMousePointer = function(pos) {
  this._positionManagerIndex = AdfPage.PAGE.getPositionManager().addFloatingElementByPosition(this, pos)
};
AdfDhtmlPopupWindow.prototype.DoResizeNotifyDom = function(content) {
  AdfPage.PAGE.doResizeNotifyDom(content, false)
};
AdfDhtmlPopupWindow.prototype.SaveScrollValues = function(domElement) {
  var childElements = domElement.getElementsByTagName("*");
  var childCount = childElements.length;
  for(var i = 0;i < childCount;i++) {
    var currElement = childElements[i];
    var scrollTop = currElement.scrollTop;
    if(scrollTop > 0) {
      currElement.setAttribute(AdfDhtmlPopupWindow._SCROLL_POSITION_EXPANDO, scrollTop)
    }
  }
};
AdfDhtmlPopupWindow.prototype.RestoreScrollValues = function(domElement) {
  var childElements = domElement.getElementsByTagName("*");
  var childCount = childElements.length;
  for(var y = 0;y < childCount;y++) {
    var currElement = childElements[y];
    var scrollPosition = currElement.getAttribute(AdfDhtmlPopupWindow._SCROLL_POSITION_EXPANDO);
    if(scrollPosition && scrollPosition > 0) {
      AdfDomUtils.setScrollTop(currElement, scrollPosition)
    }
  }
};
AdfDhtmlPopupWindow.prototype.getLaunchSourceId = function() {
  return this._launchSourceId
};
AdfDhtmlPopupWindow.prototype.GetFocusOnOpen = function() {
  return this._focusHint ? true : false
};
AdfDhtmlPopupWindow.prototype.SetFocusOnOpen = function(focusHint) {
  this._focusHint = focusHint
};
AdfDhtmlPopupWindow.prototype._announce = function(messageKey) {
  var page = AdfPage.PAGE;
  var message = page.getLookAndFeel().getTranslatedString(messageKey);
  page.announceToAssistiveTechnology(message)
};
AdfDhtmlPopupWindow.prototype.GetMaxWidth = function() {
  return this._maxWidth
};
AdfDhtmlPopupWindow.isAncestorOrSelf = function(ancestorNode, domElement) {
  var agent = AdfAgent.AGENT;
  while(domElement) {
    if(ancestorNode == domElement) {
      return true
    }
    if(domElement.nodeType == 1 && domElement.hasAttribute(AdfDhtmlPopupWindow.__POPUPID_EXPANDO)) {
      popupId = domElement.getAttribute(AdfDhtmlPopupWindow.__POPUPID_EXPANDO);
      domElement = agent.getElementById(popupId)
    }else {
      domElement = domElement.parentNode
    }
  }
  return false
};
AdfDhtmlPopupWindow.prototype.ImmediateZorderRegistration = function() {
  return false
};
AdfDhtmlPopupWindow.prototype.getZorderScope = function() {
  return this._zorderScope
};
AdfDhtmlPopupWindow.prototype.setRestoreFocusId = function(id) {
  this._restoreFocusId = id
};
AdfDhtmlPopupWindow.prototype.addOpenedHandler = function(handler, params) {
  AdfAssert.assertFunction(handler, "popup opened handler");
  AdfAssert.assertObjectOrNull(params, "popup opened handler function params");
  var openedHandlers = this._openedHandlers;
  if(!openedHandlers) {
    openedHandlers = this._openedHandlers = []
  }
  var openedHandlerParams = this._openedHandlerParams;
  if(!openedHandlerParams) {
    openedHandlerParams = this._openedHandlerParams = []
  }
  openedHandlers.push(handler);
  openedHandlerParams.push(params)
};
