
function storytest() {

if (character.value=='') alert("Please enter the name of your character");

if (character.value!='') story(character.value,sex.options.selectedIndex);

}

function story(char,charsex) {

var his="his"

var him="him"

var he="he"

var He="He"

var girl="girl"

var son="son";

if (charsex=="1") {

son="daughter";

his="her";

he="she";

He="She";

girl="guy";

him="her";

}

var index;

var tmpStr;

var tmpChar;

var preString;

var postString;

var strlen;

tmpStr = char.toLowerCase();

strLen = tmpStr.length;

if (strLen > 0)  {

for (index = 0; index < strLen; index++)  {

if (index == 0)  {

tmpChar = tmpStr.substring(0,1).toUpperCase();

postString = tmpStr.substring(1,strLen);

tmpStr = tmpChar + postString;

}else{

tmpChar = tmpStr.substring(index, index+1);

if (tmpChar == " " && index < (strLen-1))  {

tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();

preString = tmpStr.substring(0, index+1);

postString = tmpStr.substring(index+2,strLen);

tmpStr = preString + tmpChar + postString;

}}}

char=tmpStr;

heading.innerHTML="<b><big>The Little Story Of "+char+"</big></b>";



var country=Math.round(Math.random()*20);

var country2=Math.round(Math.random()*20);

var countryarray=new Array("South Africa,","China,","Bali,","Canada,","Brazil,","France,","Italy,","Germany,","Russia,","Tokalue,","Scotland,","England,","Ireland,","Greenland,","Iceland,","Israel,","Japan,","Peru,","Egypt,","Mexico,","Java,","Scandinavia,");


var burns=Math.round(Math.random()*2);

var burnarray=new Array("1st","2nd","3rd");

var cost=Math.round(Math.random()*5);

var costarray=new Array("$10 000","$45 000","$120 000","$3","$750 000");

var years=Math.round(Math.random()*44)+3;

var part0=Math.round(Math.random()*9)

var part1=Math.round(Math.random()*12)

var part2=Math.round(Math.random()*12)

var part3=Math.round(Math.random()*9)

var part4=Math.round(Math.random()*9)

var part5=Math.round(Math.random()*9)

var part6=Math.round(Math.random()*11)

var part7=Math.round(Math.random()*9)

var part8=Math.round(Math.random()*9)

var part9=Math.round(Math.random()*9)

var part0array=new Array(" slept in all day with"," was owed money by"," fought "+his+" enemy:"," traveled with"," saw a movie made by"," got a letter bomb from"," discovered"," went swimming with"," was friends with"," almost got marooned by");

var part1array=new Array(" the T3"," Homer Simpson"," "+his+" mummmy"," a baby boy"," an ox wanderer"," a wild dog"," a man in a wheelchair"," Tweety Bird"," a sexy model"," Santa Claus"," Herman Munster's mum"," Mr Greenjeans"," Capt Kangaroo");

var part2array=new Array(" under the bed,"," on an ironing board,"," in the fire place,"," in "+countryarray[country]," in "+countryarray[country]," in "+countryarray[country]," after leaping from a crashing plane,"," after winning the lottery,"," in an icy cave,"," on a passenger jet,"," on a pirate ship,"," down behind Boones Creek High");

var part3array=new Array(" during an important business meeting,"," got "+burnarray[burns]+" degree burns,"," fell into the eternal pit of scum,"," got banished from the country,"," almost got killed by an army of birdbrains,"," got locked in prison,"," during a hail storm,"," went around killing bats with a jackhammer,"," during the world war III,"," got locked in a room full of greasy meatballs,");

var part4array=new Array(" because "+he+" had no sleep the night before"," for no reason at all"," because "+he+" felt like it"," very happily"," in a sad mood"," because "+his+" leg hurt"," because "+his+" heart fluttered"," but it was all an accident"," feeling very foolish"," on purpose"," then stormed out");

var part5array=new Array(" and snapped "+his+" ankle"," and all Gone To Plaid broke loose"," and a heated argument arose"," and went for a long walk through the park."," and banged "+his+" head on a wall"," and decided to sleep it off"," and everyone felt very sympathetic"," and fell violently hurlish."," and chased a bunny"," and went on a ravioli rampage");

var part6array=new Array(" which caused a public outcry."," which completely freaked "+him+" out."," which got "+him+" in a lot of trouble."," which made "+him+" cry."," which caused an avalanche."," So everyone bowed down to "+char+"."," which upset everybody."," which started a party.",". "+char+" just dodged three bullets.",". Then "+char+" ran around like a lunatic.",". "+char+" then escaped through a secret passage."," "+char+" then met "+his+" long lost "+son+": "+char+" the second.");

var part7array=new Array(" "+He+" grabbed the detonator"," "+He+" stole a car "," "+He+" blew up a truck with a hand grenade"," "+He+" felt a sudden ray of hope"," "+He+" made a run for it"," "+He+" jumped out of the way as the roof collapsed"," "+He+" went around killing rats with plastic bombs"," "+He+" shot all the bad guys"," "+He+" made a giant leap across the ravine"," "+He+" called the police!");

var part8array=new Array(" which defies what that crazy fortune teller told "+him+"."," as if it were a miracle."," to the disappointment of some."," while wearing "+his+" lucky backpack."," with relative ease."," just as "+he+" hoped."," to the surprise of the audience."," as "+he+" nearly gave up all hope."," with the help of "+costarray[cost]+" worth of special effects."," with "+his+" last ounce of strength.");

var part9array=new Array(" "+He+" got promoted to field marshal."," "+He+" killed the bad guy and made it away with minimal injuries."," "+He+" got kidnapped and tortured to death."," "+He+" got caught by the police and was sentenced to "+years+" years in prison."," "+He+" got the money and lived the rest of "+his+" life in "+countryarray[country2]," "+He+" failed the mission and the bad guys made it away with the gold."," "+He+" accidently tripped and smashed "+his+" face against a rock."," "+He+" defeated "+his+" enemy and the world was safe again... but for how long?"," "+He+"  narrowly escaped and hitch-hiked all the way home."," "+He+" got the "+girl+", the treasure and a nasty rash between the toes."," "+He+" got the "+girl+", the treasure and a nasty rash in the armpit.");


storyarea.innerHTML=char+part0array[part0]+part1array[part1]+part2array[part2]+part3array[part3]+part4array[part4]+part5array[part5]+part6array[part6]+part7array[part7]+part8array[part8]+part9array[part9];

}

}

