(function(){var b=function(e,d){var f=[];Object.each(d,function(g){Object.each(g,function(h){e.each(function(i){f.push(i+"-"+h+(i=="border"?"-width":""))})})});return f};var c=function(f,e){var d=0;Object.each(e,function(h,g){if(g.test(f)){d=d+h.toInt()}});return d};var a=function(d){return !!(!d||d.offsetHeight||d.offsetWidth)};Element.implement({measure:function(h){if(a(this)){return h.call(this)}var g=this.getParent(),e=[];while(!a(g)&&g!=document.body){e.push(g.expose());g=g.getParent()}var f=this.expose(),d=h.call(this);f();e.each(function(i){i()});return d},expose:function(){if(this.getStyle("display")!="none"){return function(){}}var d=this.style.cssText;this.setStyles({display:"block",position:"absolute",visibility:"hidden"});return function(){this.style.cssText=d}.bind(this)},getDimensions:function(d){d=Object.merge({computeSize:false},d);var i={x:0,y:0};var h=function(j,e){return(e.computeSize)?j.getComputedSize(e):j.getSize()};var f=this.getParent("body");if(f&&this.getStyle("display")=="none"){i=this.measure(function(){return h(this,d)})}else{if(f){try{i=h(this,d)}catch(g){}}}return Object.append(i,(i.x||i.x===0)?{width:i.x,height:i.y}:{x:i.width,y:i.height})},getComputedSize:function(d){if(d&&d.plains){d.planes=d.plains}d=Object.merge({styles:["padding","border"],planes:{height:["top","bottom"],width:["left","right"]},mode:"both"},d);var g={},e={width:0,height:0},f;if(d.mode=="vertical"){delete e.width;delete d.planes.width}else{if(d.mode=="horizontal"){delete e.height;delete d.planes.height}}b(d.styles,d.planes).each(function(h){g[h]=this.getStyle(h).toInt()},this);Object.each(d.planes,function(i,h){var k=h.capitalize(),j=this.getStyle(h);if(j=="auto"&&!f){f=this.getDimensions()}j=g[h]=(j=="auto")?f[h]:j.toInt();e["total"+k]=j;i.each(function(m){var l=c(m,g);e["computed"+m.capitalize()]=l;e["total"+k]+=l})},this);return Object.append(e,g)}})})();