// Created by Newton Book Maker 1.1
//  Note: This file may contain needed resources !! 
// Document
book := {
	version: 2,
	isbn: "Brows:DTS",
	title: "Browser Story",
	shortTitle: "Browsing",
	data: {},   // Authors own data
	contents: Array(9, NIL),
	styles: [], hints: Array(9, 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[0] := TRUE;
book.hints[1] := TRUE;
book.hints[2] := StuffHex("0044A0002208202000321002000022004800220A24008016000000000000008000004040422022041220C019100030088031F883002000000000803020004840600000401092000800000050003E48000024401020800030300000022090080C0000000000000000000000004000000000000000000000000000000000000000",'data);
book.hints[4] := TRUE;
book.hints[5] := TRUE;
book.hints[6] := StuffHex("000020000000202000200002000000100800000120010006000000000000000000000000020020041220C0110000200080115801002000100000803020000800600000003092000800400000000240000020400000800010300000022000000C0000000000000000000000004000000000000000000000000000000000000000",'data);
book.hints[7] := StuffHex("0004202008120100020212040000030020803400020D0280000420000000000020004000001000104000D00800020000608100004000000000820090001002001080000C8290202440880009000000000008000000100010208202000004A0040000000000000000000000000000000002000000000000000000000000000000",'data);

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

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

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

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

s4 := {
	family: 'NewYork,
	face: 3,
	size: 18};
AddArraySlot(book.styles, s4);

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

s6 := {
	family: 'Espy,
	face: 1,
	size: 10};
AddArraySlot(book.styles, s6);


// Contents
c1 := {
	data: "The Kids Who Flew To The Moon

",
	styles: [29, s4, 1, s5, 1, s3, 1, s1],
	layout: 4
};
book.contents[0] := c1;

c2 := {
	data: "The Boy
",
	styles: [8, s5, 1, s3],
	layout: 3
};
book.contents[1] := c2;

c3 := {
	data: "Once upon a time, there was a little boy who dreamed of flying to the moon. He would fly there in a sleek silver rocket ship with his trusty companion, Biff The Wonder Dog. 

When they arrived, he would eat green cheese all day long, set reduced gravity sports records and never have to do any homework.

",
	styles: [305, s1, 1, s3]
};
book.contents[2] := c3;

c4 := {
	data: GetNamedResource("PICT", "22132", 'picture),
	layout: 257
};
book.contents[3] := c4;

c5 := {
	data: "This page uses the alignTop flag to align the top of the sidebar picture with the body text in the main column. 
",
	styles: [19, s1, 8, s6, 87, s1],
	layout: 64
};
book.contents[4] := c5;

c6 := {
	data: "The Girl
",
	styles: [9, s5, 1, s3],
	layout: 3
};
book.contents[5] := c6;

c7 := {
	data: "Once upon a time, there was a little girl who dreamed of flying to the moon. She would fly there in a sleek silver rocket ship with her trusty companion, Daphne The Wonder Cat. 
",
	viewFont: s1
};
book.contents[6] := c7;

c8 := {
	data: "This version of the story uses the pageBottom flag to pin this expalanatory paragraph to the bottom of the page. The sidebar picture is aligned to the bottom of this paragraph by attaching the alignBottom flag to the .picture command associated with it.",
	styles: [35, s1, 10, s6, 148, s1, 11, s6, 12, s1, 9, s6, 29, s1],
	layout: 64
};
book.contents[7] := c8;

c9 := {
	data: GetNamedResource("PICT", "20309", 'picture),
	layout: 513
};
book.contents[8] := c9;


// Kiosk (menu page) references

// Page Templates
NBMDefault := {
	nColumns: 1,
	column: [{
	width: 12,
	type: 0}]
};
AddArraySlot(book.templates, NBMDefault);
bedtimeStory := {
	nColumns: 2,
	column: [{
	width: 3,
	type: 1}, {
	width: 9,
	type: 0}]
};
AddArraySlot(book.templates, bedtimeStory);

// Bounds List
bnd1 := [0,16,240,318];
bnd2 := [0,16,240,44];
bnd3 := [63,44,240,224];
bnd4 := [0,44,31,194];
bnd5 := [63,247,240,318];
bnd6 := [63,44,240,142];
bnd7 := [63,205,240,317];
bnd8 := [0,170,50,317];

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

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

// Page 2
page := MakePage(bedtimeStory);
AddArraySlot(page.blocks, MakeBlock(bnd2, c2));
AddArraySlot(page.blocks, MakeBlock(bnd3, c3));
AddArraySlot(page.blocks, MakeBlock(bnd4, c4));
AddArraySlot(page.blocks, MakeBlock(bnd5, c5));
AddArraySlot(pageList.pages, page);

// Page 3
page := MakePage(bedtimeStory);
AddArraySlot(page.blocks,
	{bounds: bnd2,
	item: c6,
	dataLen: 8});
AddArraySlot(page.blocks, MakeBlock(bnd6, c7));
AddArraySlot(page.blocks, MakeBlock(bnd7, c8));
AddArraySlot(page.blocks, MakeBlock(bnd8, c9));
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: c1
});
AddArraySlot(bp1, 1);
AddArraySlot(b1.list, {	// 1
	level: 2,
	item: c2
});
AddArraySlot(bp1, 2);
AddArraySlot(b1.list, {	// 2
	level: 2,
	item: c6
});
AddArraySlot(bp1, 3);
AddArraySlot(book.browsers, b1);
AddArraySlot(pageList.contents, bp1);


// Indices and Sub-Indices
