//<script>function Section(n, c, s, z) {
	this.name = n;
	if (c == null) this.choices = new Object(); else this.choices = c;
	this.selectedChoice = s;
	this.z_order = z;
}
	
function Choice(id, n, t, v, c, g, p, we, pl, wd, h, w, d, nc, x, y, r) {
	this.id = id;
	this.name = n;
	this.thumbnail = t;
	this.vignette = v;
	this.code = c;
	this.grouping = g;
	
	if (p == null) this.parts = new Object(); else this.parts = p;
	if (we == null) this.welting = new Object(); else this.welting = we;
	if (pl == null) this.pillows = new Object(); else this.pillows = pl;
	if (wd == null) this.wood = new Object(); else this.wood = wd;
	
	this.height = h;
	this.width = w;
	this.depth = d;
	this.cushions = nc;
	this.offset_x = x;
	this.offset_y = y;
	this.restrictions = r;
}

function copySectionsForDisplay(secs) {
	var ret = new Object();
	
	for (var i in secs) {
		ret[i] = new Section(secs[i].name, null, secs[i].selectedChoice, secs[i].z_order);

		// we only need the selected choice, and we don't need the thumbnail, partsArray, weltingArray, pillowArray or woodArray
		var chc = secs[i].choices['c' + secs[i].selectedChoice];
		ret[i].choices['c' + ret[i].selectedChoice] = new Choice(chc.id, chc.name, '', chc.vignette, chc.code, chc.grouping, chc.parts, chc.welting, chc.pillows, chc.wood, chc.height, chc.width, chc.depth, chc.cushions, chc.offset_x, chc.offset_y, null);
	}

	return ret;
}

function Part(id, n, p, sel, sw) {
	this.id = id;
	this.name = n;
	this.path = p;
	this.selected = sel;
	this.appliedSwatch = sw;
}

function Swatch(id, s, c, n, co, d, t, b) {
	this.id = id;
	this.src = s;
	this.covernum = c;
	this.covername = n;
	this.content = co;
	this.details = d;
	this.type = t;
	this.available = b;
}

function Restriction(id,c) {
	this.id = id;
	this.choice_id = c;
}

function Family(id, n, t, i1, p1, i2, p2, i3, p3) {
	this.id = id;
	this.name = n;
	this.text = t;
	this.image1 = i1;
	this.piece1 = p1;
	this.image2 = i2;
	this.piece2 = p2;
	this.image3 = i3;
	this.piece3 = p3;
}
