//This sets the term start date for getAgeTerm
var showtermdate="January 8, 2008";

//StuForm - opening student information data confirmation
//prompt if no name given and fill in RegForm

function StuForm(formname) {
    if (formname.Stu_First.value=="") {
      alert("Please put in a first name.");
      formname.Stu_First.focus();
      return false;
    }
    else StuName=formname.Stu_First.value;

    Stu_Birth_Month=formname.Month.selectedIndex+1;
    Stu_Birth_Day=formname.Day.selectedIndex+1;
    Stu_Birth_Year=2008-formname.Year.selectedIndex;

//Get the birthday if it's still Jan 1 of current year

    if (Stu_Birth_Month==1 && Stu_Birth_Day==1 && Stu_Birth_Year==2008) {
      alert("Please select " +StuName+ "'s birthday.");
      return false;
    }

//get the gender if not given

    var GenderChosen=false;
    for (counter=0; counter<formname.Stu_Gender.length; counter++) {
      if (formname.Stu_Gender[counter].checked) GenderChosen=true;
      }
    if (!GenderChosen) {
      alert("Please indicate if " +StuName+ " is a boy (M) or a girl (F)");
      return false;
    }

//get the student status if not given

    var StatusChosen=false;
    for (counter=0; counter<3; counter++) {
     if (formname.status[counter].checked) StatusChosen=true;
    }
    if (!StatusChosen) {
       alert("Please indicate if "+StuName+" is a current, former or new student.");
       return false;
    }

//Fill the values into RegForm

//transfer StuName

    if (StuName !="") document.RegForm.StuName.value= StuName;

//transfer gender

     if (formname.Stu_Gender[0].checked) {
      male=false;
      document.RegForm.sex[0].checked=true;
      document.RegForm.sex[1].checked=false;
     }
     else {
      male=true;
      document.RegForm.sex[1].checked=true;
      document.RegForm.sex[0].checked=false;
     }

//transfer birthday and add ager

        if (Stu_Birth_Month < 10) Stu_Birth_Month="0"+Stu_Birth_Month;
        if (Stu_Birth_Day < 10) Stu_Birth_Day="0"+Stu_Birth_Day;
        // getAge(dateString,dateType) //type 3 : 29/05/1997
        getAge("today",Stu_Birth_Day+"/"+Stu_Birth_Month+"/"+Stu_Birth_Year,3);
        //getAge (below) returns ageline for age today
        nowline = StuName+'\'s age is '+ageline;
        //getAgeTerm returns ageline with the age on the first day of the term
        getAge(showtermdate,Stu_Birth_Day + "/" + Stu_Birth_Month + "/" + Stu_Birth_Year,3);
        var termline = " At the start of the term, "+showtermdate+", <BR>"
        if (male) termline += "he";
        else termline += "she";
        termline +=" will be "+ ageline;

        birthday = MonthArray[Stu_Birth_Month-1]+" "+Stu_Birth_Day+", "+Stu_Birth_Year;

        document.RegForm.Month.selectedIndex=formname.Month.selectedIndex;
        document.RegForm.Day.selectedIndex=formname.Day.selectedIndex;
        document.RegForm.Year.selectedIndex=formname.Year.selectedIndex;

        document.RegForm.BirthDay.value= birthday;

        document.RegForm.Age.value= ager;
        document.RegForm.TodaysDate.value=writeToday;

//transfer gender

     if (formname.Stu_Gender[0].checked) {
      male=false;
      document.RegForm.sex[0].checked=true;
      document.RegForm.sex[1].checked=false;
     }
     else {
      male=true;
      document.RegForm.sex[1].checked=true;
      document.RegForm.sex[0].checked=false;
     }

//transfer student status

        if (formname.status[0].checked) {
          document.RegForm.status[0].checked=true;}
        if (formname.status[1].checked) {
          document.RegForm.status[1].checked=true;}
        if (formname.status[2].checked) {
          document.RegForm.status[2].checked=true;}

//search for appropriate classes for age in months
        //Age in months returned from getAge as 'StuMonths'
        Find_By_Months(StuMonths);

//display classlist
        //foundclass is string of found classes
        //foundcount is number of found classes
        //returned by Find_By_Months
        if (foundcount==1) {
          classline1="Here is our class for "+StuName+":";
        }
        else  classline1 = "Here are our classes for "+StuName+":";
        if (male) colorline="<FONT COLOR=darkmagenta>";
        else colorline="<FONT COLOR=darkblue>";

        classline2 = foundclass
        classline = classline1+"<BR>"+colorline+classline2;
        AgeWindow(StuName,birthday,male,nowline,termline, classline);

        Class_Name=class1
        alias="Contents"

        //is "Village" a substring of Class_Name? then make the link'
        where = Class_Name.indexOf("Village")
        if (where>=0) alias="Village"
        where = Class_Name.indexOf("Our Time")
        if (where>=0) alias="OurTime"
        where = Class_Name.indexOf("Imagine")
        if (where>=0) alias="Imagine"
        where = Class_Name.indexOf("Young Child")
        if (where>=0) alias="Young"
        where = Class_Name.indexOf("Movement")
        if (where>=0) alias="Movement"
        where = Class_Name.indexOf("Drama")
        if (where>=0) alias="Drama"
        where = Class_Name.indexOf("Voice")
        if (where>=0) alias="Voice"
        where = Class_Name.indexOf("Theatre")
        if (where>=0) alias="Theatre"
        where = Class_Name.indexOf("garten")
        if (where>=0) alias="Garten"
        where = Class_Name.indexOf("Adventures 1")
        if (where>=0) alias="Adventures1"
        where = Class_Name.indexOf("Adventures 2")
        if (where>=0) alias="Adventures2"
        where = Class_Name.indexOf("Adventures - 1")
        if (where>=0) alias="Imagine"
        where = Class_Name.indexOf("Adventures - 2")
        if (where>=0) alias="Young"
        where = Class_Name.indexOf("Adventures - Zoo Train")
        if (where>=0) alias="OurTime"
        where = Class_Name.indexOf("Summer Arts")
        if (where>=0) alias="SAE"
        where = Class_Name.indexOf("Acting")
        if (where>=0) alias="Acting"

//jumps main screen to top class found

        gotolink = "#"+alias
        window.location.href=gotolink;

}


function Find_By_Months(stumonths) {
   var items_found=0;
   for (i=0;i<rowsdb;i++) {
      if (stumonths >= celldb[i][5] && stumonths <= celldb[i][6]) {
         Class_Name=celldb[i][2];
         items_found++;
        }
   }
   //initialize appropriate classes GoodClass database to all blanks
   var GoodClass=new Array(items_found);
   for (i=0; i<items_found; i++) GoodClass[i]=" ";

   var j=0; var xClass="X"; foundc=0; var first_in_list=""
   for (i=0;i<rowsdb;i++) {
      if (stumonths >= celldb[i][5] && stumonths <= celldb[i][6]) {
         Class_Name=celldb[i][2];
         if (Class_Name!=xClass) {
            if (j==0) first_in_list=Class_Name;
            GoodClass[j]=Class_Name;
            xClass=Class_Name
            j++
            foundc++
         }
      }
   }
   ClassList="";
   for (i=0; i<foundc; i++) {
      ClassList += "<BR>"+GoodClass[i];
      }
   foundcount=foundc;
   foundclass=ClassList;
   class1=first_in_list
   return(class1,foundclass,foundcount);
}



//pop-up window (AgeWindow) with age, class info
function AgeWindow(StuName,birthday,male,nowline,termline, classline) {
   mywindow=window.open("","help","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=400,height=300,screenX=400,screenY=100");
   mywindow.document.write("<HTML><HEAD>");
   mywindow.document.write("<TITLE>"+StuName+" - "+birthday+"</TITLE>");
   mywindow.document.write("</HEAD><BODY BGCOLOR=linen TEXT=black link=darkgreen>");
   mywindow.document.write("<IMG SRC='menehu.gif' HEIGHT=82 WIDTH=52 BORDER=0 ALIGN=LEFT>");

   if (!male) mywindow.document.write("<FONT COLOR=darkmagenta>");
   else mywindow.document.write("<FONT COLOR=darkblue>");
   mywindow.document.write("<CENTER><H2><I>" + StuName+"</I></H2>");
   mywindow.document.write("<B>" + nowline);
   if (!male) mywindow.document.write("<FONT COLOR=darkblue>");
   else mywindow.document.write("<FONT COLOR=darkmagenta>");
   mywindow.document.write("<P>"+termline);
   if (!male) mywindow.document.write("<FONT COLOR=darkmagenta>");
   else mywindow.document.write("<FONT COLOR=darkblue>");
   mywindow.document.write("<P>"+classline);

   mywindow.document.write("<FORM><INPUT TYPE='button' VALUE='OK'");
   mywindow.document.write("onClick='window.close()'></FORM>");
   mywindow.document.write("</CENTER>");
   mywindow.document.write("</BODY></HTML>");
   mywindow.document.close();
}



//create regist array [database] to store selected classes - max 3
//initialize "regist" registration database to all blanks
var regrows=3 // max number of classes to register = 3
var regcols=3 // 1st, 2nd, 3rd choices
var regist=new Array(regrows);
for (i=0; i<=regrows; i++) { regist[i]=new Array(regcols)
   for (j=0; j<=regcols; j++) { regist[i][j]=" "}
 }


//function StoreC()
function StoreC(code,ch1,ch2,ch3) {
regist[0][0]=ch1; regist[0][1]=ch2; regist[0][2]=ch3;
}


//initialize radio click button variable to null
//initialize temporary variables to store radio button clicks'
var choice1 = "";
var choice2 = "";
var choice3 = "";


//function StoreChoice()
//make sure the existing temp variables are for the same class,
//delete those which arent, and store the new choice to the temp variable
function StoreChoice(course,choicenum) {
  checker=course.substring(0,2)
  if (choice1.length > 1 && choice1.substring(0,2) != checker) choice1=" "
  if (choice2.length > 1 && choice2.substring(0,2) != checker) choice2=" "
  if (choice3.length > 1 && choice3.substring(0,2) != checker) choice3=" "
  if (choicenum==1) choice1 = course;
  if (choicenum==2) choice2 = course;
  if (choicenum==3) choice3 = course;
}


//function ShowChoices() confirmation of registration screen
//Clicking Register Button results in this confirmation screen
//
function ShowChoices(code,ch1,ch2,ch3) {
   var recheck = false
   if (ch1=="" || ch2=="" || ch3=="") {
    alert("You need to select classes");

      for (i=0; i<10; i++) {
         temp = regist[i][0]
         temp = temp.substring(0,2)
         temp = temp.toLowerCase();
         if (temp==code) {
          ch1=regist[i][0];
          ch2=regist[i][1];
          ch3=regist[i][2];
          recheck = true
          break;
         }
      }
      if (temp != code) {
         alert("Please choose 3 sections and click Register "+code);
         return false;
      }
   }

   if (ch1==ch2 || ch1==ch3 || ch2==ch3) {
    alert("Please choose 3 different sections and click Register");
    return false;
   }

   var TeacherName1 = " ";
   var TeacherName2 = " ";
   var TeacherName3 = " ";
   var ClassName1 = " ";
   var ClassName2 = " ";
   var ClassName3 = " ";
   var ClassTime1 = " ";
   var ClassTime2 = " ";
   var ClassTime3 = " ";

   first_choice=ch1;
   second_choice=ch2;
   third_choice=ch3;

   if (first_choice != " ") {
      search_db3(first_choice);
      TeacherName1=Teacher_Name;
      ClassName1=Class_Name;
      ClassTime1=Class_Time;
      tuition1=Tuition;
      materials1=Materials;
      total_fee=parseInt(tuition1)+parseInt(materials1);
      if (document.RegForm.status[2].checked==true) {total_fee=total_fee+10;}
      document.RegForm.Amount.value=total_fee;

   }

   if (second_choice == "X") {
      TeacherName2="";
      ClassName2="";
      ClassTime2="";
   }
   else {
      search_db3(second_choice);
      TeacherName2=Teacher_Name;
      ClassName2=Class_Name;
      ClassTime2=Class_Time;
   }

   if (third_choice == "x") {
      TeacherName3="";
      ClassName3="";
      ClassTime3="";
   }
   else {
      if (third_choice != " ") {
         search_db3(third_choice);
         TeacherName3=Teacher_Name;
         ClassName3=Class_Name;
         ClassTime3=Class_Time;
      }
   }

//registration screen pop-up window

   mywindow=window.open("","help","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=450,height=230,screenX=400,screenY=100");
   mywindow.document.write("<HTML><HEAD>");
   mywindow.document.write("<TITLE>Class Registration</TITLE>");
   mywindow.document.write("<SCRIPT>function go() { opener.location.href='#RegForm'; window.close() }</SCRIPT></HEAD><BODY BGCOLOR=linen TEXT=black link=darkgreen>");

   mywindow.document.write("<IMG SRC='menehu.gif' HEIGHT=82 WIDTH=52 BORDER=0 ALIGN=LEFT>");

   mywindow.document.write("<CENTER><B><FONT SIZE=+1>" + ClassName1 + "</FONT></B>");

if (second_choice != "X") {
   mywindow.document.write("<TABLE><TR>");

   mywindow.document.write("<TD>1st choice:</TD><TD>" + ClassTime1 +"</TD><TD>("+TeacherName1+")</TD></TR>");
   mywindow.document.write('<TD>2nd choice:</TD><TD>' + ClassTime2 +'</TD><TD>('+TeacherName2+')</TD></TR>');
   if (ClassTime3 != "") {
   mywindow.document.write('<TD>3rd choice:</TD><TD>' + ClassTime3 +'</TD><TD>('+TeacherName3+')</TD></TR>');
   }
   mywindow.document.write('</TABLE>');
}

else {
  mywindow.document.write("<P>"+ClassTime1+" &nbsp; "+ TeacherName1)
}

//   mywindow.document.write("//<P><FONT COLOR=darkblue>To change, ");
//   mywindow.document.write("//make new selections and click Register. ");
//   mywindow.document.write("//<BR>To cancel, Clear, then click Register. ");

   mywindow.document.write("<P><FORM><INPUT TYPE='button' VALUE='OK, input Personal Data now'");
   mywindow.document.write(" onClick='go()'>");
   mywindow.document.write(" <P><INPUT TYPE='button' VALUE='Redo selection'");
   mywindow.document.write(" onClick='window.close()'></FORM>");

   mywindow.document.write("</CENTER>");
   mywindow.document.write("</BODY></HTML>");
   mywindow.document.close();
   code=ch1.substring(0,2)
   StoreC(code,ch1,ch2,ch3);
}


//function ClearChoices()

function ClearChoices() {
   choice1="";
   choice2="";
   choice3="";
   regist[0][0] = " "
   regist[0][1] = " "
   regist[0][2] = " "
}


//EOF Clasjs2a.prg - compiled with Clasjs2b, Clasjs2c prgs to makes Classes.js
//display() function to output printable registration form
//This displays the personal data and registration data in a new window for printing

function display() {
  var DispWin = window.open('','NewWin','width=600,height=500,menubar,resizable,scrollbars');
        DispWin.document.open();

        var msex = ""
        if (document.RegForm.sex[0].checked==true) {
           male = false;
        }
        else {
           male = true;
        }

  message =  '<HTML><HEAD><TITLE>PacArts Registration</TITLE></HEAD><BODY><FONT COLOR=darkmagenta>';
  message += '<CENTER><TABLE WIDTH=80% BORDER=0 CELLPADDING=10><TR><TD>';
  message += '<CENTER><FONT COLOR=darkmagenta><H2>Pacific School of the Performing Arts</H2>';
  message += '<B>P.O. Box 240154</B> &nbsp; '
  message += ' &nbsp; <B>Honolulu, HI 96824-0154</B></FONT>'
  message += '<P>'

  message += '<H3>Registration Application - ';
  message += document.RegForm.TodaysDate.value;
  message += '</H3>';

//************************************* Top Table with Border
  message += '<P><TABLE BORDER=1 CELLPADDING=10 CELLSPACING=0><TR>';
  message += '<TD><CENTER>';

//********************************** Student Name Table (male blue female pink)
  if (male) message += '<TABLE BGCOLOR="lightcyan" ';
        else message += '<TABLE BGCOLOR="mistyrose" ';

//****************************** Student Name

        message += 'CELLPADDING=5 CELLSPACING=0 BORDER=0><TR><TD><P><B>';
        message += document.RegForm.StuName.value+"</B>";

//************************************** Sex
        if (document.RegForm.sex[0].checked==true) {
           message += " &nbsp; (F)";
        }
        else {
           message += " &nbsp; (M)";
        }

//*************************************** Age
        message += "   Age: <B>" + document.RegForm.Age.value;
        message += " &nbsp; ("+document.RegForm.BirthDay.value+")";
        if (document.RegForm.status[0].checked==true) {

//************************************* Current / Former / New
           message += " &nbsp; Current Student";
        }
        if (document.RegForm.status[1].checked==true) {
           message += " &nbsp; Former Student";
        }
        if (document.RegForm.status[2].checked==true) {
           message += " &nbsp; New Student";
        }
        message += "</TD></TR></TABLE>";
//*****************************************   End of Name Table
        // Parents Name and Address

        message += "<BR><TABLE BGCOLOR='linen' CELLPADDING=5 CELLSPACING=0 BORDER=0><TR><TD>";
        message += "<B>" + document.RegForm.ParName.value+"</B>";
        message += "<BR><B>" + document.RegForm.Add1.value+"</B>";
        message += "<BR><B>" + document.RegForm.Add2.value+"</B>";
        message += " &nbsp; <B>HI &nbsp; " + document.RegForm.ZIP.value+"</B>";

        message += "</TD><TD>";

        // Phone Numbers and e-mail in a table
        message += "<TABLE BORDER=0>";

        //home phone (required)
        message += "<TR VALIGN=BOTTOM><TD>home: &nbsp; </TD><TD><B>";
        message += document.RegForm.HomePhone.value + "</TD>";

        //work phone (optional) nothing if missing
        if (document.RegForm.WorkPhone.value.length > 0) {
           message += "<TD> &nbsp; </TD><TD>work: &nbsp; </TD><TD><B>";
           message += document.RegForm.WorkPhone.value + "</TD></TR>";
        }
        else {
        message += "<TD> &nbsp; </TD><TD> &nbsp; </TD></TR>";
        }

        //if there's either a cellphone or a pager
        if (document.RegForm.CellPhone.value.length > 0 || document.RegForm.Pager.value.length > 0) {
           if (document.RegForm.CellPhone.value.length > 0) {
              message += "<TR><TD>cellular: &nbsp; </TD><TD><B>";
              message += document.RegForm.CellPhone.value +"</TD>";
              message += "<TD> &nbsp; </TD>";
           }
           //otherwise, no cellphone, put the pager first
           else {
              message += "<TR><TD>pager: &nbsp; </TD><TD><B>";
              message += document.RegForm.Pager.value;
              message += "</TD><TD> &nbsp; </TD><TD> &nbsp; </TD></TR>";
           }

           if (document.RegForm.CellPhone.value.length > 0 && document.RegForm.Pager.value.length > 0) {
              message += "<TD>pager: &nbsp; </TD><TD><B>";
              message += document.RegForm.Pager.value + "</TD></TR>";
           }
        }
        if (document.RegForm.email.value.length > 0) {
           message += "<TR><TD>e-mail: &nbsp; </TD><TD COLSPAN=5><B>"
           message += document.RegForm.email.value +"</TD></TR>";
        }

        message += "</TABLE>";
        message += "</TD></TR></TABLE>";
        message += "</TABLE>";

        // send the selections to PrintChoices to return class details in myline
        //PrintChoices(choice1,choice2,choice3);

        PrintChoices(regist[0][0],regist[0][1],regist[0][2])

//        message += "<P>"+regist[0][0]+"-"+regist[0][1]+"-"+regist[0][2];
        message += '<P><TABLE CELLPADDING=5 CELLSPACING=0 BGCOLOR="bisque" BORDER=0>';
        message += "<TR><TD COLSPAN=3><CENTER><B>" + ClassName1 + "</B></TD></TR>";
        message += myline1;
        message += myline2;
        message += myline3;
        message += "</TABLE>"

        total_fee=materials+tuition
        message += "<P>Tuition: $"+tuition

        if (materials>0) {
          message += ", Materials: $"+materials;}
        if (document.RegForm.status[2].checked==true) {
          message += "<BR>New Student Registration Fee: $10"
          message += " // <B>Total Due: $"+(total_fee+10)+"</B>";
        }
        else message += " // <B>Total Due: $"+(total_fee)+"</B>";

        //newline provides the Holiday (no class) listing
        //message += newline1;

        message+="<P><HR NOSHADE WIDTH=300>"
        if (document.RegForm.HowHeard.value != "") {
        message+="<TABLE WIDTH=50%><TR><TD><I>"+document.RegForm.HowHeard.value+"</I></TD></TR></TABLE>"
        message+="<HR NOSHADE WIDTH=300>"
        }

//************************************** Credit Card
        if (document.RegForm.cardtype[0].checked==true || document.RegForm.cardtype[1].checked==true) {
           if (document.RegForm.CardNumber.value != "" && document.RegForm.CardNumber.value != null) {
           message+="<TABLE><TR><TD><H3>Credit Card<BR>  Information</H3></TD><TD> &nbsp; &nbsp; </TD><TD>Charge to: <B>"+document.RegForm.CardName.value
           if (document.RegForm.cardtype[0].checked==true) {cardname="VISA";}
           else cardname="MasterCard";
           message += "</B><BR>"+cardname + ": <B>"+document.RegForm.CardNumber.value+"</B> &nbsp; Exp: <B>"+document.RegForm.CardExpDate.value;
           message += "</B><P>Signature: __________________________________"
           message += "</TD></TR></TABLE>"
           }
        }

        if (window.print) {
          message +="<form>Click for the <input type=button name=print";
          message +=' value="Print" onClick="javascript:window.print()"> ';
          message += "menu. &nbsp; <INPUT TYPE=button Value='Cancel' onClick='window.close()'></form>";
          message += "(You can use the File | Print Setup menu on the menu bar)";

   }
          message += "</TD></TR></TABLE>";

//Office Use Only grid
message+='<P>'
message+='<CENTER>'
message+='<TABLE WIDTH=100% BORDER=1 CELLSPACING=0>'
message+='<TR><TH align=left COLSPAN=5><FONT SIZE=-2>FOR OFFICE USE ONLY</FONT></TH></TR>'
message+='<TR>'
message+='<TD><FONT SIZE=-2>Class</TD>'

message+='<TD ALIGN=CENTER WIDTH=20%><FONT SIZE=-2>VillagePlus</TD>'
message+='<TD ALIGN=CENTER WIDTH=20%><FONT SIZE=-2>Our Time</TD>'
message+='<TD ALIGN=CENTER WIDTH=20%><FONT SIZE=-2>Imagine That</TD>'
message+='<TD ALIGN=CENTER WIDTH=20%><FONT SIZE=-2>Young Child</TD>'
message+='</TR>'
message+='<TR>'
message+='<TD><FONT SIZE=-2>Tuition</TD>'
message+='<TD ALIGN=RIGHT><FONT SIZE=-2>175</TD>'
message+='<TD ALIGN=RIGHT><FONT SIZE=-2>160</TD>'
message+='<TD ALIGN=RIGHT><FONT SIZE=-2>200</TD>'
message+='<TD ALIGN=RIGHT><FONT SIZE=-2>210</TD>'
message+='</TR>'
message+='<TR>'
message+='<TD><FONT SIZE=-2>Materials</TD>'
message+='<TD ALIGN=RIGHT><FONT SIZE=-2>60</TD>'
message+='<TD ALIGN=RIGHT><FONT SIZE=-2>55</TD>'
message+='<TD ALIGN=RIGHT><FONT SIZE=-2>55</TD>'
message+='<TD ALIGN=RIGHT><FONT SIZE=-2>75</TD>'
message+='</TR>'
message+='<TR>'
message+='<TD><FONT SIZE=-2>Reg</TD>'
message+='<TD ALIGN=RIGHT><FONT SIZE=-2>10</TD>'
message+='<TD ALIGN=RIGHT><FONT SIZE=-2>10</TD>'
message+='<TD ALIGN=RIGHT><FONT SIZE=-2>10</TD>'
message+='<TD ALIGN=RIGHT><FONT SIZE=-2>10</TD>'
message+='</TR>'
message+='<TR>'
message+='<TD><FONT SIZE=-2>Deductions</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='</TR>'
message+='<TR>'
message+='<TD><FONT SIZE=-2>TOTAL</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='</TR>'
message+='</TABLE>'
message+='<TABLE WIDTH=100% BORDER=1 CELLSPACING=0>'
message+='<TR>'
message+='<TD COLSPAN=15>&nbsp;</TD>'
message+='</TR>'
message+='<TR>'
message+='<TD COLSPAN=2 ALIGN=CENTER><FONT SIZE=-2>Date</TD>'
message+='<TD ALIGN=CENTER><FONT SIZE=-2>Amount</TD>'
message+='<TD COLSPAN=2 ALIGN=CENTER><FONT SIZE=-2>#V/MC</TD>'
message+='<TD COLSPAN=2 ALIGN=CENTER><FONT SIZE=-2>IF</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2 ALIGN=CENTER><FONT SIZE=-2>Date</TD>'
message+='<TD ALIGN=CENTER><FONT SIZE=-2>Amount</TD>'
message+='<TD COLSPAN=2 ALIGN=CENTER><FONT SIZE=-2>#V/MC</TD>'
message+='<TD COLSPAN=2 ALIGN=CENTER><FONT SIZE=-2>IF</TD>'
message+='</TR>'
message+='<TR>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='</TR>'
message+='<TR>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='</TR>'
message+='<TR>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='</TR>'
message+='<TR>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='<TD COLSPAN=2><FONT SIZE=-2>&nbsp;</TD>'
message+='</TR>'
message+='</TABLE>'

//EOF Clasjs2b.prg - linked with Clasjs2a.prg to makes Classes.js

  message += "</P>";
        DispWin.document.write(message);
        DispWin.document.close();
        //document.write(message)
        //DispWin.document.print;
}

//needs to be global for display in display()
var ClassName1="  "
//make the lines for the display()
// PrintChoices() ************************

function PrintChoices(ch1,ch2,ch3) {
   if (ch1==" " || ch2==" " || ch3==" ") {
        alert("Please choose 3 sections and click Register");
        return false;
   }

   if (ch1==ch2 || ch1==ch3 || ch2==ch3) {
    alert("Please choose 3 different sections and click Register");
    //alert(ch1,ch2,ch3);
    return false;
   }

   var TeacherName1 = " ";
   var TeacherName2 = " ";
   var TeacherName3 = " ";
   //var ClassName1 = " ";
   var ClassName2 = " ";
   var ClassName3 = " ";
   var ClassTime1 = " ";
   var ClassTime2 = " ";
   var ClassTime3 = " ";
   var tuition1 = " ";
   var materials1 = " ";
   var StartDay1 = " ";
   var StartDay2 = " ";
   var StartDay3 = " ";
   var EndDay1 = " ";
   var EndDay2 = " ";
   var EndDay3 = " ";

   first_choice=ch1;
   second_choice=ch2;
   third_choice=ch3;

   if (first_choice != " ") {
      search_db3(first_choice);
      TeacherName1=Teacher_Name;
      ClassName1=Class_Name;
      ClassTime1=Class_Time;
      tuition1=Tuition;
      materials1=Materials;
      StartDay1= new String(Start_Day);
      EndDay1= new String(End_Day);
   }

   if (second_choice != " ") {
      search_db3(second_choice);
      TeacherName2=Teacher_Name;
      ClassName2=Class_Name;
      ClassTime2=Class_Time;
      StartDay2 = new String(Start_Day);
      EndDay2 = new String(End_Day);
   }

   if (third_choice == "x") {
      TeacherName3="";
      ClassName3="";
      ClassTime3="";
      StartDay3 = new String(Start_Day);
      EndDay3 = new String(End_Day);
   }
   else {
      if (third_choice != " ") {
         search_db3(third_choice);
         TeacherName3=Teacher_Name;
         ClassName3=Class_Name;
         ClassTime3=Class_Time;
         StartDay3 = new String(Start_Day);
         EndDay3 = new String(End_Day);
      }
   }

   total_fee=parseInt(tuition1)+parseInt(materials1);

   tuition=parseInt(tuition1);
   materials=parseInt(materials1);

   if (second_choice!= "X") {

     myline1="<TR><TD>1st choice:</TD><TD>" + ClassTime1 +"</TD><TD>("+TeacherName1+")</TD></TR>";
     myline2="<TR><TD>2nd choice:</TD><TD>" + ClassTime2 +"</TD><TD>("+TeacherName2+")</TD></TR>";

     if (third_choice!= "x") {
     myline3="<TR><TD>3rd choice:</TD><TD>" + ClassTime3 +"</TD><TD>("+TeacherName3+ ")</TD></TR>";
     }
     else {
     myline3="";
     }

}

   else {
     myline1="<TR><TD>" + ClassTime1 +"</TD><TD>("+TeacherName1+")</TD></TR>";
     myline2=""; myline3="";
     }

     class_day1=ClassTime1.substring(0,3);
     class_day2=ClassTime2.substring(0,3);
     class_day3=ClassTime3.substring(0,3);

     newline1 = "<P><B>1st choice ("+class_day1+") starts: "+StartDay1+", ends: "+EndDay1+". </B>";

     if (ClassName1.substring(0,6)=="Kinder") kinder="T";
     else kinder="F";

     return ClassName1,tuition,materials,myline1,myline2,myline3,newline1;
}

// This script (below) is based on a script written by M. Silvestri: <http://www.wowarea.com>

// variables
var items_found=0;
// program inserts the total number of items (rowsdb) here
var rowsdb=23;// rows number (DATABASE)
var colsdb=11;// columns number (DATABASE)
var rowsres=100; // rows number (RESULT)
var colsres=9; // cols number (RESULT)

// make an Array object initialized by blanks
// (this array is the DATABASE)

celldb=new Array(rowsdb);
for (i=0; i<=rowsdb; i++){celldb[i]=new Array(colsdb)
for (j=0;j<=colsdb; j++) {celldb[i][j]=" "}
 }

// make an Array object initialized by blanks
// (this array will contain items matched; i.e.: RESULT)

cellres=new Array(rowsres);
for (i=0; i<=rowsres; i++){cellres[i]=new Array(colsres);
for (j=0;j<=colsres; j++) {cellres[i][j]=" "}
}

//-------------------  D A T A B A S E (begin) ---------------------
celldb[0][0]="karen";
celldb[0][1]="Karen Valasek";
celldb[0][2]="<I>Kindermusik</I> Kindermusik Our Time";
celldb[0][3]="Tuesday 9:30";
celldb[0][4]="ko05";
celldb[0][5]="18";
celldb[0][6]="42";
celldb[0][7]="160";
celldb[0][8]="55";
celldb[0][9]="1/8/2008";
celldb[0][10]="4/15/2008";
celldb[1][0]="karen";
celldb[1][1]="Karen Valasek";
celldb[1][2]="<I>Kindermusik</I> Kindermusik Our Time";
celldb[1][3]="Tuesday 10:15";
celldb[1][4]="ko12";
celldb[1][5]="18";
celldb[1][6]="42";
celldb[1][7]="160";
celldb[1][8]="55";
celldb[1][9]="1/8/2008";
celldb[1][10]="4/15/2008";
celldb[2][0]="karen";
celldb[2][1]="Karen Valasek";
celldb[2][2]="<I>Kindermusik</I> Kindermusik Our Time";
celldb[2][3]="Wednesday 8:45";
celldb[2][4]="ko06";
celldb[2][5]="18";
celldb[2][6]="42";
celldb[2][7]="160";
celldb[2][8]="55";
celldb[2][9]="1/9/2008";
celldb[2][10]="4/16/2008";
celldb[3][0]="karen";
celldb[3][1]="Karen Valasek";
celldb[3][2]="<I>Kindermusik</I> Kindermusik Our Time";
celldb[3][3]="Wednesday 9:30";
celldb[3][4]="ko07";
celldb[3][5]="18";
celldb[3][6]="42";
celldb[3][7]="160";
celldb[3][8]="55";
celldb[3][9]="1/9/2008";
celldb[3][10]="4/16/2008";
celldb[4][0]="karen";
celldb[4][1]="Karen Valasek";
celldb[4][2]="<I>Kindermusik</I> Kindermusik Village Plus";
celldb[4][3]="Wednesday 10:15";
celldb[4][4]="kx03";
celldb[4][5]="0";
celldb[4][6]="216";
celldb[4][7]="175";
celldb[4][8]="60";
celldb[4][9]="1/9/2008";
celldb[4][10]="4/16/2008";
celldb[5][0]="karen";
celldb[5][1]="Karen Valasek";
celldb[5][2]="<I>Kindermusik</I> Kindermusik Village Plus";
celldb[5][3]="Thursday 9:15";
celldb[5][4]="kx02";
celldb[5][5]="0";
celldb[5][6]="216";
celldb[5][7]="175";
celldb[5][8]="60";
celldb[5][9]="1/10/2008";
celldb[5][10]="4/17/2008";
celldb[6][0]="karen";
celldb[6][1]="Karen Valasek";
celldb[6][2]="<I>Kindermusik</I> Kindermusik Our Time";
celldb[6][3]="Thursday 10:15";
celldb[6][4]="ko04";
celldb[6][5]="18";
celldb[6][6]="42";
celldb[6][7]="160";
celldb[6][8]="55";
celldb[6][9]="1/10/2008";
celldb[6][10]="4/17/2008";
celldb[7][0]="karen";
celldb[7][1]="Karen Valasek";
celldb[7][2]="<I>Kindermusik</I> Kindermusik Imagine That";
celldb[7][3]="Thursday 11:00";
celldb[7][4]="ki03";
celldb[7][5]="42";
celldb[7][6]="60";
celldb[7][7]="200";
celldb[7][8]="55";
celldb[7][9]="1/10/2008";
celldb[7][10]="4/17/2008";
celldb[8][0]="belle";
celldb[8][1]="Belle Armstrong";
celldb[8][2]="<I>Kindermusik</I> Kindermusik Our Time";
celldb[8][3]="Saturday 9:00";
celldb[8][4]="ko02";
celldb[8][5]="18";
celldb[8][6]="42";
celldb[8][7]="160";
celldb[8][8]="55";
celldb[8][9]="1/12/2008";
celldb[8][10]="4/19/2008";
celldb[9][0]="belle";
celldb[9][1]="Belle Armstrong";
celldb[9][2]="<I>Kindermusik</I> Kindermusik Our Time";
celldb[9][3]="Saturday 9:45";
celldb[9][4]="ko14";
celldb[9][5]="18";
celldb[9][6]="42";
celldb[9][7]="160";
celldb[9][8]="55";
celldb[9][9]="1/12/2008";
celldb[9][10]="4/19/2008";
celldb[10][0]="claire";
celldb[10][1]="Claire Starz";
celldb[10][2]="<I>Kindermusik</I> Kindermusik Our Time";
celldb[10][3]="Saturday 9:00";
celldb[10][4]="ko03";
celldb[10][5]="18";
celldb[10][6]="42";
celldb[10][7]="160";
celldb[10][8]="55";
celldb[10][9]="1/12/2008";
celldb[10][10]="4/19/2008";
celldb[11][0]="claire";
celldb[11][1]="Claire Starz";
celldb[11][2]="<I>Kindermusik</I> Kindermusik for the Young Child";
celldb[11][3]="Saturday 9:45";
celldb[11][4]="ky01";
celldb[11][5]="54";
celldb[11][6]="84";
celldb[11][7]="210";
celldb[11][8]="75";
celldb[11][9]="1/12/2008";
celldb[11][10]="4/19/2008";
celldb[12][0]="karen";
celldb[12][1]="Karen Valasek";
celldb[12][2]="<I>Kindermusik</I> Kindermusik Village Plus";
celldb[12][3]="Saturday 8:45";
celldb[12][4]="kx01";
celldb[12][5]="0";
celldb[12][6]="216";
celldb[12][7]="175";
celldb[12][8]="60";
celldb[12][9]="1/12/2008";
celldb[12][10]="4/19/2008";
celldb[13][0]="karen";
celldb[13][1]="Karen Valasek";
celldb[13][2]="<I>Kindermusik</I> Kindermusik Imagine That";
celldb[13][3]="Saturday 9:45";
celldb[13][4]="ki01";
celldb[13][5]="42";
celldb[13][6]="60";
celldb[13][7]="200";
celldb[13][8]="55";
celldb[13][9]="1/12/2008";
celldb[13][10]="4/19/2008";
celldb[14][0]="karen";
celldb[14][1]="Karen Valasek";
celldb[14][2]="<I>Kindermusik</I> Kindermusik Imagine That";
celldb[14][3]="Saturday 10:45";
celldb[14][4]="ki02";
celldb[14][5]="42";
celldb[14][6]="60";
celldb[14][7]="200";
celldb[14][8]="55";
celldb[14][9]="1/12/2008";
celldb[14][10]="4/19/2008";

//-------------------  D A T A B A S E (end) -----------------------

// display result

function display_result(items_found) {
mywindow=window.open("","help","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=380,height=400,screenX=400,screenY=100");
mywindow.document.write("<HTML><HEAD>");
mywindow.document.write("<TITLE>Classes by Teacher</TITLE>");
mywindow.document.write('</HEAD><BODY BGCOLOR=linen TEXT=black link=darkgreen>');
mywindow.document.write("<center><FONT COLOR=darkmagenta><H3>" + cellres[0][0] + " ("+items_found +" classes)</H3><FONT COLOR=black></center><hr>");
items_found--;
for (i=0;i<=rowsres;i++){
mywindow.document.write(cellres[i][1] +" - "+ cellres[i][2]+"<BR>" );
if (i==items_found){i=rowsres;i++};
};
mywindow.document.write("<hr><center><FORM> <INPUT TYPE='button' VALUE='Close' onClick='window.close()'></FORM>");
mywindow.document.write("</CENTER>");
mywindow.document.write("</BODY></HTML>");
mywindow.document.close();

 }

//search the DATABASE array for teachers

function search_db(key1)
{key1=key1.toLowerCase();
 var items_found=0;
 for (i=0;i<rowsdb;i++)
 {if (celldb[i][0]==key1)
 {cellres[items_found][0]=celldb[i][1];
cellres[items_found][1]=celldb[i][2];
cellres[items_found][2]=celldb[i][3];
items_found++;}
 }
if (items_found==0)
 {alert("Sorry, no item matched your search...")}
else
 {display_result(items_found)};
}

function display_result2(items_found,choice_num) {

mywindow=window.open("","help","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,copyhistory=0,width=500,height=200,screenX=400,screenY=100");
mywindow.document.write("<HTML><HEAD>");
mywindow.document.write("<TITLE>Selected so far...</TITLE>");
mywindow.document.write("</HEAD><BODY BGCOLOR=linen TEXT=black link=darkgreen>");
//mywindow.document.write("<center><FONT COLOR=darkmagenta><H3>" + cellres[0][0] + " //("+items_found +" classes)</H3><FONT COLOR=black></center><hr>");
//items_found--;
for (i=0;i<=rowsres;i++){
   if (cellres[i][1]!=" ") {
      if (choice_num==1) mywindow.document.write("1st choice: ");
      if (choice_num==2) mywindow.document.write("2nd choice: ");
      if (choice_num==3) mywindow.document.write("3rd choice: ");
      mywindow.document.write(cellres[i][1] +" - "+ cellres[i][2]+", "+ cellres[i][0]+"<BR>" );
}
if (i==items_found){i=rowsres;i++};
};
mywindow.document.write("<hr><center><FORM> <INPUT TYPE='button' VALUE='Close' onClick='window.close()'></FORM>");
mywindow.document.write("</CENTER>");
mywindow.document.write("</BODY></HTML>");
mywindow.document.close();

}

//***Search function***
function search_db3(key1) {
   key1=key1.toLowerCase();
   var items_found=0;
   for (i=0;i<rowsdb;i++) {
      if (celldb[i][4]==key1) {
         Teacher_Name=celldb[i][1];
         Class_Name=celldb[i][2];
         Class_Time=celldb[i][3];
         Tuition=celldb[i][7];
         Materials=celldb[i][8];
         Start_Day=celldb[i][9];
         End_Day=celldb[i][10];
      }
   }
   return(Teacher_Name,Class_Name,Class_Time,Tuition,Materials,Start_Day,End_Day);
}

//EOF Clasjs2d.prg - linked with Clasjs2a.prg to makes Classes.js'

//*Form Validation
//*email validation function isEmail(elm)
// Check for email address: look for [@] and [.]

function isEmail(elm) {
    if (elm.value.indexOf("@") + "" != "-1" &&
        elm.value.indexOf(".") + "" != "-1" &&
        elm.value != "") 
    return true;
    else return false;
}

//*function isFilled()
//*null or empty validation isFilled(elm)
// Check for null and for empty
function isFilled(elm) {
    if (elm.value == "" ||
        elm.value == null) {
    return false;}
    else return true;
}

//*function isChecked()
// Check for unchecked radio boxes
function isChecked(elm) {
    var checker=false;
    for (counter=0; counter<elm.length; counter++) {
      if (elm[counter].checked) checker=true;
      }
    if (!checker) {return false;}
}

function stuLast() {
   if (document.RegForm.StuName.value != "" && document.RegForm.StuName.value != null){
    StuName=document.RegForm.StuName.value;
    while (StuName.substring(StuName.length-1,StuName.length) == " ") StuName = StuName.substring(0,StuName.length-1);
    document.RegForm.StuName.value=StuName;
    if (StuName.indexOf(" ")==-1) {
       mParName=document.RegForm.ParName.value;
       whereLast=mParName.indexOf(" ");
       mLast=mParName.substring(whereLast,mParName.length);
       document.RegForm.StuName.value=document.RegForm.StuName.value+mLast;
    }
    }
}


function ager2() {
        Stu_Birth_Month=document.RegForm.Month.selectedIndex+1;
        Stu_Birth_Day=document.RegForm.Day.selectedIndex+1;
        Stu_Birth_Year=2008-document.RegForm.Year.selectedIndex;
        if (Stu_Birth_Month < 10) Stu_Birth_Month="0"+Stu_Birth_Month;
        if (Stu_Birth_Day < 10) Stu_Birth_Day="0"+Stu_Birth_Day;
        // getAge(dateString,dateType) //type 3 : 29/05/1997
        getAge("today",Stu_Birth_Day+"/"+Stu_Birth_Month+"/"+Stu_Birth_Year,3);
        //getAge (below) returns ageline for age today
        document.RegForm.Age.value= ager;
}

//*Main function isReady(form)
function isReady(form) {

//Put up the date if it isn't there
if (isFilled(form.TodaysDate) == false) { 
        document.RegForm.TodaysDate.value=writeToday;
}
//Make sure a class is selected
    if (regist[0][2]==" ") {
      alert("Please select a class.");
      ager2();
      if (Stu_Birth_Day==1 && Stu_Birth_Month==1 && Stu_Birth_Year==2008){
         window.location.href="#Top";
         return false;
      }

      getAge(showtermdate,Stu_Birth_Day + "/" + Stu_Birth_Month + "/" + Stu_Birth_Year,3);
        Find_By_Months(StuMonths);
        Class_Name=class1
        //is "Village" a substring of Class_Name? then make the link
        where = Class_Name.indexOf("Village")
        if (where>=0) alias="Village"
        where = Class_Name.indexOf("Our Time")
        if (where>=0) alias="OurTime"
        where = Class_Name.indexOf("Imagine")
        if (where>=0) alias="Imagine"
        where = Class_Name.indexOf("Young Child")
        if (where>=0) alias="Young"
        where = Class_Name.indexOf("Movement")
        if (where>=0) alias="Movement"
        where = Class_Name.indexOf("Drama")
        if (where>=0) alias="Drama"
        where = Class_Name.indexOf("Voice")
        if (where>=0) alias="Voice"
        where = Class_Name.indexOf("Theatre")
        if (where>=0) alias="Theatre"

        gotolink = "#"+alias
        window.location.href=gotolink;

      return false;
    }

//*Validate Student's Name isFilled()
    // is StuName filled?

    if (isFilled(form.StuName) == false) {
    alert("Please enter student's name.");
    form.StuName.focus();
    return false;
    }

//*Validate Gender isChecked()
   if (isChecked(form.sex) == false) {
    SName=form.StuName.value;
    alert("Please indicate if "+SName+" is a boy (M) or a girl (F)");
       form.StuName.focus();
       form.StuName.blur();
    return false;
   }

//*Validate Birthday
//*transfer birthday and add ager
    Stu_Birth_Month=document.RegForm.Month.selectedIndex+1;
    Stu_Birth_Day=document.RegForm.Day.selectedIndex+1;
    Stu_Birth_Year='2008'-document.RegForm.Year.selectedIndex;

    StuName=document.RegForm.StuName.value
    if (Stu_Birth_Month==1 && Stu_Birth_Day==1 && Stu_Birth_Year==2008) {
      alert("Please select " + StuName + "'s birthday.");
       form.StuName.focus();
       form.StuName.blur();
      return false;
    }

//*Get ager to add ageline from birthday
        if (Stu_Birth_Month < 10) Stu_Birth_Month="0"+Stu_Birth_Month;
        if (Stu_Birth_Day < 10) Stu_Birth_Day="0"+Stu_Birth_Day;
        // getAge(dateString,dateType) //type 3 : 29/05/1997
        getAge("today",Stu_Birth_Day+"/"+Stu_Birth_Month+"/"+Stu_Birth_Year,3);
        //getAge (below) returns ageline for age today
        document.RegForm.Age.value= ager;

//*store "Birthday" in words for display output - birthday is hidden field
        birthday = MonthArray[Stu_Birth_Month-1]+" "+Stu_Birth_Day+", "+Stu_Birth_Year;
        document.RegForm.BirthDay.value = birthday;

//*Validate Student Status isChecked()
   if (isChecked(form.status) == false) {
    StuName=form.StuName.value;
       alert("Please indicate if "+StuName+" is a current, former or new student.");
       form.StuName.focus();
       form.StuName.blur();
    return false;
   }

//*Validate Parent's Name
    // is ParName element filled?
    if (isFilled(form.ParName) == false) {
    alert("Please enter parents' names (your name).");
    form.StuName.focus();
    form.ParName.focus();
    return false;
    }

//*Validate Street Address
    // is Address element filled?

    if (isFilled(form.Add1) == false) {
    alert("Please enter Street Address.");
    form.StuName.focus();
    form. Add1.focus();
    return false;
    }

//*Validate Address 2 (City)
    // is 2nd Address element filled?

    if (isFilled(form.Add2) == false) {
    alert("Please enter the City.");
    form.StuName.focus();
    form. Add2.focus();
    return false;
    }

//*Validate Zip Code
    // is Zip Code element filled?

    if (isFilled(form.ZIP) == false) {
    alert("Please enter ZIP Code.");
    form.StuName.focus();
    form. ZIP.focus();
    return false;
    }

//*Validate Phone
    // is a  Phone element filled?

    if (isFilled(form.HomePhone) == false) {
      alert("Please enter Home Phone.");
      form.StuName.focus();
      form. HomePhone.focus();
      return false;
    }

//*If new student get HowHeard if empty
    if (form.status[2].checked == true) {
      if (isFilled(form.HowHeard) == false) {
         alert("Please tell how you found out about PacArts.")
       form.email.focus();
       form.HowHeard.focus();
         return false;
      }
    }

    if (isFilled(form.CardNumber) == true) {
       if (form.cardtype[0].checked != true && cardname[1].checked != true) {
       alert("Please select a card type");
       form.Amount.focus();
       form.Amount.blur();
         return false;
       }
       if (isFilled(form.CardExpDate) != true) {
         alert("Please enter the Expiration Date");
       form.Amount.focus();
       form.CardExpDate.focus();
         return false;
       }
       if (isFilled(form.CardName) != true) {
         alert("Please enter the name printed on the card.");
       form.Amount.focus();
       form.CardName.focus();
         return false;
       }
    }


//*if successful
    display()
}


//*Dates
// what is this?'
function compute(form) {form.result.value = eval(form.expr.value)}

// provides the variables for date and time display
function MakeArray(n) {this.length = n;
   for (var i = 1; i <= n; i++) {this[i] = 0}
     return this}
{ DayArray = new MakeArray(7);
  DayArray[0] = "Sunday, ";
  DayArray[1] = "Monday, ";
  DayArray[2] = "Tuesday, ";
  DayArray[3] = "Wednesday, ";
  DayArray[4] = "Thursday, ";
  DayArray[5] = "Friday, ";
  DayArray[6] = "Saturday, ";
}

{ MonthArray = new MakeArray(12);
  MonthArray[0] = "January ";
  MonthArray[1] = "February ";
  MonthArray[2] = "March ";
  MonthArray[3] = "April ";
  MonthArray[4] = "May ";
  MonthArray[5] = "June ";
  MonthArray[6] = "July ";
  MonthArray[7] = "August ";
  MonthArray[8] = "September ";
  MonthArray[9] = "October ";
  MonthArray[10] = "November ";
  MonthArray[11] = "December ";
}

Today = new Date()
date = Today.getDate()
weekday = Today.getDay()
month = Today.getMonth()
year = Today.getYear()
year = year+1900
hours = Today.getHours()
mins = Today.getMinutes()
secs = Today.getSeconds()
if (mins < 10)    {writemins = "0"}
else {writemins = ""}
if (secs < 10)    {writesecs = "0"}
else {writesecs = ""}
if (hours < 12) {ampm = " a.m."}
else {ampm = " p.m."}
if (hours > 12) {writehours = hours-12}
else {writehours = hours}

//Sample call:
//document.write("<I>", DayArray[weekday], MonthArray[month], date+",   "+writehours+":"+writemins+mins+":"+writesecs+secs+ampm, "</I>")
//results: Tuesday, July 24, 9:30:07 p.m.

//save today's date into writeToday
if (year > 2500) year=year-1900;
writeToday=MonthArray[month] + date +", "+year;

//onLoad this to set Today's Date in the form
function init() {
   document.RegForm.TodaysDate.value=writeToday;
   }

//*GetAge
//http://developer.irt.org/script/29.htm
function getAge(nowdate,dateString,dateType) {
  /*
     function getAge
     parameters: dateString dateType
     returns: boolean

     dateString is a date
     passed as a string in the following
     formats:

     type 1 : 19970529
     type 2 : 970529
     type 3 : 29/05/1997
     type 4 : 29/05/97

     dateType is a numeric integer from 1 to 4, representing
     the type of dateString passed, as defined above.

     Returns string containing the age in years, months and days
     in the format yyy years mm months dd days.
     Returns empty string if dateType is not one of the expected
     values.
  */

      if (nowdate=="today") { var now = new Date(); }
      else { var now = new Date(nowdate); }

      var today = new Date(now.getYear(),now.getMonth(),now.getDate());

      var yearNow = now.getYear();
      var monthNow = now.getMonth();
      var dateNow = now.getDate();

      if (dateType == 1)
          var dob = new Date(dateString.substring(0,4),
                              dateString.substring(4,6)-1,
                              dateString.substring(6,8));
      else if (dateType == 2)
          var dob = new Date(dateString.substring(0,2),
                              dateString.substring(2,4)-1,
                              dateString.substring(4,6));
      else if (dateType == 3)
          var dob = new Date(dateString.substring(6,10),
                              dateString.substring(3,5)-1,
                              dateString.substring(0,2));
      else if (dateType == 4)
          var dob = new Date(dateString.substring(6,8),
                              dateString.substring(3,5)-1,
                              dateString.substring(0,2));
      else
          return '';

      var yearDob = dob.getYear();
      var monthDob = dob.getMonth();
      var dateDob = dob.getDate();

      yearAge = yearNow - yearDob;

      if (monthNow >= monthDob)
          var monthAge = monthNow - monthDob;
      else {
          yearAge--;
          var monthAge = 12 + monthNow -monthDob;
      }

      if (dateNow >= dateDob)
          var dateAge = dateNow - dateDob;
      else {
          monthAge--;
          var dateAge = 31 + dateNow - dateDob;

          if (monthAge < 0) {
              monthAge = 11;
              yearAge--;
          }
      }

      if (yearAge>=1900) {yearAge=yearAge-1900};

      StuMonths = monthAge+(yearAge*12);

      if (yearAge==0) {
              if (monthAge!=1 && dateAge!=1) {
                 ageline = monthAge + " months and " + dateAge + " days.";
              }
              if (monthAge==1 && dateAge!=1) {
                 ageline = "1 month and " + dateAge + " days.";
              }
              if (monthAge!=1 && dateAge==1) {
                  ageline = monthAge + " months and 1 day.";
              }
             if (monthAge==1 && dateAge==0) {ageline="1 month.";}
              if (monthAge>1) ager= monthAge+" mos."
              else ager = "1 mo."
      return ageline, ager,StuMonths;
      }

      if (yearAge==1) {
              if (monthAge!=1 && dateAge!=1) {
                 ageline = "1 year, "+ monthAge + " months, and " + dateAge + " days.";
              }
              if (monthAge==1 && dateAge!=1) {
                 ageline = "1 year, 1 month and " + dateAge + " days.";
              }
              if (monthAge!=1 && dateAge==1) {
                  ageline = "1 year, "+ monthAge + " months and 1 day.";
              }
              if (monthAge==0 && dateAge!=1) {
                  ageline = "1 year and " + dateAge + " days.";
              }
              if (monthAge==0 && dateAge==0) {
                  ageline = "1 year - today! - Happy Birthday!";
              }
              if (monthAge==0) ager = "1 yr.";
              if (monthAge==1) ager = "1 yr. 1 mo.";
              else ager = "1 yr. "+monthAge+" mos.";
      return ageline,ager,StuMonths;
      }

      if (monthAge!=1 && dateAge!=1) {
      ageline = yearAge + " years, " + monthAge + " months, and " + dateAge + " days.";
      }
      if (monthAge==1 && dateAge!=1) {
      ageline = yearAge + " years, 1 month, and " + dateAge + " days.";
      }
      if (monthAge!=1 && dateAge==1) {
      ageline = yearAge + " years " + monthAge + " months and 1 day.";
      }
      if (monthAge==0 && dateAge==1) {
      ageline = yearAge + " years and 1 day.";
      }
      if (monthAge==0 && dateAge!=0) {
      ageline = yearAge + " years and " + dateAge + " days.";
      }
      if (monthAge==0 && dateAge==0) {
      ageline = yearAge + " years - today! - Happy Birthday!";
      }
      if (monthAge!=0 && dateAge==0) {
      ageline = yearAge + " years and "+ monthAge + " months.";
      }
      if (monthAge==1 && dateAge==0) {
      ageline = yearAge + " years and 1 month.";
      }
      if (yearAge>=21) {
      ageline = "over 21.";
      }

      if (monthAge==0) {
         ager = yearAge+" yrs.";
         return ageline,ager,StuMonths;
      }

      if (monthAge==1) ager = yearAge+" yrs. 1 mo.";
      else ager = yearAge+" yrs. "+monthAge+" mos."
      return ageline,ager,StuMonths;

      //return yearAge + " years " + monthAge + " months " + dateAge + " days";
  }
/*
  document.write(getAge("19650104",1)+"<BR>");

  document.write(getAge("650104",2)+"<BR>");

  document.write(getAge("04/01/1965",3)+"<BR>");

  document.write(getAge("04/01/65",4)+"<BR>");
*/
//EOF Clasjs2c.prg - linked with Clasjs2b.prg to makes Classes.js
