<!---  Hide from non-JavaScript browsers

function randomNumber( lowLim, hiLim ) {
  /*
   * Description:  Generates a pseudo-random number within
   *               the specified range using random()
   * Arguments:
   *   lowLim - lower limit of range for random number
   *   hiLim - upper limit of range for random number
   *
   * Returns:
   *   numeric random number between specified limits.
   */
  // Get a pseudo-random number from random() and
  // normalize to be greater or equal to 0.1 (the {}
  // creates a for-loop with an empty body)
  for ( var rdmNum = Math.random();
        rdmNum < 0.1; 
        rdmNum=rdmNum * 10 ) {}

  // Normalize the 0..1 value returned by random()
  // using the specified low and high limits.
  var normalVal = (hiLim-lowLim) * rdmNum;

  // Truncate the fractional portion of the normalized
  // value using ceil() and add result to low limit
  // and return the value.
  return Math.ceil( normalVal ) + lowLim;
  }  // randomNumber()

function person()
{
        var ThisArray = new Array ("Captian Picard","Commander Riker","Deanna Troi","Geordi","Worf",
"Data","Dr. Crusher","Wesley Crusher","Captain Sisko","Jadzia Dax","Ezri Dax","Neelix",
"Major Kira","Odo","Quark","Rom","Nog","Dr. Bashir","Miles O'Brien","Molly O'Brien","Captain Janeway",
"Chakotay","Tuvok","Tom Paris","Harry Kim","the Doctor","B'ellana Torres","Seven of Nine");
	return ThisArray[randomNumber(0,ThisArray.length-1)];
}		

function otherperson()
{
        var ThisArray = new Array ("Alexander","Leah Brahms","Admiral Hanson","Dr. Pulaski","Tasha Yar",
	"Data's mother","Sarek","Hugh Borg","the Kai","Morn","Rom's girlfriend Leeta","Garak","Molly","Scotty","Spock","Kes","Cassidy Yates",	"Vic Fontaine","Q","the Grand Nagus","Quark's mother","Guinan","Nurse Ogawa","Spot","Barclay");
	return ThisArray[randomNumber(0,ThisArray.length-1)];
}

function villain()
{
        var ThisArray = new Array ("the Borg Queen","Q","Lore","Locutus of Borg","Gul Dukat","Kai Winn",
	"Weyoun","the female changeling","Sela","Seska","a traitor","a spy");
	return ThisArray[randomNumber(0,ThisArray.length-1)];
}

function weirdperson()
{
	var OutString;
	var ThisArray = new Array ("a clone of ","an android duplicate of ","a future self of ",
	"a past self of ","a shapeshifer masquerading as ","an impostor posing as ",
	"an evil alternate-universe ");
	OutString = ThisArray[randomNumber(0,ThisArray.length-1)];
        var Num = randomNumber (1,4)
        if (Num == 1)
	   OutString += miscalien();
        if (Num == 2)
	   OutString += villain();
        if (Num == 3)
	   OutString += otherperson();
        if (Num == 4)
	   OutString += person();
	return OutString;
}


function antagonist()
{
        var OutString;
	var Num = randomNumber (1,10)
        if (Num == 1)
	   OutString = miscalien();
        if (Num == 2)
	   OutString = villain();
        if (Num == 3)
	   OutString = otherperson();
        if (Num == 4)
	   OutString = weirdperson();
	if (Num == 5)
	   OutString = miscalien();
        if (Num == 6)
	   OutString = weirdperson();
        if (Num == 7)
	   OutString = miscalien();
        if (Num == 8)
	   OutString = "a culture that reveres " +concept();
        if (Num == 9)
	   OutString = "a culture ignorant of " +concept();
	if (Num == 10)
	   OutString = "a special guest star";
	return OutString;
}

function miscalien()
{
        var OutString = "";
	var FirstArray = new Array ("an alien","an ancient","a malevolent","a superintelligent","a powerful","a microscopic","an enigmatic","a warlike","an unknown","an evil","a hideous","a deluded","an amnesiac","a dangerous","a destructive","a telepathic","a mysterious","a delusional","a revered","a murderous","a reclusive","a mischevious","a problematic","a curious","a bizarre","an insensitive","a well-known","a vicious","an irritable","a benevolent","a dying","a tiresome");
	OutString += FirstArray[randomNumber(0,FirstArray.length-1)];
	OutString +=" ";
	var SecondArray = new Array ("alien","space","godlike","cybernetic","silicon-based","primitive","invisible","worm-like","shape-shifting","mutated","superevolved","space-faring","crystalline","noncorporeal","reptilian","symbiotic","sentient","subterranean","deep-space","highly advanced","extradimensional","energy-based","human-appearing","vaguely humanoid","cosmic","time-traveling","territorial","monotonous","childlike","luminous","genetically engineered");
	OutString += SecondArray[randomNumber(0,SecondArray.length-1)];
	OutString +=" ";
	var ThirdArray = new Array ("alien","race","entity","being","creature","machine","lifeform","species","presence","parasite","blob","space probe","humanoid","tribe","cloud","disembodied brain","monster","organism","computer virus","computer","hologram","civilization","microbe","woman with big hair","special effect","force","individual","beast","ball of light","insectoid","jellyfish","icthyoid","warrior");
	OutString += ThirdArray[randomNumber(0,ThirdArray.length-1)];
	return OutString;
}

function thing()
{
        var OutString = " a ";
	var FirstArray = new Array ( "mysterious","foreboding","forbidden","dangerous",
	"dazzling","popular","newly-discovered","heavily-guarded","well-known","decrepit",
	"misleading","predictable","dreary","very impressive");
	OutString += FirstArray[randomNumber(0,FirstArray.length-1)];
	OutString +=" ";
	var SecondArray = new Array ("planet","computer","laboratory","derelict ship","asteriod belt","spacial anomaly",
	"dimensional rift","time warp","trap","temple","moon","machine","device","energy field",
	"radiation source","substance","molecule","corpse","clue","trinket","recycled prop",
	"recycled set","matte painting","special effect","set of caves","tunnel system","sewer maze",
	"ventilation duct","Jeffries tube","paradise","utopia","dystopia","civilization","plotline");
	OutString += SecondArray[randomNumber(0,SecondArray.length-1)];
	var Num = randomNumber (1,16);
        if (Num < 3)
	   OutString = shipsystem();
	return OutString;
}

function concept()
{
        var ThisArray = new Array ( "love","tolerance","honor","honesty","integrity","the Prime Directive","respect for all living things","meddling in the affars of others","endangering the crew to save a main character","cultural relativism","a human-centric worldview","the horror of war",
	"never allowing the crew to have what they want most",
	"putting things back the way they were found",
	"the Big Red Reset Button",
	"peace","allegories","diplomacy","diversity");
	return ThisArray[randomNumber(0,ThisArray.length-1)];
}


function result()
{
var OutString = " begins to ";
	var Num = randomNumber (1,16);
        if (Num == 1)
	   OutString += " mutate";
        if (Num == 2)
	   OutString += " die";
        if (Num == 3)
	   OutString += " go insane";
        if (Num == 4)
	   OutString += " discover " + concept();
        if (Num == 5)
	   OutString += " multiply";
        if (Num == 6)
           OutString += " join with " + antagonist();
        if (Num == 7)
           OutString += " divide into a good side and an evil side";
        if (Num == 8)
           OutString += " switch minds with " + antagonist();
	if (Num == 9)
	   OutString += " take control of the ship"
	if (Num == 10)
	   OutString += " speak in a digitally altered voice";
	if (Num == 11)
	   OutString += " activate the autodestruct";
	if (Num == 12)
	   OutString += " behave mysteriously";
	if (Num == 13)
	   OutString += " evolve into " + miscalien();
	if (Num == 14)
	   OutString += " change the past";
	if (Num == 15)
	   OutString += " betray the crew";
	if (Num == 16)
	   OutString += " fall in love with "+weirdperson();
	   
	return OutString;
}


function action1()
{
         var OutString;
	var Num = randomNumber (1,19);
        if (Num == 1)
	   OutString = " is trapped in a cheap set by " + antagonist();
        if (Num == 2)
	   OutString = " is flung forward in time by " + antagonist();
        if (Num == 3)
	   OutString = " has a transporter accident and " + result();
        if (Num == 4)
	   OutString = " mysteriously " + result();
        if (Num == 5)
	   OutString = " makes contact with " + antagonist() + ", who " + action1();
        if (Num == 6)
           OutString = " investigates" + thing()+ ", which " + action1();
        if (Num == 7)
           OutString = " is attacked by " + antagonist();
        if (Num == 8)
           OutString = " violates local customs and is taken prisoner by " + miscalien();
	if (Num == 9)
	   OutString = " rescues " + antagonist() + " from " + thing() + ", who then " + result();
	if (Num == 10)
	   OutString = " is flung backward in time by " + antagonist();
	if (Num == 11)
	   OutString = " notices the strange behavior of " + antagonist();
	if (Num == 12)
	   OutString = " is marooned with " + antagonist();
	if (Num == 13)
	   OutString = " is bathed in exotic energy by " + thing() + " and " + result();
	if (Num == 14)
	   OutString = " discovers " + thing() + ", which is not what it seems";
	if (Num == 15)
	   OutString = " is possessed by " + miscalien() + ", who desires " + thing(); 
	if (Num == 16)
	   OutString = " is flung across the galaxy by " + thing() + ", with only " + antagonist() +" for company";
	if (Num == 17)
	   OutString = " enters the holodeck, which immediately malfunctions";   
	if (Num == 18)
	   OutString = " attempts to take a vacation, but soon " + action1();   
	if (Num == 19)
	   OutString = " contracts a mysterious disease from " +thing() + " and " + result();   
	return OutString;
}		

function drama()
{
        var OutString;
	var Num = randomNumber (1,14);
        if (Num == 1)
	   OutString = "time running out";
        if (Num == 2)
	   OutString = "the clock ticking";
	if (Num == 3)
	   OutString = "the help of " +otherperson();
        if (Num == 4)
	   OutString = "tension rising";
        if (Num == 5)
	   OutString = "lots of dramatic music";
        if (Num == 6)
	   OutString = person() + " " + fate();
        if (Num == 7)
	   OutString = "nobody to turn to";
        if (Num == 8)
	   OutString = "only a hand phaser"
	if (Num == 9)
	   OutString = "only a tricorder, and a paperclip";
        if (Num == 10)
	   OutString = "frequent commercial breaks";
        if (Num == 11)
	   OutString = antagonist() + " out for revenge";
	if (Num == 12)
	   OutString = "an ethical dilemma to solve";
	if (Num == 13)
	   OutString = shipsystem() + " malfunctioning";
	if (Num == 14)
	   OutString = "phasers blasting";
	return OutString;
}
	

function goal()
{
        var OutString;
	var Num = randomNumber (1,10);
        if (Num == 1)
	   OutString = "convince the others";
        if (Num == 2)
	   OutString = "prove the innocense of " + person();
	if (Num == 3)
	   OutString = "find a peaceful solution";
        if (Num == 4)
	   OutString = "make a difficult choice";
        if (Num == 5)
	   OutString = "participate in a test contrived by " + antagonist();
        if (Num == 6)
	   OutString = "prevent a war";
        if (Num == 7)
	   OutString = "avoid capture by " + antagonist();
        if (Num == 8)
	   OutString = "tell a story in flashback";
        if (Num == 9)
	   OutString = "discover what really happened";
        if (Num == 10)
	   OutString = "ask " + antagonist() + " for help";
	return OutString;
}	

function fate()
{
        var OutString;
	var Num = randomNumber (1,12);
        if (Num == 1)
	   OutString = "missing";
        if (Num == 2)
	   OutString = "under mental control of " + antagonist();
        if (Num == 3)
	   OutString = "full of Borg implants";
        if (Num == 4)
	   OutString = "horribly mutated";
        if (Num == 5)
	   OutString = "transformed into " + miscalien();
        if (Num == 6)
	   OutString = "nonexistant due to altered history";
        if (Num == 7)
	   OutString = "fallen in love";
        if (Num == 8)
	   OutString = "sentenced to death";
        if (Num == 9)
	   OutString = "on vacation";
        if (Num == 10)
	   OutString = "obsessed with " + thing();
	if (Num == 11)
	   OutString = "paralyzed by guilt";
	if (Num == 12)
	   OutString = "conscripted into the army of " + villain();
	return OutString;
}	

function action2()
{
	var OutString;
	var Num = randomNumber (1,14);
        if (Num == 1)
	   OutString = " discovers that an assassin has killed " + antagonist();
        if (Num == 2)
	   OutString = " is fatally wounded";
        if (Num == 3)
	   OutString = " stands too close to an exploding console";
        if (Num == 4)
	   OutString = " discovers that " + antagonist() + " is not who he seems";
        if (Num == 5)
	   OutString = " disappoints the Captain";
        if (Num == 6)
           OutString = " cannot prevent war between " + miscalien() + " and " +miscalien();
        if (Num == 7)
           OutString = " is trapped in " + thing();
        if (Num == 8)
           OutString = " learns that " +shipsystem() + " has gone berserk";
	if (Num == 9)
	   OutString = " is paralyzed by Federation ethics";
	if (Num == 10)
	   OutString = " has to help Geordi find his VISOR";
	if (Num == 11)
	   OutString = " is involved in a continuity error";
	if (Num == 12)
	   OutString = " has to disarm the autodestruct"; 
	if (Num == 13)
	   OutString = result();
	if (Num == 14)
	   OutString = " enters the holodeck, which immediately malfunctions";   
	return OutString;
}		

function shipsystem()
{
        var ThisArray = new Array ("the main computer","the transporter","the deflector array",
	"the replicator","Data's brain","Geordi's VISOR","Deanna's telepathic power",
	"the phaser array","the warp core","the life support system","the sensor array",
	"the holodeck","the Doctor's mobile emitter","one of Seven of Nine's borg implants",
	"Quark's bar","the shields","the warp drive","the impulse engines","a CGI effect");
	//"the Random Technobabble Generator");
	return ThisArray[randomNumber(0,ThisArray.length-1)];
}

function action3()
{
	var OutString;
	var Num = randomNumber (1,15);
        if (Num == 1)
	   OutString = " makes a speech about " + concept();
        if (Num == 2)
	   OutString = " reconfigures " + shipsystem() + " to emit (energy)";
        if (Num == 3)
	   OutString = " reveals that the enire episode has been a holodeck fantasy";
        if (Num == 4)
	   OutString = " realizes the entire situation has been another of Q's pranks";
        if (Num == 5)
	   OutString = " travels back in time, preventing the episode";
        if (Num == 6)
           OutString = " travels back in time, preventing the whole season";
        if (Num == 7)
           OutString = " travels back in time, preventing the entire series";
        if (Num == 8)
           OutString = " is denied what he wants most";
	if (Num == 9)
	   OutString = " breaks unknown encryption effortlessly";
	if (Num == 10)
	   OutString = " deciphers alien writing effortlessly";
	if (Num == 11)
	   OutString = " is beamed away from an exploding vessel";
	if (Num == 12)
	   OutString = " discovers that the true problem is not " + thing() + ", but " +villain();
	if (Num == 13)
	   OutString = " talks a computer to death";
	if (Num == 14)
	   OutString = " fills the technobabble quota";   
	if (Num == 15)
	   OutString = " makes a difficult choice";   
	
	return OutString;
}		

function busy()
{
	var OutString;
	var Num = randomNumber (1,14);
        if (Num == 1)
	   OutString = ", who has been dead since the beginning of the episode, is revived by " + person();
        if (Num == 2)
	   OutString = " learns the value of " + concept();
	if (Num == 3)
	   OutString = " has a birthday";   
	if (Num == 4)
	   OutString = " meets " + otherperson() + "'s parents";
	if (Num == 5)
	   OutString = " is nowhere to be seen, and nobody seems to notice";
        if (Num == 6)
	   OutString = "takes a holodeck vacation";
        if (Num == 7)
	   OutString = "befreinds " + miscalien();
        if (Num == 8)
	   OutString = "finds, loses, and never again mentions a great love";
         if (Num == 9)
	   OutString = "attends a peace conference";
         if (Num == 10)
	   OutString = "stands in the background and pushes buttons";
         if (Num == 11)
	   OutString = "performs an ancient ritual";
         if (Num == 12)
	   OutString = "writes a log entry";
         if (Num == 13)
	   OutString = "writes a letter to " + otherperson();
 	 if (Num == 14)
	   OutString = "is " + fate();
 	   
	return OutString;
}		


function punctuate()
{
	var OutString;
	var Num = randomNumber (1,10)
	if (Num < 4)
		OutString = "! ";
	if (Num > 3)
		OutString = ". ";
	return OutString;
}

function introduction()
{
	var OutString = "The episode begins when ";
	OutString += person();
	OutString += action1();
	OutString += punctuate();
	return OutString;
}

function risingaction()
{
	var OutString = "Now, with ";
	OutString += drama();
	OutString += ", ";
	OutString += person();
	OutString += " must ";
	OutString += goal();
	OutString += punctuate();
	return OutString;

}

function complication()
{
	var OutString = "Things look hopeless when ";
	OutString += person();
	OutString += action2();
	OutString += punctuate();
	return OutString;

}

function solution()
{
	var OutString = "Everything is solved when ";
	OutString += person();
	OutString += action3();
	OutString += punctuate();
	return OutString;

}

function meanwhile()
{
	var OutString = "Meanwhile, ";
	OutString += person();
	OutString += " ";
	OutString += busy();
	OutString += punctuate();
	return OutString;

}
	
	
function episode()
{
	var OutString = "";
	OutString += introduction();
	OutString += risingaction();
	OutString += complication();
	OutString += solution();
	OutString += meanwhile();
	return OutString;
}

//var OutString;
//OutString = episode();
//document.write (OutString);
document.write (episode());

//  Done hiding  -->
