      /*
       * Calculate UCAS Points and open a printable window of results.
       */
      function calculatePoints() {

         // Obtain index of selected option in grade menu.
         grade1 = document.upc.Grade1.selectedIndex;
        
         // Obtain index of selected option in qualification menu.
         type1  = document.upc.Type1.selectedIndex;

         grade2 = document.upc.Grade2.selectedIndex;
         type2  = document.upc.Type2.selectedIndex;
         grade3 = document.upc.Grade3.selectedIndex;
         type3  = document.upc.Type3.selectedIndex;
         grade4 = document.upc.Grade4.selectedIndex;
         type4  = document.upc.Type4.selectedIndex;
         grade5 = document.upc.Grade5.selectedIndex;
         type5  = document.upc.Type5.selectedIndex;
         grade6 = document.upc.Grade6.selectedIndex;
         type6  = document.upc.Type6.selectedIndex;
         grade7 = document.upc.Grade7.selectedIndex;
         type7  = document.upc.Type7.selectedIndex;
         grade8 = document.upc.Grade8.selectedIndex;
         type8  = document.upc.Type8.selectedIndex;

         // Obtain points for this qualification.
         sub1 = detPoints( document.upc.Type1.options[type1].value, document.upc.Grade1.options[grade1].value);

         // Set points field corresponding to qualification to points obtained. 
         document.upc.points1.value = sub1;

         sub2 = detPoints( document.upc.Type2.options[type2].value, document.upc.Grade2.options[grade2].value);
         document.upc.points2.value = sub2;
         sub3 = detPoints( document.upc.Type3.options[type3].value, document.upc.Grade3.options[grade3].value);
         document.upc.points3.value = sub3;
         sub4 = detPoints( document.upc.Type4.options[type4].value, document.upc.Grade4.options[grade4].value);
         document.upc.points4.value = sub4;
         sub5 = detPoints( document.upc.Type5.options[type5].value, document.upc.Grade5.options[grade5].value);
         document.upc.points5.value = sub5;
         sub6 = detPoints( document.upc.Type6.options[type6].value, document.upc.Grade6.options[grade6].value);
         document.upc.points6.value = sub6;
         sub7 = detPoints( document.upc.Type7.options[type7].value, document.upc.Grade7.options[grade7].value);
         document.upc.points7.value = sub7;
         sub8 = detPoints( document.upc.Type8.options[type8].value, document.upc.Grade8.options[grade8].value);
         document.upc.points8.value = sub8;

         // Set total field to aggregate of points for each qualification.
         document.upc.Total.value = sub1 + sub2 + sub3 + sub4 + sub5 + sub6 + sub7 + sub8;

         // Print results of calculation in a new window.
         printPage();

      } // End function calculatePoints.


      /*
       * Create a qualification menu. 
       * The menuID argument forms part of the menu name, helping to uniquely identify it.
       */
      function createTypes( menuID) {

         document.write( "<select name='Type" + menuID + "' onChange='changeGradeValue(" + menuID + ")'" + ">");
         document.write( "<option value = ' ' selected></option>");
         document.write( "<option value = 'BNA'>BTEC National Award</option>"); 
         document.write( "<option value = 'BNC'>BTEC National Certification</option>");
         document.write( "<option value = 'BND'>BTEC National Diploma</option>");
         document.write( "<option value = 'CDP'>CACHE Diploma Practical</option>");
         document.write( "<option value = 'CDT'>CACHE Diploma Theory</option>");
         document.write( "<option value = 'FSM'>Free Standing Maths</option>");
         document.write( "<option value = 'GCEA'>GCE A Level</option>");
         document.write( "<option value = 'GCEAS'>GCE AS Level</option>");
         document.write( "<option value = 'IFSCEFS'>Institute of Financial Services CEFS</option>");
         document.write( "<option value = 'IFSCFSP'>Institute of Financial Services CFSP</option>");
         document.write( "<option value = 'KS'>Key Skills</option>");
         document.write( "<option value = 'MEPG6'>Music Examination Practical Grade 6</option>");
         document.write( "<option value = 'MEPG7'>Music Examination Practical Grade 7</option>");
         document.write( "<option value = 'MEPG8'>Music Examination Practical Grade 8</option>");
         document.write( "<option value = 'METG6'>Music Examination Theory Grade 6</option>");
         document.write( "<option value = 'METG7'>Music Examination Theory Grade 7</option>");
         document.write( "<option value = 'METG8'>Music Examination Theory Grade 8</option>");
         document.write( "<option value = 'SAH'>Scottish Advanced Higher</option>");
         document.write( "<option value = 'SCS'>Scottish Core Skills</option>");
         document.write( "<option value = 'SH'>Scottish Higher</option>");
         document.write( "<option value = 'SI2'>Scottish Intermidiate 2</option>");
         document.write( "<option value = 'SSGC'>Scottish Standard Grade Credit</option>");
         document.write( "<option value = 'VCEA'>VCE A Level</option>");
         document.write( "<option value = 'VCEAS'>VCE AS Level</option>");
         document.write( "<option value = 'VCEDA'>VCE Double Award</option>"); 
         document.write( "</select>");

      } // End function createTypes.


      /*
       * Create a grade menu. 
       * The menuID argument forms part of the menu name, helping to uniquely identify it.
       */
      function createGrades( menuID) {

         document.write( "<select name='Grade" + menuID + "'>");
         document.write( "<option name ='' selected></option>");
         document.write( "</select>");

      } // End function createGrades.


      /* 
       * Determine points for a grade in a particular course. 
       */
      function detPoints( theType, theGrade) {

         points = 0;

         if ( theGrade == "A") {           // CDT BNC
            points = 240;
         } else if ( theGrade == "B") {
            points = 200;
         } else if ( theGrade == "C") {
            points = 160;
         } else if ( theGrade == "D") {
            points = 120;
         } else if ( theGrade == "E") {
            points = 80;
         } // End if.
                
         if ( theType == "BNA") {
            if ( theGrade == "D") {
               points = 120;
            } else if ( theGrade == "M") {
               points = 80;
            } else if ( theGrade == "P") {
               points = 40;
            } // End if
         
         } else if ( theType == "BNC") {
            if ( theGrade == "DD") {
               points = 240;
            } else if ( theGrade == "DM") {
               points = 200;
            } else if ( theGrade == "MM") {
               points = 160;
            } else if ( theGrade == "MP") {
               points = 120;
            } else if ( theGrade == "PP") {
               points = 80;
            } // End if.
      
         } else if ( theType == "BND") {
            if ( theGrade == "DDD") {
               points = 360;
            } else if ( theGrade == "DDM") {
               points = 320;
            } else if ( theGrade == "DMM") {
               points = 280;
            } else if ( theGrade == "MMM") {
               points = 240;
            } else if ( theGrade == "MMP") {
               points = 200;
            } else if ( theGrade == "MPP") {
               points = 160;
            } else if ( theGrade == "PPP") {
               points = 120;
            } // End if.

         } else if ( theType == "GCEAS" || theType == "VCEAS") {
            if ( theGrade == "A") {
               points = 60;
            } else if ( theGrade == "B") {
               points = 50;
            } else if ( theGrade == "C") {
               points = 40;
            } else if ( theGrade == "D") {
               points = 30;
            } else if ( theGrade == "E") {
               points = 20;
            } // End if.

         } else if ( theType == "VCEDA") {
            if ( theGrade == "AA") {
               points = 240;
            } else if ( theGrade == "AB") {
               points = 220;
            } else if ( theGrade == "BB") {
               points = 200;
            } else if ( theGrade == "BC") {
               points = 180;
            } else if ( theGrade == "CC") {
               points = 160;
            } else if ( theGrade == "CD") {
               points = 140;
            } else if ( theGrade == "DD") {
               points = 120;
            } else if ( theGrade == "DE") {
               points = 100;
            } else if ( theGrade == "EE") {
               points = 80;
            } // End if.

         } else if ( theType == "FSM") {
            if ( theGrade == "A") {
               points = 20;
            } else if ( theGrade == "B") {
               points = 17;
            } else if ( theGrade == "C") {
               points = 13;
            } else if ( theGrade == "D") {
               points = 10;
            } else if ( theGrade == "E") {
               points = 7;
            } // End if.

         } else if ( theType == "SAH") {
            if ( theGrade == "A") {
               points = 120;
            } else if ( theGrade == "B") {
               points = 100;
            } else if ( theGrade == "C") {
               points = 80;
            } // End if.

         } else if ( theType == "SH") {
            if ( theGrade == "A") {
               points = 72;
            } else if ( theGrade == "B") {
               points = 60;
            } else if ( theGrade == "C") {
               points = 48;
            } // End if.

         } else if ( theType == "SI2") {
            if ( theGrade == "A") {
               points = 42;
            } else if ( theGrade == "B") {
               points = 35;
            } else if ( theGrade == "C") {
               points = 28;
            } // End if.

         } else if ( theType == "SSGC") {
            if ( theGrade == "Band 1") {
               points = 38;
            } else if ( theGrade == "Band 2") {
               points = 28;
            } // End if.

         } else if ( theType == "SCS") {
            if ( theGrade == "Higher") {
               points = 20;
            } else if ( theGrade == "Int 2") {
               points = 10;
            } // End if.

         } else if ( theType == "KS") {
            if ( theGrade == "Level 4") {
               points = 30;
            } else if ( theGrade == "Level 3") {
               points = 20;
            } else if ( theGrade == "Level 2") {
               points = 10;
            } // End if.

         } else if ( theType == "IFSCFSP") {
            if ( theGrade == "Pass") {
               points = 60;
            } // End if.

         } else if ( theType == "IFSCEFS") {
            if ( theGrade == "A") {
               points = 60;
            } else if ( theGrade == "B") {
               points = 45;
            } // End if.

         } else if ( theType == "MEPG6") {
            if ( theGrade == "D") {
               points = 45;
            } else if ( theGrade == "M") {
               points = 40;
            } else if ( theGrade == "P") {
               points = 25;
            } // End if.

         } else if ( theType == "MEPG7") {
            if ( theGrade == "D") {
               points = 60;
            } else if ( theGrade == "M") {
               points = 55;
            } else if ( theGrade == "P") {
               points = 40;
            } // End if.

         } else if ( theType == "MEPG8") {
            if ( theGrade == "D") {
               points = 75;
            } else if ( theGrade == "M") {
               points = 70;
            } else if ( theGrade == "P") {
               points = 55;
            } // End if.

         } else if ( theType == "METG6") {
            if ( theGrade == "D") {
               points = 15;
            } else if ( theGrade == "M") {
               points = 10;
            } else if ( theGrade == "P") {
               points = 5;
            } // End if.

         } else if ( theType == "METG7") {
            if ( theGrade == "D") {
               points = 20;
            } else if ( theGrade == "M") {
               points = 15;
            } else if ( theGrade == "P") {
               points = 10;
            } // End if.

         } else if ( theType == "METG8") {
            if ( theGrade == "D") {
               points = 30;
            } else if ( theGrade == "M") {
               points = 25;
            } else if ( theGrade == "P") {
               points = 20;
            } // End if.
         } // End if.

         if ( theType == "CDP" || theType == "GCEA" || theType == "VCEA") {
            return Math.round( points / 2);           // 
         } else {
            return points;
         } // End if.
      } // End function detPoints.


      /*
       * Convert abriviated qualification to readable name for display in results window.       
       */
      function readableTypeName( qualification) {

        if ( qualification == "BNA") {
           return "BTEC National Award";
        } else if ( qualification == "BNC") {
           return "BTEC National Certification";
        } else if ( qualification == "BND") {
           return "BTEC National Diploma";
        } else if ( qualification == "CDP") {
           return "CACHE Diploma Practical";
        } else if ( qualification == "CDT") {
           return "CACHE Diploma Theory";
        } else if ( qualification == "FSM") {
           return "Free Standing Maths";
        } else if ( qualification == "GCEA") {
           return "GCE A Level"; 
        } else if ( qualification == "GCEAS") {
           return "GCE AS Level";
        } else if ( qualification == "IFSCEFS") {
           return "Institute of Financial Services CEFS";
        } else if ( qualification == "IFSCFSP") {
           return "Institute of Financial Services CFSP";
        } else if ( qualification == "KS") {
           return "Key Skills";
        } else if ( qualification == "MEPG6") {
           return "Music Examination Practical Grade 6";
        } else if ( qualification == "MEPG7") {
           return "Music Examination Practical Grade 7";
        } else if ( qualification == "MEPG8") {
           return "Music Examination Practical Grade 8";
        } else if ( qualification == "METG6") {
           return "Music Examination Theory Grade 6";
        } else if ( qualification == "METG7") {
           return "Music Examination Theory Grade 7";
        } else if ( qualification == "METG8") {
           return "Music Examination Theory Grade 8";
        } else if ( qualification == "SAH") {
           return "Scottish Advanced Higher";
        } else if ( qualification == "SCS") {
           return "Scottish Core Skills";
        } else if ( qualification == "SH") {
           return "Scottish Higher";
        } else if ( qualification == "SI2") {
           return "Scottish Intermediate 2";
        } else if ( qualification == "SSGC") {
           return "Scottish Standard Grade Credit";
        } else if ( qualification == "VCEA") {
           return "VCE A Level";
        } else if ( qualification == "VCEAS") {
           return "VCE AS Level";
        } else if ( qualification == "VCEDA") {
           return "VCE Double Award";
        } else {
           return " ";
        } // End if.

      } // End function readableTypeName.


      /*
       * Display results of UCAS calculator. 
       * This function is called by the calculatePoints() function.
       */
      function printPage() {

         // Create a window to display results of calculation.
         displayWindow = window.open( "", "My_new_window", "width=600,height=550", "scrollbar='yes'");

         // Open the document of the displayWindow for writing.
         displayWindow.document.open();

         // Create an array to hold subject names.
         subjects = new Array();

         // Place each subject name in the subjects array.
         subjects[1] = document.upc.subject1.value;
         subjects[2] = document.upc.subject2.value;
         subjects[3] = document.upc.subject3.value;
         subjects[4] = document.upc.subject4.value;
         subjects[5] = document.upc.subject5.value;
         subjects[6] = document.upc.subject6.value;
         subjects[7] = document.upc.subject7.value;
         subjects[8] = document.upc.subject8.value;

         grade1 = document.upc.Grade1.selectedIndex;
         grade2 = document.upc.Grade2.selectedIndex;
         grade3 = document.upc.Grade3.selectedIndex;
         grade4 = document.upc.Grade4.selectedIndex;
         grade5 = document.upc.Grade5.selectedIndex;
         grade6 = document.upc.Grade6.selectedIndex;
         grade7 = document.upc.Grade7.selectedIndex;
         grade8 = document.upc.Grade8.selectedIndex;

         type1 = document.upc.Type1.selectedIndex;
         type2 = document.upc.Type2.selectedIndex;
         type3 = document.upc.Type3.selectedIndex;
         type4 = document.upc.Type4.selectedIndex;
         type5 = document.upc.Type5.selectedIndex;
         type6 = document.upc.Type6.selectedIndex;
         type7 = document.upc.Type7.selectedIndex;
         type8 = document.upc.Type8.selectedIndex;
         total = document.upc.Total.value;

         // Create an array to hold points for each subject
         points = new Array();

         // Place points for each subject in the points array.
         points[1] = document.upc.points1.value;
         points[2] = document.upc.points2.value;
         points[3] = document.upc.points3.value;
         points[4] = document.upc.points4.value;
         points[5] = document.upc.points5.value;
         points[6] = document.upc.points6.value;
         points[7] = document.upc.points7.value;
         points[8] = document.upc.points8.value;

         // Create an array to store grades for each subject.
         grades = new Array();

         // Place grades for each subject in the grades array.
         grades[1] = document.upc.Grade1.options[grade1].value;
         grades[2] = document.upc.Grade2.options[grade2].value;
         grades[3] = document.upc.Grade3.options[grade3].value;
         grades[4] = document.upc.Grade4.options[grade4].value;
         grades[5] = document.upc.Grade5.options[grade5].value;
         grades[6] = document.upc.Grade6.options[grade6].value;
         grades[7] = document.upc.Grade7.options[grade7].value;
         grades[8] = document.upc.Grade8.options[grade8].value;

         // Create an array to store each qualification.
         types = new Array();

         // Place qualifications for each subject in the array.
         types[1] = document.upc.Type1.options[type1].value;
         types[2] = document.upc.Type2.options[type2].value;
         types[3] = document.upc.Type3.options[type3].value;
         types[4] = document.upc.Type4.options[type4].value;
         types[5] = document.upc.Type5.options[type5].value;
         types[6] = document.upc.Type6.options[type6].value;
         types[7] = document.upc.Type7.options[type7].value;
         types[8] = document.upc.Type8.options[type8].value;

	   displayWindow.document.write( "<title>Merlin UCAS Points Calculator Results</title>");
         displayWindow.document.write( "<center>www.merlinhelpsstudents.com</center>");
         displayWindow.document.write( "<h2><center>UCAS Points Calculator Results</h2>");
         displayWindow.document.write( "<table width='90%' border='1'>");
         displayWindow.document.write( "<tr><td align='center'><b>Subject</b></td><td align='center'><b>Course Type</b></td>");
         displayWindow.document.write( "<td align='center'><b>Grade</b></td><td align='center'><b>Points</b></td></tr>");

         for( count = 1; count < 9; count++) {
            if ( points[count] != 0) {
               displayWindow.document.write( "<tr>");
               displayWindow.document.write( "<td align='center'>" + subjects[count] + "</td>");
               displayWindow.document.write( "<td align='center'>" + readableTypeName( types[count]) + "</td>"); 
               displayWindow.document.write( "<td align='center'>" + grades[count] + "</td>"); 
               displayWindow.document.write( "<td align='center'>" + points[count] + "</td>"); 
               displayWindow.document.write( "</tr>");
            } // End if.
         } // End for.

         displayWindow.document.write( "</table><p>"); 
         displayWindow.document.write( "<b>Total UCAS Points: ");
         displayWindow.document.write( total); 
         displayWindow.document.write( "</b><p>");
         displayWindow.document.write( "<center><a href='javascript:print()'><img src='/Graphics/Forms/print.gif' border=0 alt='Print Exam points'></a>");
         displayWindow.document.write( "&nbsp;<a href='javascript:close()'><img src='/graphics/forms/closewindow.gif' border=0 alt='Close Window'></a></center>");

         // Close the document of the displayWindow as writing is now complete.
         displayWindow.document.close();

      } // End function printPage.


      /*
       * Dynamically change the grade menu identified by the variable i.
       */
      function changeGradeValue( i) {

         type1 = document.upc.Type1.selectedIndex;
         type2 = document.upc.Type2.selectedIndex;
         type3 = document.upc.Type3.selectedIndex;
         type4 = document.upc.Type4.selectedIndex;
         type5 = document.upc.Type5.selectedIndex;
         type6 = document.upc.Type6.selectedIndex;
         type7 = document.upc.Type7.selectedIndex;
         type8 = document.upc.Type8.selectedIndex;

         typeMenus = new Array( document.upc.Type1.options[type1].value,
                                document.upc.Type2.options[type2].value,
                                document.upc.Type3.options[type3].value,
                                document.upc.Type4.options[type4].value,
                                document.upc.Type5.options[type5].value,
                                document.upc.Type6.options[type6].value,
                                document.upc.Type7.options[type7].value,
                                document.upc.Type8.options[type8].value);

         gradeMenus = new Array( document.upc.Grade1, 
                                 document.upc.Grade2, 
                                 document.upc.Grade3, 
                                 document.upc.Grade4, 
                                 document.upc.Grade5, 
                                 document.upc.Grade6, 
                                 document.upc.Grade7, 
                                 document.upc.Grade8);


         if ( typeMenus[i-1] == "BNA" || typeMenus[i-1] == "MEPG6"
              || typeMenus[i-1] == "MEPG7" || typeMenus[i-1] == "MEPG8"
              || typeMenus[i-1] == "METG6" || typeMenus[i-1] == "METG7"
              || typeMenus[i-1] == "METG8" ) {
            updateMenu(gradeMenus[i-1], "BNA");
         } // End if.

         if ( typeMenus[i-1] == "BNC") {
            updateMenu(gradeMenus[i-1], "BNC");
         } // End if.

         if ( typeMenus[i-1] == "BND") {
            updateMenu(gradeMenus[i-1], "BND");
         } // End if.

         if ( typeMenus[i-1] == "CDP" || typeMenus[i-1] == "CDT"
              || typeMenus[i-1] == "FSM" || typeMenus[i-1] == "GCEA"
              || typeMenus[i-1] == "GCEAS" || typeMenus[i-1] == "VCEA"
              || typeMenus[i-1] == "VCEAS") {
            updateMenu(gradeMenus[i-1], "CDP");
         } // End if.

         if ( typeMenus[i-1] == "SAH" || typeMenus[i-1] == "SH"
              || typeMenus[i-1] == "SI2") {
           updateMenu(gradeMenus[i-1], "SAH");
         } // End if.

         if ( typeMenus[i-1] == "SSGC") {
           updateMenu(gradeMenus[i-1], "SSGC");
         } // End if.

         if ( typeMenus[i-1] == "VCEDA") {
           updateMenu(gradeMenus[i-1], "VCEDA");
         } // End if.

         if ( typeMenus[i-1] == "SCS") {
           updateMenu(gradeMenus[i-1], "SCS");
         } // End if.

         if ( typeMenus[i-1] == "KS") {
           updateMenu(gradeMenus[i-1], "KS");
         } // End if.

         if ( typeMenus[i-1] == "IFSCEFS") {
           updateMenu(gradeMenus[i-1], "IFSCEFS");
         } // End if.

         if ( typeMenus[i-1] == "IFSCFSP") {
           updateMenu(gradeMenus[i-1], "IFSCFSP");
         } // End if.

      } // End function changeGradeValue.


      /*
       * Update a grade menu (toUpdate) in response to selecting a new 
       * qualification from the corresponding qualification menu.
       * This function is called by changeGradeValue.
       */  
      function updateMenu( toUpdate, how) {

         if ( how == "BNA") {
            // Change length of grade menu to reflect new no of options. 
            toUpdate.length = 4;

            // Set each individual option in grade menu to new options.
            toUpdate.options[1] = new Option( 'D', 'D');
            toUpdate.options[2] = new Option( 'M', 'M');
            toUpdate.options[3] = new Option( 'P', 'P');
         } // End if.

         if ( how == "BNC") {
            toUpdate.length = 6;
            toUpdate.options[1] = new Option( 'DD', 'DD');
            toUpdate.options[2] = new Option( 'DM', 'DM');
            toUpdate.options[3] = new Option( 'MM', 'MM');
            toUpdate.options[4] = new Option( 'MP', 'MP');
            toUpdate.options[5] = new Option( 'PP', 'PP');
         } // End if.

         if ( how == "BND") {
            toUpdate.length = 8;
            toUpdate.options[1] = new Option( 'DDD', 'DDD');
            toUpdate.options[2] = new Option( 'DDM', 'DDM');
            toUpdate.options[3] = new Option( 'DMM', 'DMM');
            toUpdate.options[4] = new Option( 'MMM', 'MMM');
            toUpdate.options[5] = new Option( 'MMP', 'MMP');
            toUpdate.options[6] = new Option( 'MPP', 'MPP');
            toUpdate.options[7] = new Option( 'PPP', 'PPP');
         } // End if.

         if ( how == "CDP") {
            toUpdate.length = 6;
            toUpdate.options[1] = new Option( 'A', 'A');
            toUpdate.options[2] = new Option( 'B', 'B');
            toUpdate.options[3] = new Option( 'C', 'C');
            toUpdate.options[4] = new Option( 'D', 'D');
            toUpdate.options[5] = new Option( 'E', 'E');
         } // End if.

         if ( how == "SAH") {
            toUpdate.length = 4;
            toUpdate.options[1] = new Option( 'A', 'A');
            toUpdate.options[2] = new Option( 'B', 'B');
            toUpdate.options[3] = new Option( 'C', 'C');
         } // End if.

         if ( how == "SSGC") {
            toUpdate.length = 3;
            toUpdate.options[1] = new Option( 'Band 1', 'Band 1');
            toUpdate.options[2] = new Option( 'Band 2', 'Band 2');
         } // End if.

         if ( how == "VCEDA") {
            toUpdate.length = 10;
            toUpdate.options[1] = new Option( 'AA', 'AA');
            toUpdate.options[2] = new Option( 'AB', 'AB');
            toUpdate.options[3] = new Option( 'BB', 'BB');
            toUpdate.options[4] = new Option( 'BC', 'BC');
            toUpdate.options[5] = new Option( 'CC', 'CC');
            toUpdate.options[6] = new Option( 'CD', 'CD');
            toUpdate.options[7] = new Option( 'DD', 'DD');
            toUpdate.options[8] = new Option( 'DE', 'DE');
            toUpdate.options[9] = new Option( 'EE', 'EE');
         } // End if.

         if ( how == "SCS") {
            toUpdate.length = 3;
            toUpdate.options[1] = new Option( 'Higher', 'Higher');
            toUpdate.options[2] = new Option( 'Int 2', 'Int 2');
         } // End if.

         if ( how == "KS") {
            toUpdate.length = 4;
            toUpdate.options[1] = new Option( 'Level 2', 'Level 2');
	      toUpdate.options[2] = new Option( 'Level 3', 'Level 3');
            toUpdate.options[3] = new Option( 'Level 4', 'Level 4');
         } // End if.

         if ( how == "IFSCEFS") {
            toUpdate.length = 3;
            toUpdate.options[1] = new Option( 'A', 'A');
            toUpdate.options[2] = new Option( 'B', 'B');
         } // End if.

         if ( how == "IFSCFSP") {
            toUpdate.length = 2;
            toUpdate.options[1] = new Option( 'Pass', 'Pass');
         } // End if.

      } // End function updateMenu


      /*
       * Explicitly reset all grade menus to their initial values. 
       * The normal form.reset() method is unable to adequately handle this.
       */
      function resetCalc() {
         
         // Reset fields displaying points.
         document.upc.reset();

         // Create an array containing references to each grade menu.  
         gradeMenus = new Array( document.upc.Grade1, 
                                 document.upc.Grade2, 
                                 document.upc.Grade3, 
                                 document.upc.Grade4, 
                                 document.upc.Grade5, 
                                 document.upc.Grade6, 
                                 document.upc.Grade7, 
                                 document.upc.Grade8);

         gradeMenus[0].length = 1;                        // Grade menu only holds one option.
         gradeMenus[0].options[0] = new Option( '', '');  // Set the single option to empty.

         gradeMenus[1].length = 1;
         gradeMenus[1].options[0] = new Option( '', '');

         gradeMenus[2].length = 1;
         gradeMenus[2].options[0] = new Option( '', '');

         gradeMenus[3].length = 1;
         gradeMenus[3].options[0] = new Option( '', '');

         gradeMenus[4].length = 1;
         gradeMenus[4].options[0] = new Option( '', '');

         gradeMenus[5].length = 1;
         gradeMenus[5].options[0] = new Option( '', '');

         gradeMenus[6].length = 1;
         gradeMenus[6].options[0] = new Option( '', '');

         gradeMenus[7].length = 1;
         gradeMenus[7].options[0] = new Option( '', '');

      } // End function resetCalc.
