AdfPivotTableUtils.prototype.determineScrollbarStatus=function(a,b,c,d,e){for(var f=[],g=0;2>g;++g){var h=c[1-g]+b[g],l=a[g]-d[1-g];f[g]=h>l?!0:h<=l-e[g]?!1:AdfPivotTableUtils.MAYBE}for(g=0;2>g;++g)f[g]===AdfPivotTableUtils.MAYBE&&(f[g]=!0===f[1-g]);return f};AdfPivotTableUtils.allocateSpace=function(a,b,c,d,e){"%"==e?d=Math.floor(d*a):(d=Math.min(d,a-1),d=Math.max(d,0));a>=b+c?(a=b,c=b=!1):b<=d?(a=b,b=!1,c=!0):c<=a-d?(a-=c,b=!0,c=!1):(a=d,c=b=!0);return[a,b,c]};
AdfPivotTableUtils.prototype.displayScrollbarSpacer=function(a){var b=a.spacer;b.style.display="inline";b.style.position="absolute";this.setPos(AdfPivotTableUtils.COLUMN_EDGE,a.left,b,!0);this.setPos(AdfPivotTableUtils.ROW_EDGE,a.top,b);b.style.zIndex="3";this.setCachedSize(b,a.innerWidth,AdfPivotTableUtils.COLUMN_EDGE);this.setCachedSize(b,a.innerHeight,AdfPivotTableUtils.ROW_EDGE)};
AdfPivotTableUtils.prototype.sizePivotTable=function(a,b){this.startTimer(0,2);var c=this._rightToLeft,d=this._hasStatusBar,e=this.isShrinkToFit(),f=this._colHeaders,g=this._rowHeaders,h=this._headers,l=this._databodies,m=this._databodyScrollers,n=this._corner,p=this._statusBar,q=this._scrollbarSpacers,r=this._innerContainer,v=this._scrollbarTester,u=AdfPivotTableUtils.CONTAINER_EXTRA_SIZE,w=AdfPivotTableUtils.DATABODY_EXTRA_SIZE,y=AdfPivotTableUtils.HEADER_EXTRA_PIXEL_EXTENT,t=AdfPivotTableUtils.HEADER_EXTRA_PIXEL_DEPTH,
A=AdfPivotTableUtils.SCROLLBAR_SPACER_EXTRA_LENGTH,D=AdfPivotTableUtils.SCROLLBAR_SPACER_EXTRA_BREADTH,C=[D[1],D[0]],z=[a-u[0],b-u[1]];this.checkpointTimer(0,"get pivot table divs and sizing constants");var x=this._sizeAttr,E=this._splitSlice,F=this._startPane,G=this._paneExtent,H=[[0,0],[0,0]];if(this._pivotTablePeer._isPaging){for(var s=0;2>s;s++)for(var B=this._startPane[s];2>B;B++)H[s][B]=this._pagingControl[s][B].childNodes[0].offsetHeight,this._pagingControl[s][B].parentNode.style.height=H[s][B]+
"px",H[s][B]=this._pagingControl[s][B].parentNode.offsetHeight;z[1]=z[1]-H[0][1]-H[1][1]-H[1][0]}var I=this._pivotTablePeer._isPaging?[0,0]:[v.offsetWidth-v.clientWidth,v.offsetHeight-v.clientHeight],J=d?p.offsetHeight:0,K=[z[0],z[1]-J];this.checkpointTimer(0,"get scrollbar sizes and status bar size");var P=[[],[]],Q=[0,0],L=[],v=[],M=[],S=[],N=this._emptyTextDiv;if(N){for(s=0;2>s;++s)for(B=F[s];2>B;++B)P[s][B]=0;L=[!1,!1];v=[0,0];s=AdfAgent.AGENT.getIntAttribute(N,"_totHorizMargin");x=AdfAgent.AGENT.getIntAttribute(N,
"_totVertMargin");G=AdfDhtmlPivotTablePeer._getChildById(N,N.id+"Inner");M=AdfPivotTableUtils.HEADER_OUTER_PIXEL_DEPTH_NO_DATA;S=[G.offsetWidth+s,G.offsetHeight+x]}else{for(var U=[],s=0;2>s;++s){for(B=F[s];2>B;++B){var L=this.getHeaderBlocksSize(this._buffers2[s][B],x[s]),X=G[s][B]-this.getSliceCountInBuffer(s,B);P[s][B]=L+X*this._defaultSliceSize[s];Q[s]+=P[s][B]}U[s]=this.getFirstHeaderBlockSize(this._buffers2[s][1],x[1-s])}L=this._pivotTablePeer._isPaging?[!1,!1]:this.determineScrollbarStatus(K,
Q,U,t,I);for(s=0;2>s;++s)v[s]=L[1-s]?I[s]:0,M[s]=U[s]+t[s],S[s]=Q[s]+v[s]}Q=[];x=[];X=[];G=[[],[]];B=[];U=[[],[]];for(s=0;2>s;++s){var O=K[s]-t[1-s]-v[s],V=M[1-s]-t[1-s],T=S[s]-v[s];if(N)var R=0.15,W="%";else R=this._headerSizeAllocation[1-s],W=this._headerSizeAllocUnit[1-s];O=AdfPivotTableUtils.allocateSpace(O,V,T,R,W);Q[1-s]=O[0];x[1-s]=Q[1-s]+t[1-s];N||this._pivotTablePeer._isPaging?(X[s]=!1,G[s][1]=!1):(X[s]=O[1],G[s][1]=O[2]);B[1-s]=X[s]?I[1-s]:0;U[1-s][1]=G[s][1]?I[1-s]:0}AdfAssert.assert(AdfPivotTableUtils.assertsOff||
v[1]==Math.max(B[1],U[1][1])&&v[0]==Math.max(B[0],U[0][1]));this.checkpointTimer(0,"get block sizes, calc canvas size, and allocate space between headers/databody");if(e){for(s=0;2>s;++s)K[s]=Math.min(K[s],M[1-s]+S[s]);z[0]=K[0];z[1]=K[1]+J}J=[];t=[[],[]];for(s=0;2>s;++s)if(J[s]=K[s]-x[1-s],-1!=E[s]){B=AdfPivotTableUtils.allocateSpace(J[s]-v[s],P[s][0],P[s][1],this._splitPercentage[s],"%");t[s][0]=B[0];t[s][1]=J[s]-t[s][0];N?(G[s][0]=!1,G[s][1]=!1):(G[s][0]=B[1],G[s][1]=B[2]);for(B=F[s];2>B;++B)U[1-
s][B]=G[s][B]?I[1-s]:0}else t[s][1]=J[s];this.checkpointTimer(0,"shrink to fit; calc databody region sizes");I=[[],[]];M=[];S=[[],[]];N=[[],[]];for(s=0;2>s;++s){O=0;V=-1==E[s]?2:3;X[s]&&++O;for(B=F[s];2>B;++B)G[s][B]&&(M[s]=B,++O);if(this._pivotTablePeer._isPaging?0:0<O&&O<V){O=1==s&&c?0:K[1-s]-v[1-s];V=v[1-s]-D[s];T=0;R=x[1-s];if(!X[s]){var B=M[s],W=q[s][B],Y=R-A[s];if(1==s)I[s][B]={spacer:W,left:O,top:T,innerWidth:V,innerHeight:Y};else{var Z=c?K[s]-R-T:T;I[s][B]={spacer:W,left:Z,top:O,innerWidth:Y,
innerHeight:V}}}for(B=F[s];2>B;++B)T+=R,R=t[s][B],G[s][B]?(S[s][B]=!1,N[1-s][B]=0):(W=q[s][B],1==B&&(R-=v[s]),Y=R-A[s],1==s?I[s][B]={spacer:W,left:O,top:T,innerWidth:V,innerHeight:Y}:(Z=c?K[s]-R-T:T,I[s][B]={spacer:W,left:Z,top:O,innerWidth:Y,innerHeight:V}),S[s][B]=!0,N[1-s][B]=v[1-s])}else for(B=F[s];2>B;++B)S[s][B]=!1,N[1-s][B]=0}if(S[0][1]&&L[1]||S[1][1]&&L[0])var $={spacer:this._cornerScrollbarSpacer,left:c?0:K[0]-v[0],top:K[1]-v[1],innerWidth:v[0]-C[0],innerHeight:v[1]-C[1]},A=!0;else A=!1;
this.checkpointTimer(0,"Scrollbar spacer calcs");C=x[0];for(s=F[1];2>s;++s){this.setPos(AdfPivotTableUtils.ROW_EDGE,C,g[s]);for(D=F[0];2>D;++D)this.setPos(AdfPivotTableUtils.ROW_EDGE,C,l[s][D]),0<s+D&&this.setPos(AdfPivotTableUtils.ROW_EDGE,C,m[s][D]);C+=t[1][s]+H[1][0]}d&&(this.setPos(AdfPivotTableUtils.ROW_EDGE,K[1],p),this.setPos(AdfPivotTableUtils.COLUMN_EDGE,0,p,!0));if(c){c=0;K=v[0];C=[N[0][0],N[0][1]];for(D=1;D>=F[0];--D){this.setPos(AdfPivotTableUtils.COLUMN_EDGE,c,f[D],!0);for(s=F[1];2>s;++s)this.setPos(AdfPivotTableUtils.COLUMN_EDGE,
K,l[s][D],!0),0<s+D&&this.setPos(AdfPivotTableUtils.COLUMN_EDGE,C[s],m[s][D],!0);K=c+=t[0][D];C[0]=c;C[1]=c}for(s=F[1];2>s;++s)g[s]._left=J[0]}else{c=x[1];for(D=F[0];2>D;++D){this.setPos(AdfPivotTableUtils.COLUMN_EDGE,c,f[D],!0);for(s=F[1];2>s;++s)this.setPos(AdfPivotTableUtils.COLUMN_EDGE,c,l[s][D],!0),0<s+D&&this.setPos(AdfPivotTableUtils.COLUMN_EDGE,c,m[s][D],!0);c+=t[0][D]}for(s=F[1];2>s;++s)g[s]._left=0}this.checkpointTimer(0,"position pt divs");for(s=0;2>s;++s){-1!=E[s]&&(f=this._databodyScrollersByEdgeAndPane[s][0],
g=t[s][0],this.setCachedSize(f,g,s),c=this._usableSizeAttr[s],f[c]=g,this._maxScrollPos[s][0]=Math.max(0,P[s][0]-g));for(B=F[s];2>B;++B)f=this._databodyScrollersByEdgeAndPane[s][B],g=t[1-s][1]-N[1-s][B],this.setCachedSize(f,g,1-s),g-=U[1-s][B],c=this._usableSizeAttr[1-s],f[c]=g,1==B&&(this._maxScrollPos[1-s][1]=Math.max(0,P[1-s][1]-g))}for(s=0;2>s;++s)for(B=F[s];2>B;++B)this.setCanvasSizeByEdgeAndPane(s,B,P[s][B]);this.setCachedSize(n,x[1],AdfPivotTableUtils.COLUMN_EDGE);this.setCachedSize(n,x[0],
AdfPivotTableUtils.ROW_EDGE);P=[[],[]];for(s=1;0<=s;--s)for(B=F[s];2>B;++B)P[s][B]=t[s][B]-y[s],this.setCachedSize(h[s][B],Q[s],1-s),this.setCachedSize(h[s][B],P[s][B],s);for(s=0;2>s;++s)for(B=F[s];2>B;++B){h=t[s][B]-(B?v[s]:0)-w[s];for(y=F[1-s];2>y;++y)this.setCachedSize(s?l[B][y]:l[y][B],h,s)}d&&this.setCachedSize(p,z[0],AdfPivotTableUtils.COLUMN_EDGE);for(s=0;2>s;++s)for(B=0;2>B;++B)I[s][B]?this.displayScrollbarSpacer(I[s][B]):q[s][B].style.display="none";A?this.displayScrollbarSpacer($):this._cornerScrollbarSpacer.style.display=
"none";this.checkpointTimer(0,"size PT divs, show/hide spacers");if(!AdfPivotTableUtils.isMobileTouchDevice()&&!this._pivotTablePeer._isPaging)for(s=0;2>s;++s){d=s?"overflowY":"overflowX";for(B=F[s];2>B;++B)l=G[s][B]?"scroll":"hidden",f=this._databodyScrollersByEdgeAndPane[s][B],f.style[d]=l}this._scrollerInit||(AdfPivotTableUtils.isMobileTouchDevice()||(m[0][1].style.overflowX="hidden",m[1][0].style.overflowY="hidden",this._headers[0][0].style.overflow="hidden",this._headers[1][0].style.overflow=
"hidden"),this._scrollerInit=!0);this.setCachedSize(r,z[0],0);-1==E[AdfPivotTableUtils.ROW_EDGE]?this.setCachedSize(r,z[1],1):this.setCachedSize(r,z[1]+H[1][0],1);this._pivotTablePeer._isPaging&&(-1==E[AdfPivotTableUtils.COLUMN_EDGE]?(this._pagingControl[0][1].style.position="absolute",this._pagingControl[0][0].style.visibility="hidden",this._pagingControl[0][1].style.width=t[0][1]+"px",this._rightToLeft?this._pagingControl[0][1].style.marginRight=n.offsetWidth+"px":this._pagingControl[0][1].style.marginLeft=
n.offsetWidth+"px"):(this._pagingControl[0][0].style.position="absolute",this._pagingControl[0][0].style.width=t[0][0]+"px",this._rightToLeft?this._pagingControl[0][0].style.marginRight=n.offsetWidth+"px":this._pagingControl[0][0].style.marginLeft=n.offsetWidth+"px",this._pagingControl[0][0].style.visibility="visible",this._pagingControl[0][1].style.position="absolute",this._pagingControl[0][1].style.width=t[0][1]+"px",this._rightToLeft?this._pagingControl[0][1].style.marginRight=n.offsetWidth+t[0][0]+
"px":this._pagingControl[0][1].style.marginLeft=n.offsetWidth+t[0][0]+"px"),-1==E[AdfPivotTableUtils.ROW_EDGE]?this._pagingControl[1][0].parentNode.style.visibility="hidden":(C=x[0]+t[1][0]+H[1][0]+1,m=this._pagingControl[1][0].parentNode,m.style.top=C+"px",m.style.visibility="visible"));e&&(this.setCachedSize(this._container,z[0]+u[0],AdfPivotTableUtils.COLUMN_EDGE),this.setCachedSize(this._container,z[1]+u[1]+H[0][1]+H[1][0]+H[1][1],AdfPivotTableUtils.ROW_EDGE));this.stopTimer(0,"Set overflow, size containers",
"All sizing")};AdfPivotTableUtils.prototype.isShrinkToFit=function(){return AdfPivotTableUtils.isShrinkToFit(this._pivotTable.getSizing(),this._container)};AdfPivotTableUtils.isShrinkToFit=function(a,b){if("auto"==a){var c=b.style;return!("absolute"==c.position&&c.top&&0<c.top.length&&c.bottom&&0<c.bottom.length)}return!1};
AdfPivotTableUtils.prototype.getCanvasSizeByEdgeAndPane=function(a,b){return a==AdfPivotTableUtils.ROW_EDGE?1==b?this._canvasHeight1:this._canvasHeight0:1==b?this._canvasWidth1:this._canvasWidth0};
AdfPivotTableUtils.prototype.setCanvasSizeByEdgeAndPane=function(a,b,c){var d=this._startPane;if(a==AdfPivotTableUtils.ROW_EDGE){1==b?this._canvasHeight1=c:this._canvasHeight0=c;for(d=d[1-a];2>d;++d)(0<b+d||AdfPivotTableUtils.isMobileTouchDevice())&&this.setCachedSize(this.getScrollerCanvas(b,d),c,a)}else{1==b?this._canvasWidth1=c:this._canvasWidth0=c;for(d=d[1-a];2>d;++d)(0<b+d||AdfPivotTableUtils.isMobileTouchDevice())&&this.setCachedSize(this.getScrollerCanvas(d,b),c,a)}};
AdfPivotTableUtils.prototype.getHeaderBlocksSize=function(a,b){for(var c=a.length,d=0,e=0;e<c;e++)d+=a[e][b];return d};AdfPivotTableUtils.prototype.getFirstHeaderBlockSize=function(a,b){return a[0][b]};AdfPivotTableUtils.prototype.hasColHeaderScrollbar=function(){return this._colHeaders[1]._height<this._colHeaderBuffers[1][0]._height};
AdfPivotTableUtils.prototype.getColHeaderScrollbarWidth=function(){return this.hasColHeaderScrollbar()?this._colHeaders[1].offsetWidth-this._colHeaders[1].clientWidth-AdfPivotTableUtils.HEADER_EXTRA_PIXEL_EXTENT[0]:0};
AdfPivotTableUtils.prototype.sizeNewHTMLBlocks=function(){this.coordinateNewBlockSizes();this.setBlockTableStyles(!0);var a,b,c;if(AdfAgent.AGENT.getPlatform()==AdfAgent.IE_PLATFORM&&!(8<=AdfAgent.AGENT.getVersion()))this.shiftAllPlaceholderCells(!0);else for(var d=this._startPane[1];2>d;++d){a=this._rowHeaderBuffers[d];c=a.length;for(i=0;i<c;i++)b=a[i],!b._placeholder&&b._new&&this.setCachedSize(b,b.childNodes[0].offsetWidth,AdfPivotTableUtils.COLUMN_EDGE)}};
AdfPivotTableUtils.prototype.setBlockTableStyles=function(a){for(var b=AdfAgent.AGENT.getAttribute(this._colHeaderBuffers[1][0].childNodes[0],"_className"),c=0;2>c;++c)for(var d=this._buffers2[c],e=this._startPane[c];2>e;++e)for(var f=d[e],g=f.length,h=0;h<g;h++)if(block=f[h],!block._placeholder&&(block._new||!a))block.childNodes[0].className=b;for(c=this._startPane[1];2>c;++c){d=this._databodyBuffers[c];for(e=this._startPane[0];2>e;++e)for(var f=d[e],g=f.length,h=0;h<g;h++)for(var l=f[h],m=l.length,
n=0;n<m;n++)if((block=l[n])&&(block._new||!a))block.childNodes[0].className=b}if(this._layerLabelBlock&&(this._layerLabelBlock._new||!a))this._layerLabelBlock.childNodes[0].className=b};AdfPivotTableUtils.prototype.coordinateColumnBlockSizes=function(){for(var a=[],b=this._startPane[0];2>b;++b){for(var c=this._colHeaderBuffers[b],d=c.length,e=0;e<d;e++){var f=c[e];f._placeholder||a.push(f)}this.coordinateColumnHeaderRowHeights(a,!1)}};
AdfPivotTableUtils.prototype.coordinateRowBlockSizes=function(){for(var a=[],b=this._startPane[1];2>b;++b)for(var c=this._rowHeaderBuffers[b],d=c.length,e=0;e<d;e++)for(var f=c[e],g=this._startPane[0];2>g;++g)this.coordinateHTMLBlockRowHeights(f,this._databodyBuffers[b][g][e],a,e)};
AdfPivotTableUtils.prototype.coordinateNewBlockSizes=function(){for(var a=AdfAgent.AGENT.getPlatform()==AdfAgent.IE_PLATFORM,b=[],c=this._startPane[0];2>c;++c)for(var d=this._colHeaderBuffers[c],e=d.length,f=0;f<e;f++){var g=d[f];if(!g._placeholder){for(var h=[],l=this._startPane[1];2>l;++l)for(var m=this._databodyBuffers[l][c],n=m.length,p=0;p<n;p++){var q=m[p][f];q&&q._new&&h.push(q)}g._new?this.coordinateHTMLBlockColumnWidths(g,h):this.setWidthExpandosOnDatabodyBlocks(g,h);b.push(g)}}for(l=this._startPane[1];2>
l;++l){d=this._rowHeaderBuffers[l];e=d.length;for(p=0;p<e;p++){g=d[p];h=[];n=[];for(c=this._startPane[0];2>c;++c)for(var m=this._databodyBuffers[l][c],r=m[p].length,f=0;f<r;f++)(q=m[p][f])&&q._new?(a&&this._rightToLeft&&(q.childNodes[0].style.position="absolute"),h.push(q)):n.push(q);(g._new||0<h.length)&&this.coordinateHTMLBlockRowHeights(g,h,n,p)}}this.coordinateColumnHeaderRowHeights(b,!1)};
AdfPivotTableUtils.prototype.setWidthExpandosOnDatabodyBlocks=function(a,b){for(var c=a._width,d=b.length,e=0;e<d;++e)b[e]._width=c};
AdfPivotTableUtils.prototype.sizeInitialHTMLBlocks=function(a){for(var b=AdfAgent.AGENT.getPlatform()==AdfAgent.IE_PLATFORM,c=b&&!(8<=AdfAgent.AGENT.getVersion()),d={widthBeforeViewport:[],heightBeforeViewport:[]},e=this._startPane,f=e[0];2>f;++f)var g=0<this._splitSlice[1]?[this._databodyBuffers[0][f][0][0],this._databodyBuffers[1][f][0][0]]:[this._databodyBuffers[1][f][0][0]],h=Math.round(this.coordinateHTMLBlockColumnWidths(this._colHeaderBuffers[f][0],g,d));this.coordinateRowHeaderColumnWidths(0<
this._splitSlice[1]?[this._rowHeaderBuffers[0][0],this._rowHeaderBuffers[1][0]]:[this._rowHeaderBuffers[1][0]]);this.coordinateColumnHeaderRowHeights(0<this._splitSlice[0]?[this._colHeaderBuffers[0][0],this._colHeaderBuffers[1][0]]:[this._colHeaderBuffers[1][0]],!0);if(b&&this._rightToLeft){b=this._databodyBuffers;for(f=e[1];2>f;++f)for(var g=b[f],l=e[0];2>l;++l)g[l][0][0].childNodes[0].style.position="absolute"}for(f=e[1];2>f;++f){rowHeaderBlock=this._rowHeaderBuffers[f][0];var g=0<this._splitSlice[0]?
[this._databodyBuffers[f][0][0][0],this._databodyBuffers[f][1][0][0]]:[this._databodyBuffers[f][1][0][0]],m=Math.round(this.coordinateHTMLBlockRowHeights(rowHeaderBlock,g,void 0,void 0,d))}this.setBlockTableStyles(!1);a&&(this._defaultSliceSize=[h,m]);c&&this.shiftAllPlaceholderCells(!1);return d};
AdfPivotTableUtils.prototype.coordinateRowHeaderColumnWidths=function(a){for(var b=a.length,c=a[0].childNodes[0].rows[0].cells.length,d=Array(c),e=0,f=this._pivotTablePeer.getComponent(),g=f.getProperty(AdfRichPivotTable.__ROW_HEADER_START_LAYER_KEY),h=g-1,l=0,m=1;m<c;m++){for(var n=AdfDhtmlPivotTablePeer.MIN_ROW_HEADER_WIDTH,p=0;p<b;p++)n=this.getRowHeaderBlockColumnWidth(a[p],m,n);n=this.getRowHeaderBlockColumnWidth(this._layerLabelBlock,m,n);d[m]=n;e+=n;m-1==h&&(l=e)}this._layerLabelBlock&&(h=
this._layerLabelBlock.childNodes[0].rows[0].cells,m=h[c-1].offsetWidth,this._innerRhLayerLabelPercentage=m/(m+h[c].offsetWidth));for(p=0;p<b;p++)this.setRowHeaderBlockColumnWidths(a[p],d,e);this.setRowHeaderBlockColumnWidths(this._layerLabelBlock,d,e);a=g>=this._rowLayerCount?999999:l+=f.getProperty(AdfRichPivotTable.__ROW_HEADER_START_PIXEL_KEY);for(b=this._startPane[1];2>b;++b)this._rowHeaders[b].scrollLeft=a;this._layerLabelBlock&&(this._corner.scrollLeft=a)};
AdfPivotTableUtils.prototype.getRowHeaderBlockColumnWidth=function(a,b,c){if(a){var d=a.childNodes[0].rows[0].cells,e=d[b],f=e.offsetWidth;(a=a==this._layerLabelBlock)&&b==d.length-2&&(f+=d[b+1].offsetWidth);c<f&&(c=f);a||(b=AdfAgent.getAgent().getIntAttribute(e,"_winW"),void 0!=b&&(b<c&&(this._isRowHeaderWidthOverrideSmaller=!0),c=b))}return c};
AdfPivotTableUtils.prototype.setRowHeaderBlockColumnWidths=function(a,b,c){if(a){for(var d=a.childNodes[0].rows[0].cells,e=d.length,f=a==this._layerLabelBlock,e=f?e-2:e,g=1;g<e;g++)d[g].style.width=b[g]+"px";f&&(b=b[e],f=Math.ceil(this._innerRhLayerLabelPercentage*b),d[e].style.width=f+"px",d[e+1].style.width=b-f+"px");a.style.width=c+"px";a._width=c;a.childNodes[0].style.width=c+"px"}};
AdfPivotTableUtils.prototype.coordinateHTMLBlockColumnWidths=function(a,b,c){for(var d=AdfAgent.getAgent(),e=b.length,f=a.childNodes[0].rows[0].cells,g=f.length-1,h=Array(g),l=0,m=this.getIntAttribute(a,"_startSlice"),n=m<this._splitSlice[0]?0:1,p=this._pivotTablePeer.getViewportStartSliceProperty(0,n,!1)-m-1,q=0,m=0;m<g;m++){var r,v=d.getIntAttribute(f[m+1],"_winW");if(void 0!=v)r=v;else{r=f[m+1].offsetWidth;for(v=0;v<e;v++){var u=b[v].childNodes[0],u=u.rows[0].cells;r=Math.max(r,u[m+1].offsetWidth)}}h[m]=
r;l+=r;m==p&&(q=l)}c&&(q+=this._pivotTablePeer.getViewportStartSliceProperty(0,n,!0),c.widthBeforeViewport[n]=q);for(m=0;m<g;m++)if(void 0==d.getAttribute(f[m+1],"_winW")){c=h[m]+"px";f[m+1].style.width=c;for(v=0;v<e;v++)u=b[v].childNodes[0],u=u.rows[0].cells,u[m+1].style.width=c}this.setCachedSize(a,l,AdfPivotTableUtils.COLUMN_EDGE);a.childNodes[0].style.width=l+"px";for(v=0;v<e;v++)this.setCachedSize(b[v],l,AdfPivotTableUtils.COLUMN_EDGE),b[v].childNodes[0].style.width=l+"px";return 0==g?0:l/g};
AdfPivotTableUtils.prototype.getSizeString=function(a,b){var c=AdfAgent.AGENT.getPlatform()==AdfAgent.IE_PLATFORM&&8<=AdfAgent.AGENT.getVersion(),d="",e=b.childNodes[0];if(a){for(var c=e.rows[0].cells,f=c.length,g=1;g<f;g++)d+=c[g].offsetWidth+",";d+=b.offsetWidth}else{f=e.rows.length;for(g=1;g<f;g++)d+=c?e.rows[g].cells[0].offsetHeight+",":e.rows[g].offsetHeight+",";d+=b.offsetHeight}return d};
AdfPivotTableUtils.prototype.getHeaderSizingBlock=function(a){for(var b=this._startPane[a];2>b;++b){var c=this._buffers2[a][b],d=c.length;for(i=0;i<d;i++){var e=c[i];if(!e._placeholder&&!e._new)return e}}return null};AdfPivotTableUtils.prototype.getRowHeaderWidths=function(){var a=this.getHeaderSizingBlock(1);return this.getSizeString(!0,a)};AdfPivotTableUtils.prototype.getColumnHeaderHeights=function(){var a=this.getHeaderSizingBlock(0);return this.getSizeString(!1,a)};
AdfPivotTableUtils.prototype.coordinateColumnHeaderRowHeights=function(a,b){var c=AdfAgent.getAgent(),d=c.getPlatform(),e=d==AdfAgent.IE_PLATFORM,c=e&&8<=c.getVersion(),d=d==AdfAgent.WEBKIT_PLATFORM,f=a.length,g=a[0].childNodes[0].rows.length,h=Array(g),l=0,m=this._pivotTablePeer.getComponent(),n=m.getProperty(AdfRichPivotTable.__COLUMN_HEADER_START_LAYER_KEY),p=n-1,q=0,r;if(e){r=Array(f);for(var v=0;v<f;v++){var u=a[v];if(void 0==u._processOffsetHeight){u._processOffsetHeight=1;r[v]=Array(g);for(var w=
u.childNodes[0].rows,u=g-1;0<u;u--){var y=w[u];r[v][u]=void 0==r[v][u]?c?y.cells[0].offsetHeight:y.offsetHeight:r[v][u]+(c?y.cells[0].offsetHeight:y.offsetHeight);1==y.cells.length&&y.cells[0].className==AdfPivotTableUtils.COLUMN_HEADER_SIZING_CELL_CLASS&&(r[v][u-1]=r[v][u],r[v][u]=0)}}}}for(u=1;u<g;u++){w=AdfDhtmlPivotTablePeer.MIN_COL_HEADER_HEIGHT;for(v=0;v<f;v++)w=this.getColumnHeaderBlockRowHeight(a[v],v,u,g,w,r,e,c);w=this.getColumnHeaderBlockRowHeight(this._layerLabelBlock,-1,u,g,w,r,e,c);
h[u]=w;l+=w;u-1==p&&(q=l)}for(v=0;v<f;v++)this.setColumnHeaderBlockRowHeights(a[v],h,l,e,c,d);this.setColumnHeaderBlockRowHeights(this._layerLabelBlock,h,l,e,c,d);if(b){e=n>=this._colLayerCount?999999:q+=m.getProperty(AdfRichPivotTable.__COLUMN_HEADER_START_PIXEL_KEY);for(r=this._startPane[0];2>r;++r)this._colHeaders[r].scrollTop=e;this._layerLabelBlock&&(999999==e&&(e=this._colHeaders[1].scrollTop),this._corner.scrollTop=e)}};
AdfPivotTableUtils.prototype.getColumnHeaderBlockRowHeight=function(a,b,c,d,e,f,g,h){if(a){var l=a.childNodes[0].rows[c];g&&1==a._processOffsetHeight?(b=f[b][c],c==d-1&&(a._processOffsetHeight=2)):b=h?l.cells[0].offsetHeight:l.offsetHeight;e<b&&(e=b);void 0==l._minRH&&(l._minRH=Math.max(b,AdfDhtmlPivotTablePeer.MIN_COL_HEADER_HEIGHT),a!=this._layerLabelBlock&&(a=AdfAgent.getAgent().getIntAttribute(l,"_winH"),void 0!=a&&a>e&&(e=a)))}return e};
AdfPivotTableUtils.prototype.setColumnHeaderBlockRowHeights=function(a,b,c,d,e,f){if(a){for(var g=a.childNodes[0],h=g.rows,l=h.length,m=1;m<l;m++){var n=h[m],n=f||e?n.cells[0]:n;n.style.height=b[m]+"px"}if(d)for(m=1;m<l;m++)d=e?h[m].cells[0].offsetHeight:h[m].offsetHeight,d!=b[m]&&(d=b[m]+b[m]-d,0<=d&&(n=h[m],n=f||e?n.cells[0]:n,n.style.height=d+"px"));a.style.height=c+"px";a._height=c;g.style.height=c+"px"}};
AdfPivotTableUtils.prototype.coordinateHTMLBlockRowHeights=function(a,b,c,d,e){var f=AdfAgent.getAgent(),g=f.getPlatform(),h=g==AdfAgent.IE_PLATFORM,l=h&&8<=AdfAgent.AGENT.getVersion();h&&AdfAgent.AGENT.getVersion();for(var m=g==AdfAgent.WEBKIT_PLATFORM,n=a._new,p=a.childNodes[0],g=p.rows.length-1,q=Array(g),r=Array(g),v=0,u,w=this.getIntAttribute(a,"_startSlice"),y=w<this._splitSlice[1]?0:1,t=this._pivotTablePeer.getViewportStartSliceProperty(1,y,!1)-w-1,A=0,w=0;w<g;w++){u=p.rows[w+1];var D=u.cells[0].offsetHeight;
n&&D++;if(void 0==u._minRH){D<AdfDhtmlPivotTablePeer.MIN_ROW_HEIGHT&&(D=AdfDhtmlPivotTablePeer.MIN_ROW_HEIGHT);u._minRH=D;var C=f.getIntAttribute(u,"_winH");void 0!=C&&C>D&&(D=C)}u=b.length;for(var z=D,x=0;x<u;x++){var C=b[x],E=C.childNodes[0],F=E.rows[w+1],G=void 0!=f.getAttribute(F,"_ss")?this.getMaximumScrollHeight(F.cells):0,E=F.cells[0].offsetHeight,E=Math.max(E,G);C._new&&E++;void 0==F._minRH&&(E<AdfDhtmlPivotTablePeer.MIN_ROW_HEIGHT&&(E=AdfDhtmlPivotTablePeer.MIN_ROW_HEIGHT),F._minRH=E,C=f.getIntAttribute(F,
"_winH"),void 0!=C&&C>E&&(E=C));z=Math.max(z,E);a._new||(r[w]=D<z)}q[w]=z;v+=z;w==t&&(A=v)}e&&(A+=this._pivotTablePeer.getViewportStartSliceProperty(1,y,!0),e.heightBeforeViewport[y]=A);f=e=0;h&&!l&&(e=AdfPivotTableUtils.CELL_EXTRA_HEIGHT,f=e+1);for(w=0;w<g;w++){u=p.rows[w+1];n=m||l?u.cells[0]:u;n.style.height=q[w]-f+"px";u=b.length;for(x=0;x<u;x++)E=b[x].childNodes[0],t=E.rows[w+1],n=m||l?t.cells[0]:t,n.style.height=q[w]-e+"px",this.updateTextAreaCellHeights(t,q[w]-e);if(r[w]&&void 0!=c){u=c.length;
for(x=0;x<u;x++)E=c[x].childNodes[0],t=E.rows[w+1],n=m||l?t.cells[0]:t,n.style.height=q[w]-e+"px"}}a.style.height=v+"px";a._new||(m=a._height-v,0!=m&&this.moveExistingBlocksTop(y,d+1,m));a._height=v;a.childNodes[0].style.height=h&&!l?v+1+"px":v+"px";u=b.length;for(x=0;x<u;x++)b[x].style.height=h&&!l?v+1+"px":v+"px",b[x]._height=v,b[x].childNodes[0].style.height=v+"px";if(void 0!=c){u=c.length;for(x=0;x<u;x++)c[x].style.height=h&&!l?v+1+"px":v+"px",c[x]._height=v,c[x].childNodes[0].style.height=v+
"px"}return 0==g?0:v/g};
AdfPivotTableUtils.prototype.shiftAllPlaceholderCells=function(a){for(var b,c,d=0;2>d;++d)for(var e=this._buffers2[d],f=this._startPane[d];2>f;++f){b=e[f];for(var g=b.length,h=0;h<g;h++)c=b[h],!c._placeholder&&(c._new||!a)&&this.shiftPlaceholderCells(c)}for(d=this._startPane[1];2>d;++d){e=this._databodyBuffers[d];for(f=this._startPane[0];2>f;++f){b=e[f];for(var g=b.length,h=0;h<g;h++)for(var l=b[h],m=l.length,n=0;n<m;n++)(c=l[n])&&(c._new||!a)&&this.shiftPlaceholderCells(c)}}this._layerLabelBlock&&(this._layerLabelBlock._new||
!a)&&this.shiftPlaceholderCells(this._layerLabelBlock)};AdfPivotTableUtils.prototype.shiftPlaceholderCells=function(a){a.style.height=a.childNodes[0].offsetHeight-AdfPivotTableUtils.PLACEHOLDER_ROW_HEIGHT+"px";this.setCachedSize(a,a.childNodes[0].offsetWidth,AdfPivotTableUtils.COLUMN_EDGE);a.style.overflow="hidden"};
AdfPivotTableUtils.prototype.getDatabodySizes=function(){for(var a=AdfAgent.getAgent(),b="",c="Rows:",d=!1,e=1;0<=e;--e){0==e&&(c="Columns:",d=!0);for(var f=this._startPane[e];2>f;++f){for(var b=b+c,g=this._buffers2[e][f],h=g.length,l=0;l<h;l++)var m=g[l],b=b+(a.getAttribute(m,"_startSlice")+":"+this.getSizeString(d,m)+":");b+=";"}}return b};
AdfPivotTableUtils.adjustPrintablePageRendering=function(a,b){for(var c=["width","height"],d=["clientWidth","clientHeight"],e=["offsetWidth","offsetHeight"],f=document.getElementById(a),g=f.childNodes[0],h=[-1==parseInt(f.getAttribute("_splitCol"))?1:0,-1==parseInt(f.getAttribute("_splitRow"))?1:0],l=g.childNodes,m=0,n=l[m++],p,q,r=[],v=[],u=[],w=h[0];2>w;++w)p=l[m++],q=p.childNodes[0],r[w]=p,v[w]=q,u[w]=q.childNodes[0].childNodes[0].childNodes;for(var y=[],w=[],t=[],A=[r,y],v=[v,w],D=[u,t],C=[[],
[]],z=[[],[]],x=[[],[]],E=h[1];2>E;++E){p=l[m++];q=p.childNodes[0];y[E]=p;w[E]=q;t[E]=q.childNodes[0].childNodes[0].childNodes;for(var F=h[0];2>F;++F)p=l[m++],q=p.childNodes[0],C[E][F]=p,z[E][F]=q,x[E][F]=q.childNodes[0].childNodes[0].childNodes}for(w=h[0];2>w;++w){E=u[w];l=E.length;for(m=1;m<l;m++)p=E[m].getAttribute("_winH"),null!=p&&(E[m].style.height=p+"px")}for(E=h[1];2>E;++E){w=t[E];u=x[E];l=w.length;for(m=1;m<l;m++)if(p=w[m].getAttribute("_winH"),null!=p){p+="px";w[m].style.height=p;for(F=
h[0];2>F;++F)u[F][m].style.height=p}}AdfPivotTableUtils.initSizeConstants();var m=AdfPivotTableUtils.CONTAINER_EXTRA_SIZE,x=AdfPivotTableUtils.DATABODY_EXTRA_SIZE,l=AdfPivotTableUtils.HEADER_EXTRA_PIXEL_EXTENT,G=AdfPivotTableUtils.HEADER_EXTRA_PIXEL_DEPTH,u=[g.clientWidth,g.clientHeight],E=[u[0],u[1]-0],F=[[],[]];q=[];var H=[];if(1==t[1].length){var s=z[1][1],w=s.childNodes[0],t=parseInt(s.getAttribute("_totHorizMargin"));p=parseInt(s.getAttribute("_totVertMargin"));q=AdfPivotTableUtils.HEADER_OUTER_PIXEL_DEPTH_NO_DATA;
H=[w.offsetWidth+t,w.offsetHeight+p]}else for(t=0;2>t;++t){p=e[t];H[t]=0;for(w=h[t];2>w;++w)F[t][w]=v[t][w][p],H[t]+=F[t][w];q[1-t]=v[1-t][1][p]+G[1-t]}p=[];for(var w=[],B=[Number(f.getAttribute("_sizeAlloc0")),Number(f.getAttribute("_sizeAlloc1"))],I=[f.getAttribute("_sizeUnit0"),f.getAttribute("_sizeUnit1")],t=0;2>t;++t){var J=E[t]-G[1-t],K=q[1-t]-G[1-t];if(s)var P=0.15,Q="%";else P=B[1-t],Q=I[1-t];J=AdfPivotTableUtils.allocateSpace(J,K,H[t],P,Q);p[1-t]=J[0];w[1-t]=p[1-t]+G[1-t]}t=AdfAgent.getAgent().getAttribute(f,
"sizing");if(s=AdfPivotTableUtils.isShrinkToFit(t,f)){for(t=0;2>t;++t)E[t]=Math.min(E[t],q[1-t]+H[t]);u[0]=E[0];u[1]=E[1]+0}G=[];q=[[],[]];for(t=0;2>t;++t)G[t]=E[t]-w[1-t],0==h[t]?(H=AdfPivotTableUtils.allocateSpace(G[t],F[t][0],F[t][1],0.5,"%"),q[t][0]=H[0],q[t][1]=G[t]-q[t][0]):q[t][1]=G[t];t=w[0];G=t+"px";for(E=h[1];2>E;++E){y[E].style.top=G;for(F=h[0];2>F;++F)C[E][F].style.top=G;0==E&&(t+=q[1][E],G=t+"px")}if(b){y=0;t="0px";for(F=1;F>=h[0];--F){r[F].style.left=t;for(E=h[1];2>E;++E)C[E][F].style.left=
t;1==F&&(y+=q[0][F],t=y+"px")}}else{y=w[1];t=y+"px";for(F=h[0];2>F;++F){r[F].style.left=t;for(E=h[1];2>E;++E)C[E][F].style.left=t;0==F&&(y+=q[0][F],t=y+"px")}}n.style.width=w[1]+"px";n.style.height=w[0]+"px";for(t=0;2>t;++t){n=A[t];r=c[1-t];y=c[t];E=p[t]+"px";for(w=h[t];2>w;++w)F=q[t][w]-l[t],n[w].style[r]=E,n[w].style[y]=F+"px"}for(t=0;2>t;++t){r=c[t];for(w=h[t];2>w;++w){y=q[t][w]-x[t]+"px";for(n=h[1-t];2>n;++n)(t?C[w][n]:C[n][w]).style[r]=y}}g.style.width=u[0]+"px";g.style.height=u[1]+"px";s&&(f.style.width=
u[0]+m[0]+"px",f.style.height=u[1]+m[1]+"px");c=[];g=[];0==h[0]?(c[0]=[parseInt(f.getAttribute("_startCol")),parseInt(f.getAttribute("_secondStartCol"))],g[0]=[parseInt(f.getAttribute("_startColPixel")),parseInt(f.getAttribute("_secondStartColPixel"))]):(c[0]=[null,parseInt(f.getAttribute("_startCol"))],g[0]=[null,parseInt(f.getAttribute("_startColPixel"))]);0==h[1]?(c[1]=[parseInt(f.getAttribute("_startRow")),parseInt(f.getAttribute("_secondStartRow"))],g[1]=[parseInt(f.getAttribute("_startRowPixel")),
parseInt(f.getAttribute("_secondStartRowPixel"))]):(c[1]=[null,parseInt(f.getAttribute("_startRow"))],g[1]=[null,parseInt(f.getAttribute("_startRowPixel"))]);C=[parseInt(f.getAttribute("_colHeaderStartLayer")),parseInt(f.getAttribute("_rowHeaderStartLayer"))];f=[parseInt(f.getAttribute("_colHeaderStartPixel")),parseInt(f.getAttribute("_rowHeaderStartPixel"))];for(t=0;2>t;++t){t?(r="top",y="bottom"):b?(r="right",y="left"):(r="left",y="right");p=e[t];x=d[t];for(w=h[t];2>w;++w){for(var n=A[t][w],u=v[t][w],
L=t?D[t][w]:D[t][w][0].childNodes,M=c[t][w]-parseInt(u.getAttribute("_startslice")),l=-g[t][w],m=0;m<M;m++)l-=L[m+1][p];u[p]+l<n[x]?(L=u[p]<n[x]?r:y,M="0px"):(L=r,M=l+"px");u.style[L]=M;for(n=h[1-t];2>n;++n)(t?z[w][n]:z[n][w]).style[L]=M}s=C[1-t];l=-f[1-t];for(w=h[1-t];2>w;++w){u=v[1-t][w];if(w==h[1-t]){n=A[1-t][w];L=t?D[1-t][w]:D[1-t][w][0].childNodes;for(m=0;m<s;m++)l-=L[m+1][p];u[p]+l<n[x]?(L=y,M="0px"):(L=r,M=l+"px")}u.style[L]=M}}};
AdfPivotTableUtils.prototype.updateTextAreaCellHeights=function(a,b){for(var c=a.cells,d=1;d<c.length;d++){var e=c[d];if(null!=this.getFirstTextArea(e)){var f=this.getCellOffset(e);void 0==b&&(b=a.offsetHeight);f=Math.max(0,b-f);e.style.height=f+"px"}}};AdfPivotTableUtils.prototype.getCellOffset=function(a){return AdfPivotTableUtils.CELL_EXTRA_HEIGHT};AdfPivotTableUtils.prototype.getFirstTextArea=function(a){a=a.getElementsByTagName("TEXTAREA");return 0<a.length?a[0]:null};
AdfPivotTableUtils.prototype.getMaximumScrollHeight=function(a){for(var b=0,c=1;c<a.length;c++)for(var d=a[c],e=this.getCellOffset(d),d=d.getElementsByTagName("*"),f=d.length,g=0;g<f;g++)b=Math.max(b,d[g].scrollHeight+e);return b};