//Script &copy; Copyright 2000-2005, Arjan Wardekker. All rights reserved.//
//Bookgenerator Script v.2.1//

function generate(numberofbooks)
{

document.write("<a href=bookgenerator.php>Back</a><p>");
document.write("Your <b>" + numberofbooks + "</b> random book(s):<p>");

for (var i=0; i < numberofbooks; i++) {
var ranwri=(Math.ceil(Math.random()*85)-1);
var ransub=(Math.ceil(Math.random()*100)-1);
var length=(Math.ceil(Math.random()*375)-1);
var rancov=(Math.ceil(Math.random()*11)-1);
var rancol=(Math.ceil(Math.random()*11)-1);
var ranpage=(Math.ceil(Math.random()*7)-1);
var ransta=(Math.ceil(Math.random()*5)-1);
var ranlan=(Math.ceil(Math.random()*24)-1);
var ranqua=(Math.ceil(Math.random()*19)-1);
var ransty=(Math.ceil(Math.random()*6)-1);

if(length<=5)
{
var booksort="Scroll"
}
if(length>=6 && length<=20)
{
var booksort="Scrolls"
}
if(length>=21 && length<=50)
{
var booksort="Booklet"
}
if(length>=51 && length<=200)
{
var booksort="Book"
}
if(length>=201 && length<=300)
{
var booksort="Complete Manual"
}
if(length>=301 && length<=350)
{
var booksort="Tome"
}
if(length>=351)
{
var booksort="Encyclopaedia"
};

var writer=new Array(85)
writer[0]=""
writer[1]="Levi&acute;s"
writer[2]="Githrandir&acute;s"
writer[3]="Eärydia&acute;s"
writer[4]="Fil-Galdur&acute;s"
writer[5]="Callarduran&acute;s"
writer[6]="Lomedia&acute;s"
writer[7]=""
writer[8]="Verion&acute;s"
writer[9]="Amóndra&acute;s"
writer[10]="Gelowien&acute;s"
writer[11]="Sigin&acute;s"
writer[12]="Isárion&acute;s"
writer[13]="Delorfirion&acute;s"
writer[14]="Isarith&acute;s"
writer[15]="Galaecia&acute;s"
writer[16]="Ethelidon&acute;s";
writer[17]=""
writer[18]="Coronar&acute;s"
writer[19]="Zirnath&acute;s"
writer[20]="Gildor&acute;s"
writer[21]="Thi&acute;il&acute;s"
writer[22]="Ignadus&acute;"
writer[23]="Ignalis&acute;"
writer[24]="Pericles&acute;"
writer[25]="Sensor&acute;s"
writer[26]="John Oakenwood&acute;s";
writer[27]="Bjorn&acute;s"
writer[28]="Gildor&acute;s"
writer[29]="Grimli&acute;s"
writer[30]="Crypt&acute;s"
writer[31]="Bulak&acute;s"
writer[32]="Mitchell&acute;s"
writer[33]="Zyrin&acute;"
writer[34]="Elrond&acute;s"
writer[35]="Ted&acute;s"
writer[36]="Nyn&acute;s";
writer[37]="Roigen&acute;s"
writer[38]="Feren&acute;s"
writer[39]="Maralia&acute;s"
writer[40]=""
writer[41]="Mordekainen&acute;s"
writer[42]="Mordekainen&acute;s Ancient"
writer[43]="Tenser&acute;s"
writer[44]="Tenser&acute;s Ancient"
writer[45]="Bigby&acute;s"
writer[46]="Bigby&acute;s Ancient";
writer[47]="Melf&acute;s"
writer[48]="Melf&acute;s Ancient"
writer[49]="Orodin&acute;s"
writer[50]="Vëomir&acute;s"
writer[51]="Unknown"
writer[52]="Anonymous Writer&acute;s"
writer[53]="Sheela&acute;s"
writer[54]="Durin&acute;s"
writer[55]="Corellon&acute;s"
writer[56]="Tinker Corp&acute;s";
writer[57]="Garl&acute;s"
writer[58]="Drehan&acute;s"
writer[59]="Khardin&acute;s"
writer[60]="Frugo&acute;s"
writer[61]="Eloria&acute;s"
writer[62]="Gianna&acute;s"
writer[63]="Delembor&acute;s"
writer[64]="Paladia&acute;s"
writer[65]="Gil-Gaviël&acute;s"
writer[66]="Cytherea&acute;s";
writer[67]="Ehlonna&acute;s"
writer[68]="Alea&acute;s"
writer[69]="Glarr&acute;s"
writer[70]="Yoghurt&acute;s"
writer[71]="Dalith&acute;s"
writer[72]="Rogash&acute;"
writer[73]="Pardos&acute;"
writer[74]="Lolth&acute;s"
writer[75]="Jerathlan&acute;s"
writer[76]="Pandra&acute;s";
writer[77]="Theratlan&acute;s"
writer[78]="Calid&acute;s"
writer[79]="Leona&acute;s"
writer[80]="Elárith&acute;s"
writer[81]="Rhaegwyn&acute;s"
writer[82]="Bhúrin&acute;s"
writer[83]="Unknown Writer&acute;s"
writer[84]="Unknown Writer&acute;s";

var subject=new Array(100)
subject[0]=writer[ranwri]+"&nbsp;Life (biography)"
subject[1]=writer[ranwri]+"&nbsp;Adventures (biography)"
subject[2]=writer[ranwri]+"&nbsp;Studies (biography)"
subject[3]="Alchemy"
subject[4]="Astrology"
subject[5]="Astronomy"
subject[6]="Animals"
subject[7]="Music (specific instrument(s))"
subject[8]="Music"
subject[9]="Art"
subject[10]="Art (specific style, subject and/or sort)"
subject[11]="Art (collection of paintings)"
subject[12]="Art (collection of poetry, songs and/or stories)"
subject[13]="Agriculture"
subject[14]="Handling and Training Animals"
subject[15]="Blacksmithing"
subject[16]="Tinkering"
subject[17]="Creating Gadgets"
subject[18]="Brewing"
subject[19]="Carpentry"
subject[20]="Cooking (recipies)"
subject[21]="Cooking"
subject[22]="Repairing Shoes"
subject[23]="Languages (specific language textbook)"
subject[24]="Dancing (specific style(s))"
subject[25]="Etiquette"
subject[26]="Fires and How to Create Them"
subject[27]="Fishing"
subject[28]="Heraldry"
subject[29]="Leatherworking"
subject[30]="Mining"
subject[31]="Pottery"
subject[32]="Using Ropes in Many Different Ways"
subject[33]="Sailing"
subject[34]="Stonemasonry"
subject[35]="The Weather (meteorology)"
subject[36]="Weaving"
subject[37]="Ancient History (history textbook)"
subject[38]="Engineering"
subject[39]="First Aid (healing)"
subject[40]="Herbalism"
subject[41]="Navigation"
subject[42]="Religion (specific religion)"
subject[43]="Religion (religion in general)"
subject[44]="Magic and Spellcraft"
subject[45]="Disguising"
subject[46]="Forgery"
subject[47]="Games and Gaming"
subject[48]="Gem Cutting"
subject[49]="Juggling"
subject[50]="Healthy and Relaxing Breathing Techniques"
subject[51]="Creating Golems"
subject[52]="Reading Lips"
subject[53]="Setting Snares"
subject[54]="Tumbling"
subject[55]="Veltriloquism"
subject[56]="Armoring"
subject[57]="Making Bows and Arrows"
subject[58]="Charioteering"
subject[59]="Hunting"
subject[60]="Surviving in the Wild"
subject[61]="Tracking"
subject[62]="Weaponsmithing"
subject[63]="Battlefield Tactics"
subject[64]="The Art of War (specific weapon)"
subject[65]="The Art of War (specific fighting style)"
subject[66]="The Art of War: Weapon Catalogue"
subject[67]="Local History (specific region or country)"
subject[68]="Familial History (specific family, nobles' house, etc.)"
subject[69]="Gardening"
subject[70]="Baking"
subject[71]="Maps (regional maps)"
subject[72]="Maps (global maps)"
subject[73]="Barbering"
subject[74]="Democracy"
subject[75]="Bribery"
subject[76]="Burocracy"
subject[77]="Making Books"
subject[78]="Constructing Birdcages"
subject[79]="Woodcarving"
subject[80]="Glass Blowing"
subject[81]="Grooming (horses)"
subject[82]="Cartography"
subject[83]="Tales (legends, tales, folklore, etc.)"
subject[84]="Legends (legends, tales, folklore, etc.)"
subject[85]="Mathematics"
subject[86]="Geology"
subject[87]="Philosophy"
subject[88]="Laws (local)"
subject[89]="Laws (country specific)"
subject[90]="Lock Picking"
subject[91]="Running a Successful Business"
subject[92]="Arcanology"
subject[93]="Prayers (priest prayer- and songbook)"
subject[94]="Big Red Buttons that say Do Not Push"
subject[95]="Living a Decent Life (paladin's handbook)"
subject[96]="Psychology and Psychiatry"
subject[97]="Childraising"
subject[98]="Monsters"
subject[99]="Humor (jokes and the like)";

var cover=new Array(11)
cover[0]="wood"
cover[1]="leather"
cover[2]="cloth"
cover[3]="paper"
cover[4]="clay"
cover[5]="iron"
cover[6]="silver"
cover[7]="gold"
cover[8]="hide (animal)"
cover[9]="hide (humanoid)"
cover[10]="hide (special/monster)"

var color=new Array(11)
color[0]="red"
color[1]="green"
color[2]="blue"
color[3]="yellow"
color[4]="silver"
color[5]="gold"
color[6]="natural"
color[7]="brown"
color[8]="olive"
color[9]="black"
color[10]="white";

var page=new Array(7)
page[0]="parchment"
page[1]="leather"
page[2]="clay tablets"
page[3]="poor quality paper"
page[4]="reasonable quality paper"
page[5]="good quality paper"
page[6]="superior quality paper";

var state=new Array(5)
state[0]="Heavily damaged. A lot of this book's pages are hard to read, if readable at all."
state[1]="Damaged. Some pages may be hard to read."
state[2]="Normal. This book may be a little worn off, but everything is still well readable."
state[3]="Well preserved. This book looks still as if it were new."
state[4]="Incredibly well preserved. This book may have some magical aid to preserve it.";

var lang=new Array(24)
lang[0]="Elf"
lang[1]="Common"
lang[2]="Human (dialect)"
lang[3]="Dwarf"
lang[4]="Halfling"
lang[5]="Gnome"
lang[6]="Dragon"
lang[7]="Pixie"
lang[8]="Orc"
lang[9]="Druidic"
lang[10]="Goblin"
lang[11]="Elemental"
lang[12]="Dryad"
lang[13]="Gnoll"
lang[14]="Giant"
lang[15]="Hobgoblin"
lang[16]="Undercommon"
lang[17]="Troll"
lang[18]="Ogre"
lang[19]="Common"
lang[20]="Common"
lang[21]="Common"
lang[22]="Elf"
lang[23]="Unknown";

var quality=new Array(19)
quality[0]="Completely Useless. This book has nothing to tell, except to complete morons."
quality[1]="Poor. This book contains very little useful information"
quality[2]="Below average. Some information could be obtained from this book."
quality[3]="Average. Given the time to read, this book actually contains some interesting stuff."
quality[4]="Above average. This book contains useful information on it's subject."
quality[5]="Good. This is a good to very good book to read. It contains lots of very useful info."
quality[6]="Masterwork. This book is so good that one could learn a proficiency with it in some weeks of study"
quality[7]=quality[0]
quality[8]=quality[0]
quality[9]=quality[0]
quality[10]=quality[1]
quality[11]=quality[1]
quality[12]=quality[1]
quality[13]=quality[2]
quality[14]=quality[2]
quality[15]=quality[3]
quality[16]=quality[3]
quality[17]=quality[4]
quality[18]=quality[5];

var style=new Array(6)
style[0]="Absolutely boring. Just reading through the first pages makes you sleepy."
style[1]="Not very interesting. After reading through the first chapters, you will probably lose interest."
style[2]="Normal. It isn't boring, but it is not really interesting either."
style[3]="Interesting. Reading this book is far from boring."
style[4]="Very interesting. Reading this book is quite pleasant indeed."
style[5]="Masterwork. You won't like to stop reading this, as it is incredibly interesting, exiting and motivating. Every word will catch your attention and imagination. Addicting stuff.";

document.write("<table rules=all border=1 cellspacing=0 width=600>");
document.write("<tr><td>Title:</td><td>"+writer[ranwri]+"&nbsp;"+booksort+"&nbsp;of&nbsp;"+subject[ransub]+"</td></tr>");
document.write("<tr><td>Pages:</td><td>"+length+"</td></tr>");
document.write("<tr><td>Cover Material:</td><td>"+cover[rancov]+"</td></tr>");
document.write("<tr><td>Cover Color:</td><td>"+color[rancol]+"</td></tr>");
document.write("<tr><td>Page Material:</td><td>"+page[ranpage]+"</td></tr>");
document.write("<tr><td>Current State:</td><td>"+state[ransta]+"</td></tr>");
document.write("<tr><td>Language:</td><td>"+lang[ranlan]+"</td></tr>");
document.write("<tr><td>Subject:</td><td>"+subject[ransub]+"</td></tr>");
document.write("<tr><td>Content Quality:</td><td>"+quality[ranqua]+"</td></tr>");
document.write("<tr><td>Author's Style:</td><td>"+style[ransty]+"</td></tr>");
document.write("</table><P><hr><P>");
}
document.write("<a href=bookgenerator.php>Back</a><p>");
}
