//__JavaScript program created by Jeff Gerke and Randy Ingermanson.
//__Copyright 2006. All rights reserved. 
//__For more information, visit:
//__ http://www.jeffersonscott.com
//__ http://www.rsingermanson.com

//__This 

var genreList = [
	'a science fiction',
	'a fantasy',
	'a time travel',
	'an alternate history',
	'a near-future',
	'a far-future',
	'a post-apocalyptic',
	'a supernatural thriller',
	'a spiritual warfare',
	'a vampire',
	'a werewolf',
	'a bizarre hybrid-genre',
	'a technothriller',
	'an end times',
	'a space opera',
	'a comic',
	'a horror',
	'an epic fantasy',
	'a dark fantasy',
	'an epic disaster',
	'an alien invasion',
	'a pure speculative',
	'an everyday magic',
	'a forbidden romance',	
	];
	
var heroList = [
	'a young man',
	'a young woman',
	'a jokester',
	'a teen with a troubled past',
	'a boy',
	'a girl',
	'a warrior',
	'a healer',
	'a holy man',
	'a holy woman',
	'a wizard',
	'an inventor',
	'an athlete',
	'a professional soldier',
	'a waitress',
	'a performer',
	'a rich man',
	'a rich woman',
	'a rich kid',
	'a physician',
	'a mechanic',
	'a poor man',
	'a poor woman',
	'a poor kid',
	'a thief',
	'a recovering alcoholic',
	'a paranoid schizophrenic',
	'a cook',
	'a retired military man',
	'a fallen woman',
	'a hotshot',
	'a sailor',
	'an explorer',
	'a religious leader',
	'a government official',
	'a middle manager',
	'an accountant',
	'a farmer',
	'a farmer\'s daughter',
	'a beauty queen',
	'a spoiled young person',
	'a fallen religious leader',
	'a shyster',
	'a traveling salesman',
	'a traveling evangelist',
	'a musician',
	'an artist',
	'a composer',
	'a writer',
	'a poet',
	'an intellectual',
	'a rebel',
	'a pirate',
	'a drug addict',
	'a recovering drug addict',
	'a homeless man',
	'a homeless woman',
	'an orphan',
	'a widow',
	'a runaway',
	'a disillusioned man',
	'a disillusioned woman',
	'a man on the brink of suicide',
	'a woman on the brink of suicide',
	'a man on the brink of homicide',
	'a woman on the brink of homicide',
	'a man who has lost his family',
	'a woman who has lost her family',
	'an abandoned man',
	'an abandoned woman',
	'a coward',
	'a carpenter',
	'an engineer',
	'a pretender',
	'a womanizer',
	'a seductress',
	'a complete nerd',
	'a bookworm',
	'a regular joe',
	'an upstanding citizen',
	'a crusader',
	'a malcontent',
	'a Pollyanna-type',
	'a zealot',
	'a terrorist',
	'a deeply wounded man',
	'a deeply wounded woman',
	'a radical environmentalist',
	'an ex-hippie',
	'a stranger in a strange land',
	'a foreigner (or alien)',
	'a bad boy',
	'a bad girl',
	'a loose woman',
	'an utterly selfish man',
	'an utterly selfish woman',
	'a pretender',
	'a failed musician',
	'a failed novelist',
	'an obese woman',
	'an obese man',
	'a vagabond',
	'a newly sentient artificial intelligence',
	];
	
var goalList = [
	'make the world a better place',
	'save the world',
	'spread the gospel',
	'save the whales',
	'protect the environment',
	'eradicate illiteracy',
	'eliminate poverty',
	'defeat all evil everywhere',
	'become a better person',
	'run for political office',
	'find a mate',
	'settle down and start a family',
	'be validated and approved',
	'be liked',
	'overcome a bad habit',
	'recover from a tragedy',
	'get on with life after a fall',
	'make up for a terrible mistake',
	'rebuild what was destroyed',
	'find the meaning of life',
	'get back with an estranged spouse',
	'find his/her child',
	'bounce back from a loss',
	'regain his/her self-respect',
	'find God, if he really exists',
	'get back at God',
	'get what he/she deserves',
	'strike it rich',
	'become famous',
	'see the world',
	'find his/her place in the world',
	'carve out a kingdom',
	'reclaim his/her good reputation',
	'get back at his/her parents',
	'be a hero',
	'become an accomplished artist',
	'get out of this place',
	'earn his/her parents\' respect',
	'fit in',
	'no longer be shackled by this disability',
	'find healing',
	'conquer an unconquerable foe',
	'set a world record',
	'write a book',
	'just play games all day',
	'live the good life',
	'retire ',
	'have servants',
	'build a lasting monument',
	'establish his/her legacy',
	'escape from his situation',
	'show those people a thing or two',
	'prove that he/she is not what they think',
	'overcome disability',
	'ease the world\'s suffering',
	'start a cult',
	'be the hero for a change',
	'see how the other side lives',
	'take life by the tail',
	'see justice done',
	'rid the land of evil',
	'scare away the riffraff',
	'make this a respectable place',
	'find his or her family',
	'forgive himself/herself',
	'return to his/her home',
	'cure a particular disease',
	'exact vengeance on an enemy',
	'finally leave home',
	'break free from some tyranny',
	'believe in himself/herself',
	'learn more about God',
	'leave his/her religion',
	'discover ultimate truth',
	'strike out on his/her own',
	'stand on his/her own two feet',
	'forget the past',
	'finally move on',
	'let go of one who was lost',
	'relive the glory days',
	'explore a new land',
	'live his/her last days well',
	'reclaim his/her honor',
	'accomplish something his/her competitor never could',
	'boldly go where no one has gone before',
	'burst through the glass ceiling',
	'write a heartbreaking work of staggering genius',
	];
	
var villainList = [
	'the angry sea',
	'an active volcano',
	'an earthquake',
	'cosmic rays',
	'an alien invasion',
	'an infestation of nanobots',
	'an escaped artificial intelligence',
	'robots gone mad',
	'a nuclear meltdown',
	'an undersea eruption',
	'an edict of the galactic council',
	'little green men',
	'a crippled self-image',
	'a natural disaster',
	'an outbreak of plague',
	'an ongoing war',
	'the outbreak of war',
	'betrayal',
	'an assassination',
	'a debilitating disease',
	'a hurricane',
	'a tornado',
	'an evil wizard',
	'a conniving woman',
	'a wicked stepmother',
	'a plague of locusts',
	'zombies on a rampage',
	'the forces of evil',
	'demonic foes',
	'a board of directors',
	'enemy soldiers',
	'guilt',
	'a horrible memory',
	'a crazed dictator',
	'repressive laws',
	'a strict moral code',
	'self-defeating behavior',
	'a saboteur ',
	'a glob of gelatinous goo',
	'a band of orcs',
	'brigands',
	'treacherous half-ogres',
	'a hideous troll',
	'a lack of self-confidence',
	'an abusive mother',
	'an abusive father',
	'an abusive spouse',
	'the rules of engagement',
	'the precepts of Scripture',
	'an overachieving conscience',
	'an oppressive governmental system',
	'medications',
	'a medical condition',
	'an addiction',
	'an ailing parent',
	'a needy spouse',
	'the need to make everyone like him/her',
	'the belief that he/she must be perfect in all things',
	'an eating disorder',
	'allergies',
	'a fear of crowds',
	'spores, molds, and fungus',
	'voices in his/her head',
	'dragons',
	'a temporal anomaly',
	'a band of devil worshippers',
	'poor eyesight',
	'a throbbing headache',
	'a previous obligation',
	'a promise he/she made to his/her mother',
	'a family debt',
	'crushing financial debt',
	'a fear of heights',
	'agoraphobia (fear of the outdoors)',
	'limited computer skills',
	'an embarrassing lisp',
	'the wrong kind of friends',
	'gun-wielding mutants',
	'an angry mob',
	'the fact that such things are simply not done',
	'the emperor',
	'the president',
	'the king',
	'the usurper',
	'the Black Knight',
	'the Black Prince',
	'surf Nazis',
	'a mysterious force',
	'obsessive-compulsive disorder',
	'a freak accident',
	'a temporal rift',
	'lizard men',
	'a blind date gone wrong',
	'the wrong trousers',
	'tragic forgetfulness',
	'an unresolved dilemma',
	'being at war with himself/herself',
	'a big fat bully',
	'dimensional shifting',
	'a time-traveling ne\'er-do-well',
	'a pack of velociraptors',
	'drunken computer geeks',
	'the creature',
	'plan 9 from outer space',
	'the council of churches',
	'Satan',
	'God, or so it seems',
	'cannibals',
	'a mad scientist',
	'an angry gang',
	'brigands',
	'a jilted lover',
	'a hive mind',
	'a newly sentient artificial intelligence',
	];
	
var villainGoalList = [
	'world domination',
	'eliminating our hero',
	'crushing all opposition',
	'winning the pennant',
	'getting to the championship',
	'escaping his/her/its own enemies',
	'exploiting natural resources for his/her own sordid gain',
	'absconding with the treasure',
	'chaos',
	'anarchy',
	'an expansion of the trade routes',
	'bettering his/her own position',
	'usurping proper authority',
	'replacing the hero in every way',
	'destroying the hero and his/her family',
	'eradicating a certain way of life',
	'exterminating all human life',
	'saving the whales',
	'repairing the ozone',
	'getting his planet admitted to the federation',
	'raising money for an orphanage',
	'perfecting the human race',
	'harmony between all life forms',
	'colonizing the outer rim',
	'harvesting organs',
	'human trafficking',
	'rigging the big game',
	'swindling the people',
	'stealing the hero\'s love',
	'starting a rival corporation',
	'starting a rival colony',
	'starting a rival music group',
	'sabotaging the hero\'s plans',
	'besting the hero in every important way',
	'beating the hero out of a promotion',
	'exacting vengeance',
	'turning the people away from God',
	'turning the people to God',
	'helping the enemy',
	'betraying the good guys',
	'ushering in a reign of evil',
	'silencing opposition to a dastardly plan',
	'paving the way for an insidious plan',
	'scouting for an enemy invasion',
	'improving his/her singing voice',
	'wooing the hero\'s loved ones away',
	'turning the hero\'s loved ones against him/her',
	'inciting a riot',
	'returning the world to a feudal system',
	'gaining personal advantage to the detriment of all others',
	'underselling honest competition',
	'tricking people out of their inheritance',
	'being first with the crucial invention',
	'being first with the crucial discovery',
	'winning the hearts of the people',
	'setting the people up for a terrible fall',
	'winning at all costs',
	'finally achieving the approval of his/her father',
	'undoing a terrible wrong',
	'preventing a great evil',
	'tearing down a great leader',
	'revealing a massive cover-up',
	'returning things to the way they were',
	'equalizing the pressure between worlds',
	'opening a dimensional shift',
	'perfecting a time machine',
	'ushering in a reign of terror',
	'committing the perfect crime',
	'repeating the infamous deeds of yesteryear',
	'upsetting the balance of power',
	'playing both sides against the middle',
	'becoming a cannibal',
	'covering up his/her addiction',
	'covering up his/her mistake',
	'compensating for a perceived weakness',
	'writing a heartbreaking work of staggering genius',
	'finding the lost planet',
	'resurrecting the greatest vampire of all time',
	'uniting the clans',
	'uniting the forces of evil',
	'beating the devil at his own game',
	'disproving the resurrection of Christ',
	'cutting off the colony\'s supplies',
	'poisoning the crew',
	'planting a potent seed of doubt',
	'claiming the hero\'s work as his/her own',
	'solving the last mathematical riddle',
	'achieving sentience',
	'preventing the cessation of his/her life\'s work',
	'covering over someone else\'s indiscretion',
	'punishing someone who escaped justice',
	'protecting the dodo way of life',
	'covering over his/her own indiscretion',
	'reaching the culmination of forbidden research',
	'animating a stone golem',
	'overturning the recent treaty',
	'disrupting the old alliance',	
];
	
var lessonList = [
	'that his/her flesh is ruling him',
	'that he/she really does need God',
	'how to abide in Christ',
	'the results of that long-held bitterness',
	'what is truly important',
	'that self-worth is secure only in Him',
	'to wait on His timing',
	'to cease his/her selfish plans',
	'to give his/her life to God\'s purposes',
	'to accept the calling God has on his/her life',
	'to surrender the dream (at least for now)',
	'that he/she must move much closer to God',
	'that it wasn\'t God who failed him/her long ago',
	'that He is not heartless or distant',
	'that He grieves for his/her suffering',
	'that the self-punishment must end',
	'that he/she is actually engaging in idolatry',
	'that the Bible really is reliable',
	'that He exists',
	'that He is trustworthy',
	'that He is faithful',
	'that He is a God of forgiveness',
	'that He is a God of hope',
	'that He is a God of new beginnings',
	'that he/she is completely accepted by God',
	'that deeds done in the power of the flesh can never please God',
	'that even some "good" things can be wrong',
	'that His timing is best',
	'to surrender to God\'s plan',
	'that those dreams really are from God',
	'that He does His best work with broken vessels',
	'that His love extends even to these',	
];
	
var attributeList = [
	'resourcefulness',
	'resilience',
	'acceptance of the spiritual lesson',
	'surrender',
	'intelligence',
	'creative gift',
	'sacrifice',
	'disobedience',
	'obedience',
	'courage',
	'mistakes',
	'forgiveness',
	'athletic prowess',
	'sense of humor',
	'sense of timing',
	'vast readings',
	'research',
	'cleverness',
	'magical skills',
	'faith',
	'undying loyalty',
	'faithfulness',
	'fidelity',
	'patriotism',
	'education',
	'compulsion',
	'illness',
	'musical skill',
	'large vocabulary',
	'family\'s money',
	'persistence',
	'tenderness',
	'compassion',
	'negligence',
	'attention to detail',
	'photographic memory',
	'knowledge of Scripture',
	'spiritual warfare',
	'martial arts training',
	'knowledge of Celtic lore',
	'vast DVD collection',
	'ability to memorize',
	'theatrics',
	'acting skill',
	'circus training',
	'horsemanship',
	'marksmanship',
	'computer skills',
	'programming skills',
	'directorial debut',
	'coming out party',
	'administrative assistants',
	'history of criminal activity',
	'shady friends',
	'engineering prowess',
	'knowledge of insects',
	'skill in the kitchen',
	'hand-eye coordination',
	'past indiscretions',
	'vast crowd of supporters',
	'childhood of poverty',
	'navigational skills',
	'sense of direction',
	'poor sense of direction',
	'ability to see the big picture',
	'willingness to obey God',
	'fashion sense',
	'skill as an interior decorator',
	'history of police work',
	'knowledge of intergalactic ethics',
	'military background',
	'special forces training',
	'Olympic medals',
	'ability to communicate with animals',
	'experience with terraforming',
	'knowledge of cybernetics',
	'penchant for chocolate',
	'eye for quality',
	'ear for dialogue',
	'ability to throw his/her voice',
	'tendency to show kindness to strangers',
	'skill at river dancing',
	'time as a prisoner aboard the UFO',
	'telekinetic abilities',	
];
	
var helperList = [
	'a freak snowstorm',
	'a specter from the past',
	'the stock market crash',
	'an outbreak of plague',
	'the arrival of the father race',
	'the arrival of the cavalry',
	'the sudden death of the leader',
	'the mysterious disappearance of the item',
	'a last-minute breakthrough',
	'disease-bearing mosquitoes',
	'a friendly alien names Benny',
	'the wicked witch turned good',
	'the patrol thought lost',
	'the villain\'s change of heart',
	'the villain\'s comely child',
	'a bomb-sniffing dog',
	'one thousand gallons of rocky road ice cream',
	'the bonging of the clock',
	'the return of the prodigal',
	'the discovery of the disc',
	'an alliance between former foes',
	'a loss of power',
	'an angel named Ricky',
	'magnetic toys',
	'a freak earthquake',
	'a solar eclipse',
	'a new wormhole',
	'giant eagles',
	'a mysterious fire',
	'the Royal Mounted Police',
	'peacekeeping aliens',
	'well-meaning necromancers',
	'J.R.R. Tolkien',
	'C.S. Lewis',
	'William Shakespeare',
	'the attendees of a dentistry convention',
	'a swarm of bees',
	'the Force',
	'an unlooked-for ally',
	'a kindly half-orc named Barf',
	'an ad hoc alliance between cats and dogs',
	'speaking eels',
	'a fire-breathing dragon',
	'the Sta-Puft Marshmallow Man',
	'the hero\'s lost love',
	'the hero\'s father',
	'the hero\'s old sidekick',
	'the Maytag repairman',
	'dumb luck',
	'a divine appointment',
	'the sudden changing sides of an old enemy',
	'an imperial edict',
	'a long-dormant automaton suddenly roused',
	'a 50-foot woman',
	'snails',
	'God Himself',
	];
	
var outcomeList = [
	'day is saved',
	'good guys win',
	'bad guy gets what\'s coming to him',
	'guy gets the girl',
	'planets are aligned',
	'universe is saved',
	'parallel universes are returned to normal',
	'danger is averted',
	'common good is restored',
	'alliance goes through as planned',
	'teenager does not kill herself/himself',
	'cost of living goes way down',
	'family is reunited',
	'aliens are defeated',
	'sense of fair play is restored',
	'spacecraft lands safely',
	'library is saved',
	'barn dance goes forward as planned',
	'bad guys win (waa)',
	'right girl ends up with the right guy',
	'concert goes on as scheduled',
	'authorities are none the wiser',
	'interdimensional rift is repaired',
	'demons are sent to the abyss',
	'corrupt government is overthrown',
	'colony is saved',
	'ship makes it to its destination',
	'baby is born--healthy and normal',
	'UFO is able to return home',
	'fairies are able to return to their world',
	'relic is preserved',
	'amulet is recovered',
	'spell is broken',
	'wand is destroyed',
	'band of wandering minstrels is eaten',
	'circus is kept alive',
	'show goes on',
	'ministry is saved',
	'children are rescued',
	'villain gets away',
	'hero learns his/her lesson',
	'collision is averted',
	'fire is put out',
	'seas return to their normal level',
	'storm vanishes as quickly as it had appeared',
	'allies cement their bond through a treaty',
	'danger is abolished for good',
	'museum is closed',
	'machine is permanently dismantled',
	'villain is defeated (or is he?)',
	'invasion is successful',
	'invasion is thwarted',
	'lovers are reunited',
	'family is reunited',
	'children are placed in good homes',
	'network is brought back online',
	'colony expands',
	'terraforming is completed',
	'company is put out of business',
	'alliance lives to fight another day',
	'dodo way of life is preserved',	
];
	
var iGenre = Math.floor(genreList.length*Math.random());
var iHero = Math.floor(heroList.length*Math.random());
var iGoal = Math.floor(goalList.length*Math.random());
var iVillain = Math.floor(villainList.length*Math.random());
var iVillainGoal = Math.floor(villainGoalList.length*Math.random());
var iLesson = Math.floor(lessonList.length*Math.random());
var iAttribute = Math.floor(attributeList.length*Math.random());
var iHelper = Math.floor(helperList.length*Math.random());
var iOutcome = Math.floor(outcomeList.length*Math.random());

/**
 * Write a story using the above data.
 */
function writeStory() 
{
	document.write("This is " + genreList[iGenre]);
	document.write(" story about " + heroList[iHero]);
	document.write(" who wants to " + goalList[iGoal]);
	document.write(" but is prevented from doing so by " + villainList[iVillain]);
	document.write(" bent on " + villainGoalList[iVillainGoal] + ". ");
	document.write("God has designs on our hero, however. He wants to teach him/her " + lessonList[iLesson] + ", a lesson he/she resists. ");
	document.write("In the end, through our hero's " + attributeList[iAttribute]);
	document.write(" and the intervention of " + helperList[iHelper]);
	document.write(", the " + outcomeList[iOutcome] + ".");
}
