siteMap = new Array(Array("Historical Fiction", "historical-fiction.html", new Array(new Array("A Tale Of Two Cities", "a-tale-of-two-cities", 45),new Array("An Occurrence At Owl Creek Bridge", "an-occurrence-at-owl-creek-bridge", 3),new Array("Ben-Hur:  A Tale Of The Christ", "ben-hur-a-tale-of-the-christ", 81),new Array("A Brush With The Chinese", "a-brush-with-the-chinese", 1),new Array("A Pipe Of Mystery", "a-pipe-of-mystery", 1),new Array("Among Malay Pirates: A Tale Of Adventure And Peril", "among-malay-pirates-a-tale-of-adventure-and-peril", 11),new Array("At Agincourt", "at-agincourt", 20),new Array("Bears And Dacoits: A Tale Of The Ghauts", "bears-and-dacoits-a-tale-of-the-ghauts", 2),new Array("Beric The Briton: A Story Of The Roman Invasion", "beric-the-briton-a-story-of-the-roman-invasion", 21),new Array("Bonnie Prince Charlie: A Tale Of Fontenoy And Culloden", "bonnie-prince-charlie-a-tale-of-fontenoy-and-culloden", 20),new Array("The Bravest Of The Brave; Or, With Peterborough In Spain", "the-bravest-of-the-brave-or-with-peterborough-in-spain", 17),new Array("By England's Aid: The Freeing Of The Netherlands, 1585-1604", "by-englands-aid-the-freeing-of-the-netherlands-1585-1604", 23),new Array("Pike And Dyke:  A Tale Of The Rise Of The Dutch Republic", "pike-and-dyke-a-tale-of-the-rise-of-the-dutch-republic", 21),new Array("By Sheer Pluck: A Tale Of The Ashanti War", "by-sheer-pluck-a-tale-of-the-ashanti-war", 23),new Array("Colonel Thorndyke's Secret", "colonel-thorndykes-secret", 21),new Array("The Dragon And The Raven: Or The Days Of King Alfred", "the-dragon-and-the-raven-or-the-days-of-king-alfred", 19),new Array("Forest And Frontiers: Or, Adventures Among The Indians", "forest-and-frontiers-or-adventures-among-the-indians", 22),new Array("Friends Though Divided: A Tale Of The Civil War", "friends-though-divided-a-tale-of-the-civil-war", 26),new Array("In Freedom's Cause", "in-freedoms-cause", 27),new Array("In The Heart Of The Rockies: A Story Of Adventure In Colorado", "in-the-heart-of-the-rockies-a-story-of-adventure-in-colorado", 19),new Array("In The Reign Of Terror: The Adventures Of A Westminster Boy", "in-the-reign-of-terror-the-adventures-of-a-westminster-boy", 15),new Array("In Times Of Peril: A Tale Of India", "in-times-of-peril-a-tale-of-india", 24),new Array("Jack Archer: A Tale Of The Crimea", "jack-archer-a-tale-of-the-crimea", 26),new Array("A Knight Of The White Cross", "a-knight-of-the-white-cross", 23),new Array("The Lion Of The North", "the-lion-of-the-north", 25),new Array("A March On London Being A Story Of Wat Tyler's Insurrection", "a-march-on-london-being-a-story-of-wat-tylers-insurrection", 19),new Array("On The Pampas Or The Young Settlers", "on-the-pampas-or-the-young-settlers", 18),new Array("Rujub, The Juggler", "rujub-the-juggler", 23),new Array("Saint George For England", "saint-george-for-england", 22),new Array("The Paternosters", "the-paternosters", 1),new Array("The Young Buglers", "the-young-buglers", 20),new Array("Through The Fray: A Tale Of The Luddite Riots", "through-the-fray-a-tale-of-the-luddite-riots", 20),new Array("The Treasure Of The Incas: A Story Of Adventure In Peru", "the-treasure-of-the-incas-a-story-of-adventure-in-peru", 20),new Array("True To The Old Flag: A Tale Of The American War Of Independence", "true-to-the-old-flag-a-tale-of-the-american-war-of-independence", 21),new Array("When London Burned", "when-london-burned", 21),new Array("White Faced Dick: A Story Of Pine Tree Gulch", "white-faced-dick-a-story-of-pine-tree-gulch", 1),new Array("With Buller In Natal: Or, A Born Leader", "with-buller-in-natal-or-a-born-leader", 20),new Array("With Lee In Virginia: A Story Of The American Civil War", "with-lee-in-virginia-a-story-of-the-american-civil-war", 20),new Array("With Moore At Corunna", "with-moore-at-corunna", 22),new Array("Won By The Sword: A Story Of The Thirty Years' War", "won-by-the-sword-a-story-of-the-thirty-years-war", 21),new Array("Wulf The Saxon: A Story Of The Norman Conquest", "wulf-the-saxon-a-story-of-the-norman-conquest", 22),new Array("The Young Carthaginian", "the-young-carthaginian", 22),new Array("Lady Baltimore", "lady-baltimore", 24),new Array("Master Humphrey's Clock", "master-humphreys-clock", 7),new Array("My Lady Of The North / The Love Story Of A Gray Jacket", "my-lady-of-the-north-the-love-story-of-a-gray-jacket", 39),new Array("Richard Carvel", "richard-carvel", 58),new Array("The Crisis", "the-crisis", 53),new Array("The Last Of The Mohicans", "the-last-of-the-mohicans", 33),new Array("The Lion's Skin", "the-lions-skin", 23),new Array("The Red Acorn", "the-red-acorn", 19),new Array("The Red Badge Of Courage / An Episode Of The American Civil War", "the-red-badge-of-courage-an-episode-of-the-american-civil-war", 24),new Array("The Scouts Of Stonewall / The Story Of The Great Valley Campaign", "the-scouts-of-stonewall-the-story-of-the-great-valley-campaign", 15),new Array("The Star Of Gettysburg / A Story Of Southern High Tide", "the-star-of-gettysburg-a-story-of-southern-high-tide", 13),new Array("The Virginian / A Horseman Of The Plains", "the-virginian-a-horseman-of-the-plains", 36),null)),Array("Romance", "romance.html", new Array(new Array("Agnes Grey", "agnes-grey", 25),new Array("Emma", "emma", 55),new Array("Great Expectations", "great-expectations", 59),new Array("Holiday Romance", "holiday-romance", 4),new Array("Jane Eyre", "jane-eyre", 37),new Array("Mansfield Park", "mansfield-park", 48),new Array("Northanger Abbey", "northanger-abbey", 31),new Array("Persuasion", "persuasion", 24),new Array("Pride And Prejudice", "pride-and-prejudice", 61),new Array("Sense And Sensibility", "sense-and-sensibility", 50),null)),Array("Children's Literature", "childrens-literature.html", new Array(new Array("A Little Princess", "a-little-princess", 18),new Array("Anne Of Avonlea", "anne-of-avonlea", 30),new Array("Anne Of Green Gables", "anne-of-green-gables", 38),new Array("Anne Of The Island", "anne-of-the-island", 41),new Array("The Birds' Christmas Carol", "the-birds-christmas-carol", 7),new Array("Black Beauty", "black-beauty", 49),new Array("Cinderella Or, The Little Glass Slipper And Other Stories", "cinderella-or-the-little-glass-slipper-and-other-stories", 53),new Array("Dorothy And The Wizard In Oz", "dorothy-and-the-wizard-in-oz", 18),new Array("The Emerald City Of Oz", "the-emerald-city-of-oz", 30),new Array("Fanny, The Flower-Girl", "fanny-the-flower-girl", 6),new Array("Further Chronicles Of Avonlea", "further-chronicles-of-avonlea", 15),new Array("Glinda Of Oz", "glinda-of-oz", 24),new Array("The Great Big Treasury Of Beatrix Potter", "the-great-big-treasury-of-beatrix-potter", 19),new Array("Hans Brinker Or The Silver Skates", "hans-brinker-or-the-silver-skates", 48),new Array("Heidi", "heidi", 23),new Array("The Little Lame Prince", "the-little-lame-prince", 15),new Array("Little Lord Fauntleroy", "little-lord-fauntleroy", 15),new Array("The Lost Princess Of Oz", "the-lost-princess-of-oz", 26),new Array("New Chronicles Of Rebecca", "new-chronicles-of-rebecca", 11),new Array("Pollyanna", "pollyanna", 32),new Array("Rainbow Valley", "rainbow-valley", 35),new Array("Rebecca Of Sunnybrook Farm", "rebecca-of-sunnybrook-farm", 31),new Array("Rilla Of Ingleside", "rilla-of-ingleside", 35),new Array("The Story Of Doctor Dolittle", "the-story-of-doctor-dolittle", 21),new Array("The Golden Road", "the-golden-road", 33),new Array("The Magic Of Oz", "the-magic-of-oz", 23),new Array("The Story Girl", "the-story-girl", 32),new Array("The Tin Woodman Of Oz", "the-tin-woodman-of-oz", 24),new Array("The Wind In The Willows", "the-wind-in-the-willows", 12),new Array("The Wonderful Wizard Of Oz", "the-wonderful-wizard-of-oz", 24),null)),Array("History", "history.html", new Array(new Array("Abraham Lincoln And The Union, A Chronicle Of The Embattled North", "abraham-lincoln-and-the-union-a-chronicle-of-the-embattled-north", 15),new Array("Captain John Smith", "captain-john-smith", 18),new Array("David Crockett: His Life And Adventures", "david-crockett-his-life-and-adventures", 13),new Array("First Across The Continent: The Story Of The Exploring Expedition Of Lewis And Clark In 1804-5-6", "first-across-the-continent-the-story-of-the-exploring-expedition-of-lewis-and-clark-in-1804-5-6", 26),new Array("Hero Tales From American History", "hero-tales-from-american-history", 26),new Array("History Of The Impeachment Of Andrew Johnson", "history-of-the-impeachment-of-andrew-johnson", 14),new Array("Hospital Sketches", "hospital-sketches", 6),new Array("Personal Memoirs Of U. S. Grant (Complete)", "personal-memoirs-of-u-s-grant-complete-", 73),new Array("The Sequel Of Appomattox: A Chronicle Of The Reunion Of The States", "the-sequel-of-appomattox-a-chronicle-of-the-reunion-of-the-states", 14),new Array("The Age Of Big Business: A Chronicle Of The Captains Of Industry", "the-age-of-big-business-a-chronicle-of-the-captains-of-industry", 8),new Array("The Boys' Life Of Abraham Lincoln", "the-boys-life-of-abraham-lincoln", 13),new Array("The Fathers Of The Constitution: A Chronicle Of The Establishment Of The Union", "the-fathers-of-the-constitution-a-chronicle-of-the-establishment-of-the-union", 11),new Array("The Grand Canyon Of Arizona: How To See It", "the-grand-canyon-of-arizona-how-to-see-it", 32),new Array("The Great Boer War", "the-great-boer-war", 39),new Array("The Passing Of The Frontier: A Chronicle Of The Old West", "the-passing-of-the-frontier-a-chronicle-of-the-old-west", 10),null)),Array("Science Fiction", "science-fiction.html", new Array(new Array("Twenty Thousand Leagues Under The Sea", "twenty-thousand-leagues-under-the-sea", 45),new Array("Eight Hundred Leagues On The Amazon", "eight-hundred-leagues-on-the-amazon", 40),new Array("In Search Of The Castaways, Or The Children Of Captain Grant", "in-search-of-the-castaways-or-the-children-of-captain-grant", 65),new Array("The Master Of The World", "the-master-of-the-world", 18),new Array("Michael Strogoff, Or The Courier Of The Czar", "michael-strogoff-or-the-courier-of-the-czar", 32),new Array("Off On A Comet, Or Hector Servadac", "off-on-a-comet-or-hector-servadac", 43),new Array("Robur The Conqueror", "robur-the-conqueror", 23),new Array("The Blockade Runners", "the-blockade-runners", 10),new Array("The Invisible Man", "the-invisible-man", 29),new Array("The Mysterious Island", "the-mysterious-island", 61),new Array("The Time Machine", "the-time-machine", 13),new Array("The Underground City", "the-underground-city", 19),null)),Array("Science", "science.html", new Array(new Array("A History Of Aeronautics", "a-history-of-aeronautics", 43),new Array("Bird Neighbors.", "bird-neighbors-", 147),new Array("British Airships: Past, Present And Future", "british-airships-past-present-and-future", 9),new Array("The Burgess Animal Book For Children", "the-burgess-animal-book-for-children", 40),new Array("The Burgess Bird Book For Children", "the-burgess-bird-book-for-children", 45),new Array("Edison: His Life And Inventions", "edison-his-life-and-inventions", 51),new Array("Heroes Of The Telegraph", "heroes-of-the-telegraph", 18),new Array("Iron Workers And Tool Makers", "iron-workers-and-tool-makers", 16),new Array("John James Audubon", "john-james-audubon", 6),new Array("Moths Of The Limberlost", "moths-of-the-limberlost", 15),new Array("The Dominion Of The Air: The Story Of Aerial Navigation", "the-dominion-of-the-air-the-story-of-aerial-navigation", 29),new Array("The Life Of The Spider", "the-life-of-the-spider", 18),new Array("The Story Of Sugar", "the-story-of-sugar", 12),new Array("Wake-Robin", "wake-robin", 9),null)),Array("Mystery", "mystery.html", new Array(new Array("A Study In Scarlet", "a-study-in-scarlet", 13),new Array("The Adventure Of The Cardboard Box", "the-adventure-of-the-cardboard-box", 1),new Array("The Adventure Of The Devil's Foot", "the-adventure-of-the-devils-foot", 1),new Array("The Adventure Of The Dying Detective", "the-adventure-of-the-dying-detective", 1),new Array("The Adventure Of The Red Circle", "the-adventure-of-the-red-circle", 1),new Array("The Adventure Of Wisteria Lodge", "the-adventure-of-wisteria-lodge", 2),new Array("The Adventures Of Sherlock Holmes", "the-adventures-of-sherlock-holmes", 12),new Array("The Adventure Of The Bruce-Partington Plans", "the-adventure-of-the-bruce-partington-plans", 1),new Array("The Disappearance Of Lady Frances Carfax", "the-disappearance-of-lady-frances-carfax", 1),new Array("His Last Bow / An Epilogue Of Sherlock Holmes", "his-last-bow-an-epilogue-of-sherlock-holmes", 1),new Array("The Hound Of The Baskervilles", "the-hound-of-the-baskervilles", 7),new Array("Memoirs Of Sherlock Holmes", "memoirs-of-sherlock-holmes", 11),new Array("The Return Of Sherlock Holmes", "the-return-of-sherlock-holmes", 13),new Array("The Sign Of The Four", "the-sign-of-the-four", 12),new Array("The Captain Of The Polestar And Other Tales", "the-captain-of-the-polestar-and-other-tales", 10),new Array("The Man Who Knew Too Much", "the-man-who-knew-too-much", 8),new Array("The Mysterious Affair At Styles", "the-mysterious-affair-at-styles", 13),new Array("The Red House Mystery", "the-red-house-mystery", 22),new Array("The Valley Of Fear", "the-valley-of-fear", 15),null)),null);

gLocationOffset = "";

function setBooksMenu(booksMenu, chaptersMenu, selection)
{
	var i, j, itemArray;

	// empty existing items
	for (i = booksMenu.options.length; i >= 0; i--)
	{
		booksMenu.options[i] = null; 
	}
	for (i = chaptersMenu.options.length; i >= 0; i--)
	{
		chaptersMenu.options[i] = null; 
	}
	if (selection > 0)
	{
		itemArray = siteMap[selection-1][2];
		booksMenu.options[0] = new Option("List Books");
		booksMenu.options[0].value = 0;
		j = 1;
		// add new items
		for (i = 0; i < itemArray.length; i++)
		{
			booksMenu.options[j] = new Option(itemArray[i][0]);
			booksMenu.options[j].value = i; 
			j++;
		}
   }
	booksMenu.options[0].selected = true;
}

function setChaptersMenu(chaptersMenu, chapterCount)
{
	var i, j;

	// empty existing items
	for (i = chaptersMenu.options.length; i >= 0; i--)
	{
		chaptersMenu.options[i] = null; 
	}
	if (chapterCount > 0)
	{
		chaptersMenu.options[0] = new Option("List Chapters");
		chaptersMenu.options[0].value = 0; 
		j = 1;
		// add new items
		for (i = 1; i <= chapterCount; i++)
		{
			chaptersMenu.options[j] = new Option("Chapter "+i);
			chaptersMenu.options[j].value = i; 
			j++;
		}
		chaptersMenu.options[0].selected = true;
	}
}

function goGoGagetMenus(selectedGenre, selectedBook, selectedChapter)
{
	var newLocation;

	if (selectedGenre <= 0)
	{
		alert("Error! No genre has been selected.");
		return;
	}
	else if (selectedBook <= 0)
	{
		newLocation = "genres/" + siteMap[selectedGenre-1][1];
	}
	else if (selectedChapter == 0)
	{
		newLocation = "books/" + siteMap[selectedGenre-1][2][selectedBook-1][1] + "/index.html";
	}
	else
	{
		if (selectedChapter <= 9)
			newLocation = "books/" + siteMap[selectedGenre-1][2][selectedBook-1][1] + "/chapter-0" + selectedChapter + "-page-01.html";
		else
			newLocation = "books/" + siteMap[selectedGenre-1][2][selectedBook-1][1] + "/chapter-" + selectedChapter + "-page-01.html";
	}
	window.location=gLocationOffset+newLocation;
	return;
}

function createMenus(locationOffset)
{
	var i;

	gLocationOffset = locationOffset;
	document.write('<FORM NAME="navigation">');
	document.write('<SELECT NAME="genres" class="genresMenu" onChange="setBooksMenu(this.form.books, this.form.chapters, this.selectedIndex);">');
	document.write('<OPTION VALUE="-1">Select a Genre');
	for (i = 0; i < (siteMap.length - 1); i++)
	{
		document.write('<OPTION VALUE=');
		document.write(i+1);
		document.write('>');
		document.write(siteMap[i][0]);
	}
	document.write('</SELECT>');
	document.write('<SELECT class="booksMenu" NAME="books" onChange="setChaptersMenu(this.form.chapters, ((this.selectedIndex == 0) ? 0 : siteMap[this.form.genres.selectedIndex-1][2][this.selectedIndex-1][2]));"></SELECT>');
	document.write('<SELECT class="chaptersMenu" NAME="chapters"></SELECT>');
	document.write('<input type=button value="Go" class="goButton" onClick="goGoGagetMenus(this.form.genres.selectedIndex, this.form.books.selectedIndex, this.form.chapters.selectedIndex)">');
	document.write('</FORM>');
}
