$(document).ready(function(){WEInfoPage.RenderMode!="Editor"&&(WEXBodyAutoHeight.Initialize(),$(window).load(function(){WEXBodyAutoHeight.ApplyAutoHeight()}),$(window).resize(function(){WEXBodyAutoHeight.ScheduleAutoHeight()}))});var WEXBodyAutoHeight={timerID:-1,lastCalledTime:0,scheduleDelay:200,minDelay:10,pageOrigHeight:0,pageHeight_byShiftedEls:0,pageHeight_byBottoms:0,Initialize:function(){this.ApplyAutoHeight()},ClearScheduledCall:function(){this.timerID!==-1&&clearTimeout(this.timerID);this.timerID=-1},ScheduleAutoHeight:function(){this.ClearScheduledCall();var t=(new Date).getTime(),n=this.lastCalledTime+this.scheduleDelay-t;!this.lastCalledTime||n<this.minDelay?this.ApplyAutoHeight():this.timerID=setTimeout(function(){WEXBodyAutoHeight.timerID=-1;WEXBodyAutoHeight.ApplyAutoHeight()},n)},ApplyAutoHeight:function(){var i,r,w,a,nt,t,f,l,s,e,v,y,rt,ut,d;if((this.ClearScheduledCall(),this.lastCalledTime=(new Date).getTime(),typeof WEXBodyAutoHeightTree!="undefined")&&(i=WEXBodyAutoHeightTree,i&&!$.isEmptyObject(i))){r=null;for(t in i){r=$("#"+t);break}if(r&&r.length){for(t in i){var u=$("#"+t),h=parseInt(u.height()),c=h-i[t].H,g=!1,p=i[t].I;c!==0&&p&&(w=$("#"+p),f=w.data("ahShift"),w.data("ahShift",typeof f=="undefined"?c:c+f),g=!0);g||p||(l=u.position(),a=parseInt(l.top),a<r.position().top&&(r=u),nt=a+h,e=a+h-c,u.data("newBottom",nt),typeof u.data("origBottom")=="undefined"&&u.data("origBottom",e));i[t].H=h}for(var o=0,b=0,k=0,tt=0,n=r,it=!1;n.length;){if(t=n.attr("id"),!t||t.length<2||t.substring(0,2)!=="WE"){n=n.next();continue}f=n.data("ahShift");typeof f!="undefined"&&(o+=f,n.removeData("ahShift"));l=n.position();o!==0&&n.css("position")==="absolute"&&(n.css("top",l.top+o+"px"),it=!0);s=n.data("newBottom");typeof s!="undefined"&&(s+=o,e=n.data("origBottom"),b<s&&(b=s),k<e&&(k=e),tt=b-k,n.removeData("newBottom"));n=n.next()}v=$("#XBody .OESZ_XBodyContent").first();y=parseInt(v.height());this.pageOrigHeight===0&&(this.pageOrigHeight=y);rt=it?o:0;this.pageHeight_byShiftedEls=(this.pageHeight_byShiftedEls?this.pageHeight_byShiftedEls:y)+rt;ut=tt;this.pageHeight_byBottoms=this.pageOrigHeight+ut;d=this.pageHeight_byBottoms>this.pageHeight_byShiftedEls?this.pageHeight_byBottoms:this.pageHeight_byShiftedEls;d!==y&&v.length&&v.css("height",d+"px");this.lastCalledTime=(new Date).getTime()}}}}