<!--

var Grade = "Biology";
var trueAns = new Array("D", "H", "B", "G", "D", "G", "C", "F", "C", "J", 
			"C", "J", "B", "H", "A", "J", "A", "G", "B", "H",
			"A", "G", "D", "F", "C", "F", "C", "H", "B", "H",
			"D", "J", "C", "J", "A", "J", "D", "F", "A", "F", "B", "J");

var TLI = new Array(	410, 600, 730, 820, 880, 930, 970, 1010, 1040, 1070, 1100,
	    		1120, 1150, 1170, 1200, 1220, 1240, 1260, 1280, 1300, 1320,
                    	1340, 1360, 1380, 1400, 1420, 1440, 1460, 1480, 1500, 1530, 
	    		1550, 1570, 1600, 1630, 1660, 1690, 1730, 1780, 1840, 1920, 2050, 2230);

var objmeasured = new Array("06", "02", "02", "07", "03", "04", "02", "05", "05", "06", 
                            "04", "09", "02", "08", "09", "07", "09", "01", "08", "07",
                            "06", "01", "03", "04", "05", "01", "04", "05", "03", "05", 
                            "09", "03", "06", "01", "04", "05", "01", "04", "01", "08", "07", "08");

var Object1 = new Array(17,21,25,33,36,38);
var Object2 = new Array(1,2,6,12);
var Object3 = new Array(4,22,28,31);
var Object4 = new Array(5,10,23,26,34,37);
var Object5 = new Array(7,8,24,27,29,35);
var Object6 = new Array(0,9,20,32);
var Object7 = new Array(3,15,19,40);
var Object8 = new Array(13,18,39,41);
var Object9 = new Array(11,14,16,30);

var BrowserMinVersionRequired = 4;

var userAns = new Array(trueAns.length);
var qMark = new Array(trueAns.length);
var userName;
var TotalScore;
var Obj1Score;
var Obj2Score;
var Obj3Score;
var Obj4Score;
var Obj5Score;
var Obj6Score;
var Obj7Score;
var Obj8Score;
var Obj9Score;

function avoiderror()
{
var browserVer = parseInt(navigator.appVersion);
	if(browserVer < BrowserMinVersionRequired)
	   {alert("You are running "+navigator.appName+" version "+navigator.appVersion+"\n"+"Version 4.0 or later is needed for the test evaluation to work properly."+"\n"+"Please, upgrade your browser.");}
}


function validateAndSubmit(theForm) 
{
   // Get the browser version and issue a warning,  if old
   var browserVer = parseInt(navigator.appVersion);
   var OKtoContinue = true;

   if(browserVer < BrowserMinVersionRequired)
   {
        alert("You are running an old version of "+navigator.appName + "."+"\n" +
              "Version 4.0 or later is needed for the test evaluation to work properly. "+ "\n"+
              "Please, upgrade your browser.");
        OKtoContinue = false;
   }

   if(OKtoContinue)
   {
       // Initialize all global variables and tables
       initializeTables();

       // First store the user name
       userName = theForm.personname.value;

       // Next, scan the user choices for all test questions 
       for (var j=1 ; j<= trueAns.length; j++)
       {
           var radioName = "Q" + j;
           userAns[j-1] = getRadioValue(theForm, radioName);
       }

       // Next, score the test
       scoreAnswers();
   
       // Finally, report the results
       var scoreWindow=window.open("", "","toolbar=yes,scrollbars=yes");
       reportScoreCard(scoreWindow);
   }
}

// This function returns the value of a test question (Q1, Q2, etc)
// as selected by the user. If no selection is made for this question
// the function returns "NR". 

function getRadioValue(theForm, radioName)
{
        var collection;  
        collection = new Array();
        getRadioCollection(theForm, radioName, collection);
        for (var i = 0; i< collection.length; i++) 
        {   
            if (collection[i].checked)
                return(collection[i].value);
        }	
        return "NR";
}

// This function is used to create an
// array of all radio buttons with the same name, e.g. Q1.
function getRadioCollection(theForm, radioName, collection)
{
        var j = 0;
        for(var i =0; i<theForm.elements.length; i++)
        {
                  if(theForm.elements[i].name == radioName)
                  {
                           collection[j++] = theForm.elements[i];
                  }
        }
}

// Initializes all global variables needed to score the test.
function initializeTables()
{
     for (var i = 0 ; i < trueAns.length; i++){
          qMark[i] = false;
     }     
     TotalScore = 0;
     Obj1Score = 0;
     Obj2Score = 0;
     Obj3Score = 0;
     Obj4Score = 0;
     Obj5Score = 0;
     Obj6Score = 0;
     Obj7Score = 0;
     Obj8Score = 0;
     Obj9Score = 0;
}

// Reports the results to the user in a separate window.
function reportScoreCard(scoreWindow) 
{
       scoreWindow.document.open("text/html","replace");
       scoreWindow.document.write("<head>");
       scoreWindow.document.write("<Title>Your Score Card</Title>");
       scoreWindow.document.write("</head>");
       scoreWindow.document.write("<body>");
       scoreWindow.document.write("<form>");
       scoreWindow.document.write("<center><H3>End-of-Course Biology Examination - Administered Spring 2002</H3><H3> Score report for "+userName+" </H3></center>");
       scoreWindow.document.write("<table  border=0 cellspacing=0 align=\"center\"  >");
       scoreWindow.document.write("<tr><td> Item Number &nbsp  </td><td> &nbsp Objective Measured  &nbsp</td><td> &nbsp Correct Answer </td><td> &nbsp Student's Answer </td></tr>");
       scoreWindow.document.write("<tr><td colspan=4 ><hr></td></tr>");
       for (var j = 1; j<=trueAns.length;j++)
       {
             var color = j%2;                    // Gives the remainder of j divided by 2
             if(color)
             {
                 scoreWindow.document.write("<tr bgcolor=\"white\">");
             }
             else
             {
                 scoreWindow.document.write("<tr bgcolor=\"yellow\">");
             }
             scoreWindow.document.write("<td align=\"center\">"+j+"</td><td align=\"center\">");

             scoreWindow.document.write(objmeasured[j-1]+"</td>");
             scoreWindow.document.write("<td align=\"center\">");

             scoreWindow.document.write(trueAns[j-1]+"</td><td align=\"center\">");      
             if(qMark[j-1])
             { 
                 scoreWindow.document.write("+");
             }
             else
             {
                 scoreWindow.document.write(userAns[j-1]);
             }
             scoreWindow.document.write("</td></tr>");
       }
  
       scoreWindow.document.write("</table>");

       scoreWindow.document.write("<br>");
       
	scoreWindow.document.write("<table><tr><td><b>+</b></td><td> = </td><td>student's answer correct.</td></tr>");
 
	scoreWindow.document.write("<tr><td>NR</td><td> = </td><td>no response, student did not answer.</td></tr></table>");
       scoreWindow.document.write("<br>");

       scoreWindow.document.write("<table><tr><td colspan=4 align=left><b>Your total number of items correct by objective:</b>");
       scoreWindow.document.write("<tr><td valign=top>");

       scoreWindow.document.write("<b>Objective 1:</b></td><td>"); 
       scoreWindow.document.write("The student will demonstrate an understanding of concepts in heredity and biological change over time. </td> ");
       scoreWindow.document.write("<td></td><td valign=top><b>"+Obj1Score+"/"+Object1.length+"</b></td></tr>");
       scoreWindow.document.write("<tr><td valign=top>");

       scoreWindow.document.write("<b>Objective 2:</b></td><td>"); 
       scoreWindow.document.write("The student will demonstrate an understanding of structures and functions in organisms found in living systems. </td> ");
       scoreWindow.document.write("<td></td><td valign=top><b>"+Obj2Score+"/"+Object2.length+"</b></td></tr>");
       scoreWindow.document.write("<tr><td valign=top>");

       scoreWindow.document.write("<b>Objective 3:</b></td><td>"); 
       scoreWindow.document.write("The student will demonstrate an understanding of patterns and processes in living systems. </td> ");
       scoreWindow.document.write("<td></td><td valign=top><b>"+Obj3Score+"/"+Object3.length+"</b></td></tr>");
       scoreWindow.document.write("<tr><td valign=top>");

       scoreWindow.document.write("<b>Objective 4:</b></td><td>"); 
       scoreWindow.document.write("The student will demonstrate an understanding of concepts in ecology. </td> ");
       scoreWindow.document.write("<td></td><td valign=top><b>"+Obj4Score+"/"+Object4.length+"</b></td></tr>");
       scoreWindow.document.write("<tr><td valign=top>");

       scoreWindow.document.write("<b>Objective 5:</b></td><td>"); 
       scoreWindow.document.write("The student will demonstrate the ability to design and conduct biological experiments and activities. </td> ");
       scoreWindow.document.write("<td></td><td valign=top><b>"+Obj5Score+"/"+Object5.length+"</b></td></tr>");
       scoreWindow.document.write("<tr><td valign=top>");

       scoreWindow.document.write("<b>Objective 6:</b></td><td>"); 
       scoreWindow.document.write("The student will demonstrate the use of skills in acquiring and organizing data. </td> ");
       scoreWindow.document.write("<td></td><td valign=top><b>"+Obj6Score+"/"+Object6.length+"</b></td></tr>");
       scoreWindow.document.write("<tr><td valign=top>");

       scoreWindow.document.write("<b>Objective 7:</b></td><td>"); 
       scoreWindow.document.write("The student will demonstrate the ability to interpret and communicate scientific data and/or information. </td> ");
       scoreWindow.document.write("<td></td><td valign=top><b>"+Obj7Score+"/"+Object7.length+"</b></td></tr>");
       scoreWindow.document.write("<tr><td valign=top>");

       scoreWindow.document.write("<b>Objective 8:</b></td><td>"); 
       scoreWindow.document.write("The student will demonstrate skills in drawing logical inferences, predicting outcomes, and forming generalized statements. </td> ");
       scoreWindow.document.write("<td></td><td valign=top><b>"+Obj8Score+"/"+Object8.length+"</b></td></tr>");
       scoreWindow.document.write("<tr><td valign=top>");

       scoreWindow.document.write("<b>Objective 9:</b></td><td>"); 
       scoreWindow.document.write("The student will demonstrate an understanding of the application of science in daily life. </td> ");
       scoreWindow.document.write("<td></td><td valign=top><b>"+Obj9Score+"/"+Object9.length+"</b></td></tr>");
       scoreWindow.document.write("<tr><td valign=top>");
       
       scoreWindow.document.write("<tr><td></td><td></td><td></td><td>____</td></tr>");
       scoreWindow.document.write("<tr><td colspan=2 align=right><b>Total:</b></td><td></td><td><b>"+TotalScore+"/"+trueAns.length+"</b></td></tr>");
       scoreWindow.document.write("</table>");

       scoreWindow.document.write("<br>");       
   //  scoreWindow.document.write("Your total score is"+TotalScore+" out of  "+trueAns.length+" questions.");

       if(TotalScore > 0)
           scoreWindow.document.write("Your total score would correspond to a Scale Score: "+Grade+" - "+TLI[TotalScore]+".");
       else
           scoreWindow.document.write("Your total score would correspond to a Scale Score: "+Grade+" - "+TLI[0]+".");
       scoreWindow.document.write("<br>"); 
       
   //	scoreWindow.document.write("<table><tr><td><b>+</b></td><td> = </td><td>student's answer correct.</td></tr>");
 
   //	scoreWindow.document.write("<tr><td>NR</td><td> = </td><td>no response, student did not answer.</td></tr></table>");

       scoreWindow.document.write("<br>");
       scoreWindow.document.write("<hr>");
       scoreWindow.document.write("<table><tr><td valign=top></td><td>The score on this test is <b>NOT</b> an official end-of-course ");
       scoreWindow.document.write("scale score. Meeting minimum expectations on this test does <b>NOT</b> satisfy ");
       scoreWindow.document.write("the requirements set forth in Texas Education Code, Chapter 39, Subchapter B or the ");
       scoreWindow.document.write("exit level requirements for a high school diploma in Section 39.025.</td></tr></table>");
       scoreWindow.document.write("<hr>");
       scoreWindow.document.write("<table><tr><td valign=top></td><td>");
       scoreWindow.document.write("The results of the online versions of the ");
       scoreWindow.document.write("released end-of-course examinations are intended for personal use only. The Texas Education Agency (TEA) will ");
       scoreWindow.document.write("not collect or use the scores from the online version of the released tests for any purpose. ");
       scoreWindow.document.write("</td></tr></table>");
       scoreWindow.document.write("<hr>");
   //  scoreWindow.document.write("<p> If you have any questions about this test, please contact the <A HREF=\"mailto: studenta@tea.state.tx.us\">Student Assessment Division</A>.<br><br>");
       scoreWindow.document.write("<input type=\"submit\" value=\"Close Score Card\" onClick=\"window.close()\">");
       scoreWindow.document.write("</form>");
       scoreWindow.document.write("</body>");
       scoreWindow.document.close();
}

// Does the actual scoring of the test. Every question is marked as
// true or false. It uses the array of true answers trueAns which must
// be preset. trueAns is set into initializeTables().
// The marks are then used to score the objectives.

function scoreAnswers()
{
       var j = 0;
       for(j=0; j<trueAns.length; j++)
       {
             if(userAns[j] == trueAns[j] ) 
             {
                    qMark[j] = true;
                    TotalScore++;
             }
        }
        for(j=0; j<Object1.length; j++)
        {
             var i = Object1[j];
             if(qMark[i])
             {
                    Obj1Score++;
              }
          }
          for(j=0; j<Object2.length; j++)
         {
             var i = Object2[j];
             if(qMark[i])
             {
                    Obj2Score++;
              }
          }
          for(j=0; j<Object3.length; j++)
         {
             var i = Object3[j];
             if(qMark[i])
             {
                    Obj3Score++;
              }
          }
           for(j=0; j<Object4.length; j++)
         {
             var i = Object4[j];
             if(qMark[i])
             {
                    Obj4Score++;
              }
          }
           for(j=0; j<Object5.length; j++)
         {
             var i = Object5[j];
             if(qMark[i])
             {
                    Obj5Score++;
              }
          }
        for(j=0; j<Object6.length; j++)
        {
             var i = Object6[j];
             if(qMark[i])
             {
                    Obj6Score++;
              }
          }
        for(j=0; j<Object7.length; j++)
        {
             var i = Object7[j];
             if(qMark[i])
             {
                    Obj7Score++;
              }
          }
        for(j=0; j<Object8.length; j++)
        {
             var i = Object8[j];
             if(qMark[i])
             {
                    Obj8Score++;
              }
          }
        for(j=0; j<Object9.length; j++)
        {
             var i = Object9[j];
             if(qMark[i])
             {
                    Obj9Score++;
              }
          }
            
}

//-->
