// Created by Newton Book Maker 1.1
//  Note: This file may contain needed resources !! 
// Document
book := {
	version: 2,
	isbn: "MoreBrows:DTS",
	title: "More Browsing Example",
	shortTitle: "MorBrows",
	data: {},   // Authors own data
	contents: Array(25, NIL),
	styles: [], hints: Array(25, NIL),
	browsers: [], templates: [], rendering: []};
output.book := book;

// Shared Map Functions
func MakePage(aTemplate)
	{template: aTemplate, blocks: []};
func MakeBlock(aBounds, anItem)
	{bounds: aBounds, item: anItem};

// Shared Scripts
gotoDestScript := func() begin
	if (curRendering = 0) then :TurnToPage(destPage);
	else :TurnToPage(:FindPageByContent(kioskDest, 0, NIL));
end;

// Hints
book.hints[3] := TRUE;
book.hints[5] := TRUE;
book.hints[6] := StuffHex("120260000010202200020000200000000000000000000304000202011000000020040001001004042020020B02020002500038020010001800000470000000000002000420B000021000000020004000C032204000800004228202002014140C0000000000000000000000000000000000000001000000000000000000000000",'data);
book.hints[8] := TRUE;
book.hints[9] := StuffHex("120260000210200200020000200000000000000000000300000200011000000020040001001004042020000B02020002508038120010000800000470000000000002000420B0000010000000200040008032204000800004228202002014140C0000000000000000000000000000000000000000000000000000000000000000",'data);
book.hints[11] := TRUE;
book.hints[12] := StuffHex("120260000010200200020000200200000000000000000304000200011000000020040011001004042020000B02020202108038020010000800000470000000000002000420B0001010000000200040008032204000000004228202002014140C0000000000000000000000000000000000000000000000000000000000000000",'data);
book.hints[14] := TRUE;
book.hints[15] := StuffHex("120260000010200200020000200000000000000400000300400200011000000020040011001004042020008B02020002108038020018000800000470000000000002001420B0000210000000200040208032204000000004228202002014140C0000000000000000000000000000000000000000000000000000000000000000",'data);
book.hints[18] := TRUE;
book.hints[19] := StuffHex("0000200000022120000000080000000400000000200000000000000000000000000800100010000400A0001900120020100008810000018008080020000008000008000000A2000800000000200040000000010000000100228204000204100C0000000000000000000000000000000000000000000000000000000000000000",'data);
book.hints[21] := StuffHex("0202600000100202000220000000000420002000000000000000000000000200000400000010000020000008020000029080000144102008000000400008000E00020000000000080000000020040008003000000020100002800200000404000000000000000000000000000000000000000000000000000000000000000000",'data);
book.hints[22] := TRUE;
book.hints[23] := StuffHex("020262000010200210229000000200002000020000000000100400000400020000040010601000042020900C22120002720008110410010A00080028402010000002100200C0000000000080200040000030000040100000228202000004148C0000000000000000002000080000000000000000000000000000000000000000",'data);

// Text Styles
s0 := {
	family: 'Geneva,
	face: 0,
	size: 9};
AddArraySlot(book.styles, s0);

s1 := {
	family: 'Geneva,
	face: 0,
	size: 9};
AddArraySlot(book.styles, s1);

s2 := {
	family: 'Geneva,
	face: 5,
	size: 10};
AddArraySlot(book.styles, s2);

s3 := {
	family: 'Geneva,
	face: 1,
	size: 18};
AddArraySlot(book.styles, s3);

s4 := {
	family: 'Geneva,
	face: 1,
	size: 12};
AddArraySlot(book.styles, s4);


// Contents
c1 := {
	data: "SIMPLE STORIES

# The content layout for complex stories with a header",
	styles: [15, s2, 56, s1],
	layout: 16384
};
book.contents[0] := c1;

c2 := {
	data: GetNamedResource("PICT", "711", 'picture),
	layout: 16384
};
book.contents[1] := c2;

c3 := {
	data: "Simple & Complex Stories",
	layout: 2048
};
book.contents[2] := c3;

c4 := {
	data: "
Simple & Complex
Stories

Ford Prefect

",
	styles: [26, s3, 14, s4, 1, s3, 1, s1],
	layout: 36,
	look: 3840,
	edgeWidth: 2
};
book.contents[3] := c4;

c5 := {
	data: "Simple Stories",
	layout: 2048
};
book.contents[4] := c5;

c6 := {
	data: "The Girl Story",
	viewFont: s4,
	layout: 35
};
book.contents[5] := c6;

c7 := {
	data: "This is the simplest story ever told:
Once upon a time there was a little girl who lived happily ever after.

Esta es la mas simple historia jamas contada:
Habia una vez una pequea nia que vivio para siempre feliz.",
	viewFont: s1
};
book.contents[6] := c7;

c8 := {
	data: GetNamedResource("PICT", "2190", 'picture),
	layout: 257
};
book.contents[7] := c8;

c9 := {
	data: "The Boy Story",
	styles: [13, s4, 1, s1],
	layout: 35
};
book.contents[8] := c9;

c10 := {
	data: "This is the simplest story ever told:
Once upon a time there was a little boy who lived happily ever after.

Esta es la mas simple historia jamas contada:
Habia una vez una  niito que vivio para siempre feliz.",
	viewFont: s1,
	layout: 64
};
book.contents[9] := c10;

c11 := {
	data: GetNamedResource("PICT", "28030", 'picture),
	layout: 513
};
book.contents[10] := c11;

c12 := {
	data: "The Bear Story",
	styles: [14, s4, 1, s1],
	layout: 35
};
book.contents[11] := c12;

c13 := {
	data: "This is the simplest story ever told:
Once upon a time there was a little bear that lived happily ever after.

Esta es la mas simple historia jamas contada:
Habia una vez una osito que vivio para siempre feliz.",
	viewFont: s1
};
book.contents[12] := c13;

c14 := {
	data: GetNamedResource("PICT", "27239", 'picture),
	layout: 517,
	look: 1310720
};
book.contents[13] := c14;

c15 := {
	data: "The Dinosaur Story",
	styles: [18, s4, 1, s1],
	layout: 8195
};
book.contents[14] := c15;

c16 := {
	data: "This is the simplest story ever told:
Once upon a time there was a little dinosaur that lived happily ever after.

Esta es la mas simple historia jamas contada:
Habia una vez un  dinosaurito que vivio para siempre feliz.",
	viewFont: s1,
	layout: 8192
};
book.contents[15] := c16;

c17 := {
	data: GetNamedResource("PICT", "21898", 'picture),
	layout: 1029
};
book.contents[16] := c17;

c18 := {
	data: "Complex Stories",
	layout: 2048
};
book.contents[17] := c18;

c19 := {
	data: "The Spaceship Story",
	viewFont: s4,
	layout: 35
};
book.contents[18] := c19;

c20 := {
	data: "This is the most complex story ever told:
Once upon a time there was a spaceship that flew through the air very much like a rocket.
",
	viewFont: s1
};
book.contents[19] := c20;

c21 := {
	data: GetNamedResource("PICT", "19049", 'picture),
	layout: 517
};
book.contents[20] := c21;

c22 := {
	data: "Esta es la mas compleja historia jamas contada:
Habia una vez una nave que volo por los aires en la misma manera como una roca no puede
",
	viewFont: s1,
	layout: 8195
};
book.contents[21] := c22;

c23 := {
	data: "The No Triangle Story",
	viewFont: s4,
	layout: 35
};
book.contents[22] := c23;

c24 := {
	data: "This is the most complex story ever told:
Once upon a time there was a triangle that existed only in your mind and not in a drawing.

Esta es la mas compleja historia jamas contada:
Habia una vez un triangulo que existia solamente en tu mente y no en un dibujo.",
	viewFont: s1
};
book.contents[23] := c24;

c25 := {
	data: GetNamedResource("PICT", "29156", 'picture),
	layout: 1029
};
book.contents[24] := c25;


// Kiosk (menu page) references

// Page Templates
NBMDefault := {
	nColumns: 1,
	column: [{
	width: 12,
	type: 0}]
};
AddArraySlot(book.templates, NBMDefault);
MyStandard := {
	nColumns: 1,
	column: [{
	width: 12,
	type: 0}]
};
AddArraySlot(book.templates, MyStandard);
MyTitlePage := {
	nColumns: 1,
	column: [{
	width: 12,
	type: 0}],
	flags: 8
};
AddArraySlot(book.templates, MyTitlePage);
SimpleStories := {
	nColumns: 2,
	column: [{
	width: 3,
	type: 1}, {
	width: 9,
	type: 0}],
	header: c1
};
AddArraySlot(book.templates, SimpleStories);
ComplexStories := {
	nColumns: 2,
	column: [{
	width: 5,
	type: 1}, {
	width: 7,
	type: 0}],
	header: c2
};
AddArraySlot(book.templates, ComplexStories);

// Bounds List
bnd1 := [0,0,240,142];
bnd2 := [0,16,240,32];
bnd3 := [63,32,240,128];
bnd4 := [0,32,40,75];
bnd5 := [63,221,240,317];
bnd6 := [0,289,25,317];
bnd7 := [8,89,51,128];
bnd8 := [0,148,240,164];
bnd9 := [63,164,240,260];
bnd10 := [15,196,44,228];
bnd11 := [103,32,240,116];
bnd12 := [4,98,95,116];
bnd13 := [0,116,240,318];
bnd14 := [103,32,240,176];
bnd15 := [16,71,83,137];

// Pages
pageList := {pageSize: {left: 0, top: 0, right: 240, bottom: 318},
	contents: [], pages: []};

// Page 1
page := MakePage(MyTitlePage);
AddArraySlot(page.blocks, MakeBlock(bnd1, c4));
AddArraySlot(pageList.pages, page);

// Page 2
page := MakePage(SimpleStories);
AddArraySlot(page.blocks, MakeBlock(bnd2, c6));
AddArraySlot(page.blocks, MakeBlock(bnd3, c7));
AddArraySlot(page.blocks, MakeBlock(bnd4, c8));
AddArraySlot(pageList.pages, page);

// Page 3
page := MakePage(SimpleStories);
AddArraySlot(page.blocks, MakeBlock(bnd2, c9));
AddArraySlot(page.blocks, MakeBlock(bnd5, c10));
AddArraySlot(page.blocks, MakeBlock(bnd6, c11));
AddArraySlot(pageList.pages, page);

// Page 4
page := MakePage(SimpleStories);
AddArraySlot(page.blocks, MakeBlock(bnd2, c12));
AddArraySlot(page.blocks, MakeBlock(bnd3, c13));
AddArraySlot(page.blocks, MakeBlock(bnd7, c14));
AddArraySlot(page.blocks, MakeBlock(bnd8, c15));
AddArraySlot(page.blocks, MakeBlock(bnd9, c16));
AddArraySlot(page.blocks, MakeBlock(bnd10, c17));
AddArraySlot(pageList.pages, page);

// Page 5
page := MakePage(ComplexStories);
AddArraySlot(page.blocks, MakeBlock(bnd2, c19));
AddArraySlot(page.blocks, MakeBlock(bnd11, c20));
AddArraySlot(page.blocks, MakeBlock(bnd12, c21));
AddArraySlot(page.blocks, MakeBlock(bnd13, c22));
AddArraySlot(pageList.pages, page);

// Page 6
page := MakePage(ComplexStories);
AddArraySlot(page.blocks, MakeBlock(bnd2, c23));
AddArraySlot(page.blocks, MakeBlock(bnd14, c24));
AddArraySlot(page.blocks, MakeBlock(bnd15, c25));
AddArraySlot(pageList.pages, page);

AddArraySlot(book.rendering, pageList);

// Browsers & Page Hints
b1 := {
	name: "Contents",  list: []
};
bp1 := [];		// Page Hints for list browser

AddArraySlot(b1.list, {	// 0
	item: c3
});
AddArraySlot(bp1, 1);
AddArraySlot(b1.list, {	// 1
	item: c5
});
AddArraySlot(bp1, 2);
AddArraySlot(b1.list, {	// 2
	level: 2,
	item: c6
});
AddArraySlot(bp1, 2);
AddArraySlot(b1.list, {	// 3
	level: 2,
	item: c9
});
AddArraySlot(bp1, 3);
AddArraySlot(b1.list, {	// 4
	level: 2,
	item: c12
});
AddArraySlot(bp1, 4);
AddArraySlot(b1.list, {	// 5
	level: 2,
	item: c15
});
AddArraySlot(bp1, 4);
AddArraySlot(b1.list, {	// 6
	item: c18
});
AddArraySlot(bp1, 5);
AddArraySlot(b1.list, {	// 7
	level: 2,
	item: c19
});
AddArraySlot(bp1, 5);
AddArraySlot(b1.list, {	// 8
	level: 2,
	item: c23
});
AddArraySlot(bp1, 6);
AddArraySlot(book.browsers, b1);
AddArraySlot(pageList.contents, bp1);


// Indices and Sub-Indices
