var story=""

function CkNme(XNme)  {
  var UcNme = XNme.toUpperCase()
  var LcNme = XNme.toLowerCase()
  
  if (XNme==UcNme || XNme==LcNme){
  XNme = LcNme;
  XNme = XNme.charAt(0).toUpperCase() + XNme.substring(1,15);
  }  
 return XNme;
 }

function compute(fern)  {
friend1=fern.friend1.value;
friend2=fern.friend2.value;

 if  (fern.gender.value == "Male"){
  var boyGirl = "boy"
  var heShe = "he"
  var heSheCap = "He"
  var hisHer = "his"
  var hisHerCap = "His"
  var himHer = "him"
  var himherSelf = "himself"  
  var opheSheCap = "She"
  var ophisHer = "her"
  var pal1 = friend1
  var pal2 = friend2
  } 
  else {
  var boyGirl = "girl"
   var heShe = "she"
   var heSheCap = "She"
   var hisHer = "her"
   var hisHerCap = "Her"
   var himHer = "her"
   var himherSelf = "herself"
   var opheSheCap = "He"
   var ophisHer = "his"
   var pal1 = friend2;
   var pal2 = friend1;
 }

var firstNme = fern.firstNme.value;
  firstNme = CkNme(firstNme);
var lastNme = fern.lastNme.value;
  lastNme = CkNme(lastNme);
var firstNmeCap = firstNme.toUpperCase();
var lastNmeCap = lastNme.toUpperCase();

var  school=fern.school.value;
var age = fern.age.value;
var hunt = fern.hunt.value;
var broken = fern.broken.value;
var sport= fern.sport.value;


// arrrays:

var schword1 = new Array("made a funny picture","made up a song","did lots of math papers","read a big book","spelled big words","colored lots of pictures")
var schword2 = new Array("make funny pictures for them","make up songs for them","help them do math","help them read big books","help them spell big words","color pictures with them")
var schword3 = new Array("make funny pictures","make up songs","do lots of math","read big books","spell big words","color pictures")
var schword4 = new Array("make this picture","sing this song","do this math paper","read this book","spell this word","color this picture")

var x = fern.school.selectedIndex
   var sch1 = schword1[x]
   var sch2 = schword2[x]
   var sch3 = schword3[x]
   var sch4 = schword4[x]
var notice="<h3>You have a good story, "+firstNme+". But, you can do more. Find some colors and make a picture of your story. Then read it to your family. Then read it to a friend. They will like it, too.</h3>";

var sportword1 = new Array("ran","jumped","hopped","skipped","swam")
var sportword2 = new Array("runner","jumper","hopper","skipper","swimmer")

var x = fern.sport.selectedIndex
   var sport1 = sportword1[x]
   var sport2 = sportword2[x]
//***
var story = ("<html><HEAD><TITLE> "+firstNme+", the Can-Do Kid</TITLE> <LINK REL=stylesheet Type='text/css' HREF='SansTxt.css'></HEAD>");

story = (story +"<BODY text='#000000' BGCOLOR = '#6699FF'><Font size='+2'>");
story = (story +"<h1 align='center'>"+firstNme+", the Can-Do Kid" );
story = (story +"<br><sup>by " + firstNme + " " + lastNme + "</sup></h1><P>");

story = (story +"<P>"+firstNme+" was a happy "+boyGirl+". "+heSheCap+" was "+age+". And, "+heShe+" was good at many things.");

story = (story +"<P>At home, "+firstNme+" helped "+hisHer+" family. "+heSheCap+" put away "+hisHer+" toys. "+heSheCap+" put away "+hisHer+" books. "+heSheCap+" picked up "+hisHer+" papers. "+heSheCap+" never  forgot. They did not have to ask.");

story = (story +"<P>"+firstNme+" was also good at finding "+hunt+"s. On a walk, "+heShe+" was first to spot one. On a trip, "+heShe+" was first. "+hisHerCap+" family said "+heShe+" was their best "+hunt+" finder.");

 story = (story +"<P>\"My family loves me,\" "+heShe+" said. \"They call me the Can-Do Kid.\"");

 story = (story +"<P>One day "+firstNme+" fixed "+hisHer+" "+broken+". A friend asked, \"Will you fix my "+broken+", too?\""); 

 story = (story +"<P>"+firstNme+" did a good job! "+hisHerCap+" friend said, \"You are the best "+broken+" fixer I know.\""); 

story = (story +"<P>At school, "+firstNme+" helped "+hisHer+" class. "+heSheCap+" put away "+hisHer+" books. "+heSheCap+" put away "+hisHer+" papers. "+heSheCap+" picked up "+hisHer+" crayons. "+heSheCap+" never forgot. ");

 story = (story +"<P>One day "+firstNme+" "+sch1+". The children loved what "+heShe+" did. They asked "+himHer+" to "+sch2+".");
 
 story = (story +"<P>They said, \"You are the best "+school+". You are the Can-Do Kid.\""); 

 story = (story +"<P>"+firstNme+" was also good at "+sport+". "+heSheCap+" "+sport1+" fast. "+heSheCap+" was first in every race. The kids said "+heShe+" was their best "+sport2+".");
 
story = (story +"<P>"+firstNme+" "+lastNme+" was a happy "+boyGirl+"!");

story = (story +"<P>Then "+pal2+" came to live on "+hisHer+" street. "+opheSheCap+" was "+age+". "+opheSheCap+" liked to fix "+broken+"s. "+opheSheCap+" liked to find "+hunt+"s. "+opheSheCap+" was good at many things.");

story = (story +"<P>"+pal2+" wanted to be "+firstNme+"’s friend. But, "+firstNme+" did not want to be "+pal2+"’s friend.");

 story = (story +"<P>Then "+pal1+" came to "+hisHer+" class. "+heSheCap+" was "+age+". "+heSheCap+" liked to "+sch3+". "+heSheCap+" "+sport1+" fast. "+heSheCap+" was first in some of the races. "+pal1+" was good at many things.");  

 story = (story +"<P>"+pal1+" wanted to be "+firstNme+"’s friend. But, "+firstNme+" did not want to be "+pal1+"’s friend. "+firstNme+" was hurt and mad.");

story = (story +"<P>"+heSheCap+" said to "+hisHer+" family, \"Do NOT call ME the Can-Do Kid! I am not the best "+hunt+" finder. I am not the best "+broken+" fixer. I am not the best "+school+". I am not the best "+sport2+". I can not be the Can-Do Kid.\"");

story = (story +"<P>"+firstNme+"’s family said, \"We love you. You are a Can-Do Kid for us.\"");

story = (story +"<P>But, "+firstNme+" felt bad. "+heSheCap+" was still a little mad.");

story = (story +"<P>Then one day "+pal2+" came to see "+himHer+". "+opheSheCap+" said, \"I can not fix my "+broken+". Will you help me?\"");

story = (story +"<P>The two of them looked at it. They fixed "+ophisHer+" "+broken+". They had fun. \"We are Can-Do Kids!\" they said.");

story = (story +"<P>One day in class, "+firstNme+" was sad. "+heSheCap+" said to "+pal1+", \"I am not happy. I can not "+sch4+". Will you help me?\"");

story = (story +"<P>The two of them did a good job. They had fun. Then they went out and played. \"We are Can-Do Kids!\" they said.");

story = (story +"<P>"+firstNme+" was happy. Some of the time "+heShe+" was not first. Some of the time "+heShe+" was not best. That was O.K. It was fun to be ONE of the Can-Do Friends.");

story = (story +"<P>The Can-Do Friends were good at doing many things!");

story+=notice;
story=(story+"<br><br></font><font color='blue' size='-4'>&copy;2004 Kay Wittes</font>"); 
msgWindow=window.open("","displayWindow","toolbar=yes,width=640,height=400,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=yes")
msgWindow.document.write(story)
msgWindow.focus()
msgWindow.document.close()
}
