function AdfDhtmlZOrderManager(){this.Init()}AdfObject.createSubclass(AdfDhtmlZOrderManager);
AdfDhtmlZOrderManager.InitClass=function(){var a=["__af_Z_maskingframe","__af_Z_window","__af_Z_tooltip"];this.LAYERCONTAINER="DhtmlZOrderManagerLayerContainer";this.FLOATINGTYPE_WINDOW=a[1];this.FLOATINGTYPE_TOOLTIP=a[2];this.FLOATINGTYPE_MASKINGFRAME=a[0];this.LAYERIDS=a;this._LAYER_CONTAINER_STYLECLASS="AFZOrderLayerContainer";this.LAYER_STYLECLASS="AFZOrderLayer";this._MAXZ=Math.pow(2,31)-2;this._SHADOWDECORATORZINDEX=3;this._BLANK_PAGE_RESOURCE="about:blank";this._FORM_ID_EXPANDO="data-afr-fid";
this._INUSE_EXPANDO="data-afr-inuse"};AdfDhtmlZOrderManager.prototype.Init=function(){AdfDhtmlZOrderManager.superclass.Init.call(this);this._layerHash={};this._isGecko=AdfAgent.AGENT.getPlatform()==AdfAgent.GECKO_PLATFORM};AdfDhtmlZOrderManager.getMaxZIndex=function(){return AdfDhtmlZOrderManager._MAXZ};AdfDhtmlZOrderManager.prototype.dispose=function(){this._layerHash=null};
AdfDhtmlZOrderManager.prototype.addElementToLayer=function(a,b,d,e){this._assertLayers(e);b=e?AdfRichUIPeer.createSubId(e,b):b;this._getLayer(b).addElement(a,d)};AdfDhtmlZOrderManager.prototype.raiseToFront=function(a){var b=a.parentNode,d=b.parentNode.getAttribute(AdfDhtmlZOrderManager._FORM_ID_EXPANDO);this._assertLayers(d);b=b.getAttribute("id");AdfAssert.assertNonEmptyString(b);(b=this._getLayer(b))&&b.raiseToFront(a);AdfPopupScopingUtils.scope(a)};
AdfDhtmlZOrderManager._createMapSafeKey=function(a){AdfAssert.assertString(a);return a.split(":").join("$")+"$key"};AdfDhtmlZOrderManager.prototype._getLayer=function(a){a=AdfDhtmlZOrderManager._createMapSafeKey(a);var b=this._layerHash[a];return b&&!b.getContainerElement()?(delete this._layerHash[a],null):b};AdfDhtmlZOrderManager.prototype._setLayer=function(a,b){var d=AdfDhtmlZOrderManager._createMapSafeKey(a);this._layerHash[d]=b};
AdfDhtmlZOrderManager.prototype._createLayers=function(a){var b=AdfDhtmlZOrderManager.LAYERIDS,d=AdfDhtmlZOrderManager.LAYERCONTAINER,d=a?AdfRichUIPeer.createSubId(a,d):d,d=this._createLayerElement(d);AdfDomUtils.addCSSClassName(d,AdfDhtmlZOrderManager._LAYER_CONTAINER_STYLECLASS);a&&d.setAttribute(AdfDhtmlZOrderManager._FORM_ID_EXPANDO,a);for(var e=AdfDhtmlZOrderManager.LAYER_STYLECLASS,f=0;f<b.length;f++){var g=a?AdfRichUIPeer.createSubId(a,b[f]):b[f],h=this._createLayerElement(g),g=new AdfDhtmlZOrderLayer(g);
this._addLayer(d,g,h);AdfDomUtils.addCSSClassName(h,e)}this._positionLayerContainer(d);return d};AdfDhtmlZOrderManager.prototype._createLayerElement=function(a){var b=this._getLayer(a);if(b)return b.getContainerElement();b=AdfPage.PAGE.getDomDocument().createElement("div");b.setAttribute("id",a);b.style.zIndex=AdfDhtmlZOrderManager._MAXZ;return b};AdfDhtmlZOrderManager.prototype._addLayer=function(a,b,d){var e=b.getId();this._setLayer(e,b);a.appendChild(d);AdfAgent.AGENT.elementsAdded(a)};
AdfDhtmlZOrderManager.prototype._assertLayers=function(a){var b=this._getLayerContainer(a);b||(b=this._createLayers(a));AdfDhtmlZOrderManager._getFormOrBody(a).lastChild!=b&&this._repairLayers(b)};AdfDhtmlZOrderManager.prototype._repairLayers=function(a){var b=a.getAttribute(AdfDhtmlZOrderManager._FORM_ID_EXPANDO),b=AdfDhtmlZOrderManager._getFormOrBody(b);a.parentNode!=b?this._positionLayerContainer(a):(b.removeChild(a),b.appendChild(a))};
AdfDhtmlZOrderManager.prototype._positionLayerContainer=function(a){var b=a.getAttribute(AdfDhtmlZOrderManager._FORM_ID_EXPANDO),b=AdfDhtmlZOrderManager._getFormOrBody(b);a.parentNode!=b&&(b.appendChild(a),AdfAgent.AGENT.elementsAdded(a))};AdfDhtmlZOrderManager.prototype.containsElement=function(a){if(null==a)return!1;var b=AdfDhtmlZOrderManager.LAYERCONTAINER;for(a=a.parentNode;a;a=a.parentNode)if(1==a.nodeType){var d=a.getAttribute("id");if(d){var d=d.split(":"),e=d.length;if(1<e&&b==d[e-1])return!0}}return!1};
AdfDhtmlZOrderManager.prototype.getElementCount=function(){var a=0,b=this._layerHash;for(id in b){var d=b[id];d&&d.getContainerElement()&&(a+=d.getContainerElementCount())}return a};AdfDhtmlZOrderManager.prototype.removeElement=function(a){if(a.parentNode){AdfPopupScopingUtils.unscope(a);var b=a.parentNode.getAttribute("id");AdfAssert.assertNonEmptyString(b);b=this._getLayer(b);AdfAssert.assertObject(b);b.removeElement(a)}};
AdfDhtmlZOrderManager.prototype._getLayerContainer=function(a){var b=AdfDhtmlZOrderManager.LAYERCONTAINER;a=a?AdfRichUIPeer.createSubId(a,b):b;return AdfAgent.AGENT.getElementById(a)};AdfDhtmlZOrderManager._getFormOrBody=function(a){return(a=AdfAgent.AGENT.getElementById(a))?a:AdfPage.PAGE.getDomDocument().body};
AdfDhtmlZOrderManager.prototype.prepareMaskingFrame=function(a){var b;if(a){var d=AdfDhtmlZOrderManager.LAYERCONTAINER;for(a=a.parentNode;a;a=a.parentNode)if(1==a.nodeType){var e=a.getAttribute("id");if(e){var e=e.split(":"),f=e.length;if(1<f&&e[f-1]==d){b=a.getAttribute(AdfDhtmlZOrderManager._FORM_ID_EXPANDO);break}}}}this._assertLayers(b);a=AdfDhtmlZOrderManager.FLOATINGTYPE_MASKINGFRAME;d=b?AdfRichUIPeer.createSubId(b,a):a;d=this._getLayer(d);delete d._unusedMaskingFrame;d.visitElements(AdfDhtmlZOrderManager._findMaskingFramesInUse);
e=d._unusedMaskingFrame;delete d._unusedMaskingFrame;e||(e=this._isGecko?"DIV":"IFRAME",e=d.getContainerElement().ownerDocument.createElement(e),this.removeMaskingFrame(e),"IFRAME"==e.tagName&&(e.src=AdfDhtmlZOrderManager._BLANK_PAGE_RESOURCE,e.setAttribute("aria-hidden",!0)),e.setAttribute(AdfDhtmlZOrderManager._INUSE_EXPANDO,!1),this.addElementToLayer(e,a,null,b));return e};
AdfDhtmlZOrderManager._findMaskingFramesInUse=function(a,b){return"false"==b.getAttribute(AdfDhtmlZOrderManager._INUSE_EXPANDO)?(a._unusedMaskingFrame=b,!0):!1};AdfDhtmlZOrderManager.prototype.createMaskingFrame=function(a){a=this.prepareMaskingFrame(a);a.setAttribute(AdfDhtmlZOrderManager._INUSE_EXPANDO,!0);a.style.zIndex=1;return a};
AdfDhtmlZOrderManager.prototype.removeMaskingFrame=function(a){a.frameBorder="0";a.className="AFMaskingFrame";var b=a.style;b.visibility="hidden";b.width="0px";b.height="0px";b.left="0px";b.top="0px";b.zIndex=0;a.setAttribute(AdfDhtmlZOrderManager._INUSE_EXPANDO,!1)};AdfObject.ensureClassInitialization(AdfDhtmlZOrderManager);