
<!--
var Grade = "5";
var trueAns = new Array(

"A", 

"J", 

"B", 

"H", 

"B", 

"F", 

"C", 

"H", 

"D", 

"F", 

"C",
"J", 

"A", 

"H", 

"C", 

"J", 

"B", 

"H", 

"C", 

"F", 

"281", 

"G",
"C", 

"G", 

"C", 

"H", 

"C", 

"F", 

"A", 

"G", 

"B", 

"F", 

"B",
"H", 

"B", 

"G", 

"A", 

"H", 

"D", 

"J", 

"B", 

"J", 

"B", 

"H");

var SE = new Array(

"5.7 (A)", 

"5.3 (B)", 

"5.6 (A)", 

"5.14 (A)", 

"5.11 (A)", 

"5.14 (A)", 

"5.11 (B)",
"5.5 (B)", 

"5.5 (A)", 

"5.3 (A)", 

"5.14 (B)", 

"5.10 (A)", 

"5.2 (B)", 

"5.1 (A)",
"5.7 (A)", 

"5.13 (A)", 

"5.16 (A)", 

"5.11 (A)", 

"5.8 (B)", 

"5.13 (B)", 

"5.3 (C)",
"5.14 (B)", 

"5.11 (A)", 

"5.14 (C)", 

"5.12 (A)", 

"5.11 (A)", 

"5.5 (C)", 

"5.12 (B)",
"5.2 (C)", 

"5.7 (B)", 

"5.5 (B)", 

"5.5 (A)", 

"5.1 (B)", 

"5.11 (B)", 

"5.3 (D)",
"5.3 (E)", 

"5.6 (A)", 

"5.2 (A)", 

"5.7 (A)", 

"5.14 (A)", 

"5.8 (A)", 

"5.15 (B)", 

"5.4 (B)", 

"5.9 (A)");

var objmeasured = new Array(

"03", 

"01", 

"02", 

"06", 

"04", 

"06", 

"04", 

"02", 

"02", 

"01", 

"06", 

"04",
"01", 

"01", 

"03", 

"05", 

"06", 

"04", 

"03", 

"05", 

"01", 

"06", 

"04", 

"06",
"05", 

"04", 

"02", 

"05", 

"01", 

"03", 

"02", 

"02", 

"01", 

"04", 

"01", 

"01", 
"02", 

"01", 

"03", 

"06", 

"03", 

"06", 

"01", 

"03");

var Scale = new Array(

"1051", 

"1223", 

"1350", 

"1428", 

"1486", 

"1532", 

"1572", 

"1606", 

"1638", 

"1666",
"1692", 

"1717", 

"1740", 

"1762", 

"1783", 

"1804", 

"1824", 

"1843", 

"1863", 

"1881",
"1900", 

"1918", 

"1937", 

"1955", 

"1978", 

"1992", 

"2011", 

"2037", 

"2049", 

"2069",
"2100", 

"2110", 

"2132", 

"2155", 

"2179", 

"2205", 

"2233", 

"2263", 

"2297", 

"2336", 

"2400", 

"2437", 

"2514", 

"2639", 

"2811");

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

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;

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);

	   userAns[20] = theForm.Q21.value;
           if(userAns[20] == "")
              userAns[20]= "NR";
           if(userAns[20] == " ")
              userAns[20]= "NR";

       }

       // 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;
}

// 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>Grade 5 TAKS Mathematics - Administered April 2004</H3><H3> Score report for "+userName+" </H3></center>");
       scoreWindow.document.write("<table border=0 cellspacing=0 align=\"center\"  >");
       scoreWindow.document.write("<tr><td> Item &nbsp;  </td><td> &nbsp; Objective &nbsp;</td><td>&nbsp;Student &nbsp;</td><td> &nbsp; Correct </td><td> &nbsp; Student's </td></tr>");
       scoreWindow.document.write("<tr><td> Number &nbsp;  </td><td> &nbsp; Measured  &nbsp;</td><td>&nbsp;Expectations&nbsp;</td><td> &nbsp; Answer </td><td> &nbsp; Answer </td></tr>");
       scoreWindow.document.write("<tr><td colspan=5><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><td align=\"center\">");
	     
	     scoreWindow.document.write(SE[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 numbers, operations, and quantitative reasoning.</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 patterns, relationships, and algebraic reasoning.</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 geometry and spatial reasoning. </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 the concepts and uses of measurement. </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 an understanding of probability and statistics. </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 an understanding of the mathematical processes and tools used in problem solving. </td> ");
       scoreWindow.document.write("<td></td><td valign=top><b>"+Obj6Score+"/"+Object6.length+"</b></td></tr>");
       scoreWindow.document.write("<tr><td></td><td></td><td></td><td>____</td></tr>");
       scoreWindow.document.write("<tr><td colspan=2 align=rigth><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 <A HREF=http://www.tea.state.tx.us/student.assessment/scoring/convtables/2004/index.html>Scale Score:</A> "+Scale[TotalScore]+".");
       else
           scoreWindow.document.write("Your total score would correspond to a <A HREF=http://www.tea.state.tx.us/student.assessment/scoring/convtables/2004/index.html>Scale Score:</A> "+Scale[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 TAKS ");
       scoreWindow.document.write("test 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 TAKS tests 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++;
              }
          }
}

//-->

