diff --git a/addons/Core/layout_constructors/FloatedDivConstructor.js b/addons/Core/layout_constructors/FloatedDivConstructor.js
index 01de19e..a3f011e 100644
--- a/addons/Core/layout_constructors/FloatedDivConstructor.js
+++ b/addons/Core/layout_constructors/FloatedDivConstructor.js
@@ -1,30 +1,36 @@
var FloatedDivConstructor = Class.create({
+ 'areas': ["header", "comic", "body", "footer"],
'generate_html': function(layout) {
var output = [];
output.push('
');
-
- var areas = $w("header comic body footer");
var i, il;
var indent = 1;
var gi = function() { return " ".times(indent); }
var has_whole_sidebar = null;
+ var has_layout = {};
+ $w('left right').each(function(which) {
+ if (layout[which].active) {
+ has_layout[which] = [layout[which].start, layout[which].end];
+ }
+ });
+
var range = null;
- if (layout.left) {
- if (layout.right) {
+ if (has_layout.left) {
+ if (has_layout.right) {
range = [];
var all_same = true;
- for (i = 0; i < 2; ++i) {
- if (layout.left[i] != layout.right[i]) { all_same = false; break; }
+ for (i = 0; i <= 1; ++i) {
+ if (has_layout.left[i] != has_layout.right[i]) { all_same = false; break; }
}
if (!all_same) {
$w('left right').each(function(field) {
if (!has_whole_sidebar) {
- if ((layout[field][0] == 0) && (layout[field][1] == 3)) {
+ if ((has_layout[field][0] == 0) && (has_layout[field][1] == 3)) {
has_whole_sidebar = field;
}
}
@@ -32,24 +38,24 @@ var FloatedDivConstructor = Class.create({
}
if (!has_whole_sidebar) {
- range[0] = Math.min(layout.left[0], layout.right[0]);
- range[1] = Math.max(layout.left[1], layout.right[1]);
+ range[0] = Math.min(has_layout.left[0], has_layout.right[0]);
+ range[1] = Math.max(has_layout.left[1], has_layout.right[1]);
} else {
switch (has_whole_sidebar) {
- case 'left': range = layout.right; break;
- case 'right': range = layout.left; break;
+ case 'left': range = has_layout.right; break;
+ case 'right': range = has_layout.left; break;
}
}
} else {
- range = layout.left;
+ range = has_layout.left;
}
} else {
- if (layout.right) {
- range = layout.right;
+ if (has_layout.right) {
+ range = has_layout.right;
}
}
- for (i = 0, il = areas.length; i < il; ++i) {
+ for (i = 0, il = this.areas.length; i < il; ++i) {
if ((i == 0) && has_whole_sidebar) {
output.push(gi() + '