/*
 * jLayout Border Layout - JavaScript Layout Algorithms v0.4
 *
 * Licensed under the new BSD License.
 * Copyright 2008-2009, Bram Stein
 * All rights reserved.
 */
(function(){jLayout=typeof jLayout==="undefined"?{}:jLayout;jLayout.border=function(i){var g={},d={},f=i.east,h=i.west,b=i.north,e=i.south,a=i.center;g.hgap=i.hgap||0;g.vgap=i.vgap||0;d.items=function(){var j=[];if(f){j.push(f)}if(h){j.push(h)}if(b){j.push(b)}if(e){j.push(e)}if(a){j.push(a)}return j};d.layout=function(k){var o=k.bounds(),j=k.insets(),q=j.top,l=o.height-j.bottom,p=j.left,n=o.width-j.right,m;if(b&&b.isVisible()){m=b.preferredSize();b.bounds({x:p,y:q,width:n-p,height:m.height});b.doLayout();q+=m.height+g.vgap}if(e&&e.isVisible()){m=e.preferredSize();e.bounds({x:p,y:l-m.height,width:n-p,height:m.height});e.doLayout();l-=m.height+g.vgap}if(f&&f.isVisible()){m=f.preferredSize();f.bounds({x:n-m.width,y:q,width:m.width,height:l-q});f.doLayout();n-=m.width+g.hgap}if(h&&h.isVisible()){m=h.preferredSize();h.bounds({x:p,y:q,width:m.width,height:l-q});h.doLayout();p+=m.width+g.hgap}if(a&&a.isVisible()){a.bounds({x:p,y:q,width:n-p,height:l-q});a.doLayout()}return k};function c(j){return function(m){var l=m.insets(),n=0,k=0,o;if(f&&f.isVisible()){o=f[j+"Size"]();n+=o.width+g.hgap;k=o.height}if(h&&h.isVisible()){o=h[j+"Size"]();n+=o.width+g.hgap;k=Math.max(o.height,k)}if(a&&a.isVisible()){o=a[j+"Size"]();n+=o.width;k=Math.max(o.height,k)}if(b&&b.isVisible()){o=b[j+"Size"]();n=Math.max(o.width,n);k+=o.height+g.vgap}if(e&&e.isVisible()){o=e[j+"Size"]();n=Math.max(o.width,n);k+=o.height+g.vgap}return{width:n+l.left+l.right,height:k+l.top+l.bottom}}}d.preferred=c("preferred");d.minimum=c("minimum");d.maximum=c("maximum");return d}})();
