<!--

/************************************************************************************

PROGRAM = functions.js

LAST BUILD DATE = 20-Jul-2006 Build 1   

AUTHOR  = Gregg MacDonald

COMPANY = Pearson Educational Measurement

BRIEF DESCRIPTION:

This module parses answer data and score key data in the form of two (string)
variables in order to generate the necessary variables to score a test, and
also contains function(s) to score and display a submitted test in a new window.

ASSERTIONS:

"\n" mentioned in these assertions are visible '\' and 'n' characters which,
when interpreted by the javascript interpreter, will be converted to a
carriage return.

- There must be a predefined var called rawAnswerKey which is a string which
  has the following structure:

  1) zero to many lines, each line of text terminated by a \n

  2) one line of text which is a header which contains all of the following 
     words in any order, separated by at least one space, and terminated by a \n:
     "GRADE  LANGUAGE  SUBJECT  NUMBER  RESPONSE  OBJECTIVE  EXPECTATION  DATE"

  3) one or more lines of text, wherein each line contains fields, and each 
     field is lined up with the first letter of the corresponding word in the
     header, and each field contains only one word (excepting the EXPECTATION
     field which has 2), and the size of each field can be no larger than described below.
     Each line of text EXCEPT the last is terminated by a \n

     FIELDS:
           
        Name         Min    Max   Valid Values
        ----         ---    ---   ------------       
        GRADE:        2      5    0K, 01 to 09, 10, 11
        LANGUAGE:     1      3    E (= English), S (= Spanish)
        SUBJECT:      1      5    M (= Math), R (= Reading), W (= Writing),
                                  E (= ELA), N (= Science), T (= Social Studies)
        NUMBER:     (ignored, order of rows read is used instead, from zero)
        RESPONSE:     1      8    (varies)
        OBJECTIVE:    1      4    01 to 10
        EXPECTATION:  1      10   char + period + 1+ chars + space + ( + char + )
                                  (example: "4.13 (B)")
        DATE:       (ignored. For future versions, should be in 7 char mm/yyyy format)

        Note 1: Language + Grade + Subject tell functions.js which text to display to
        the user. If such text does not exist for that combination provided, an alert
        will be displayed to the user, and the words "null" or "undefined" might be
        shown in place of the missing text.

        Note 2: The value for OBJECTIVE must be parseable as an int, as it is used as
        an index into an array within functions.js
		
- There must be a predefined var called rawScoreKey which is a string which
  has the following structure:

  1) one or more of: number1 + space number2, where number1 is 1 or 2 digits, and
     where number2 is 4 digits. 

  2) There must not be any \n in the string.

- The html file which calls a routine in this javascript file for processing must
  meet the following requirements:

  1) Contains a form with at least one input control

  2) Each control to be processed by this javascript file must have a name which 
     starts with Q and a number, and those numbers must be consecutive (starting with 1),
     and be without gaps in the ordering (eg: Q1, Q2, Q3,... Q25, etc.)

  3) Any input control to be processed must have type="radio" or type="text"
  
  4) Text input controls are handled as text.  (for example: "12.0" will match "12.0"
     in the answer key, but not "12")

  5) If the control is a radio button, at least one of the choices (value property) MUST 
     correspond to a question in the relevant RESPONSE field

  6) Before it is possible for the user to submit the form, it must call function 'avoiderror()'

  7) To submit the form for testing, the function 'validateAndSubmit(formName)' must be called,
     where 'formName' is the name of the form
	 
  8) The <body> tag must have an onLoad event that calls the function parseAnswerAndScoreKey()
     (for example: <body onLoad="parseAnswerAndScoreKey()"> )
	 
  9) The first word in the title must correspond to the testing program name (TAKS, SDAA, etc.)	 

- There must be the following line in the html file which calls this javascript file:

     <script language="JavaScript" src="data/functions.js"></script>

  Note: The script tag must be in the <head></head> block. Change the folder name "data" to whichever
  folder that the html file is expecting to find this javascript file in.

OTHER COMMENTS:

- The headline of the score window shown to the user is set to be the same as the main document window

- The link to the score card conversion file near the end of the score window points to a page
  which contains links the various raw score conversion tables.  Originally this link pointed to
  a specific table, but that was text embedded in the original html file.  Because there seems to
  be no specific naming standard for those files, a link to the page containing those files has
  been substituted instead.

- A beneficial side-effect of the reorganization of the code intended to speed up processing means
  that a question which uses a text control does not have to only be Q21, it can be any question.
  Note: this has not been extensively tested

- Language-dependent text has been encapsulated within a function (one per language), loosely
  following an object model. Do not place any language-specific text that is intended to be
  displayed to the user anywhere else in this file, in order to preserve future maintainability.

- If an input control is a text field, and the correct value is a number, then the number as provided
  by the student must exactly match the value in the answer key without any conversion. Thus, if
  the correct answer is "13" and the student enters "13.0" as an answer, the question will be marked
  wrong.

VERSION HISTORY

0.7  - 21Jun06 build 4 - Working Fine
0.8  - 05Jul06 build 1 - Changed method of parsing rawScoreKey.txt to match new score key text file format
0.9  - 06Jul06 build 1 - Changed science, social studies switch to match answer key values
     - 06Jul06 build 2 - Added ",10" to all parseInt statements to override behaviour with values with 
	                       leading 0 failing to convert due to automatic attempted octal conversion
0.91 - 06Jul06 build 3 - Corrected for cases where answer key has "*" as answer fields (skips that row), 
                           and treats "*" or " " in the raw field in score key as comment fields 
						   (skips that row)
0.92 - 07Jul06 build 1 - Added code to handle differences between RPTE and TAKS answer key format

0.93 - 10Jul06 build 1 - Changed initial set of testingProgram so that there is no default (throws alert)
                       
0.94 - 20Jul06 build 1 - Fixed bug where reset button wasn't clearing user selections
*************************************************************************************/
var debug = false;   // Set to true to show debugging code, false when deployed
var debugSpanishLanguage = false; // Set to true to show debugging code, false when deployed

var browserMinVersionRequired = 4;

var subject = "";  // derived from document.title

// Set program type and Raw Score Conversion Table URL
var convTableURLRoot = "http://www.tea.state.tx.us/student.assessment/scoring/convtables";  
var convTableYear = "2006";  // SET YEAR HERE
var testingProgram = null;
var convTableURLPath = null;


if (document.title.indexOf("TAKS") != -1)  
{
	testingProgram = "TAKS";
	convTableURLPath = "/" + convTableYear + "/index.html";  
}
else if (document.title.indexOf("RPTE") != -1)  
{
	testingProgram = "RPTE";
	convTableURLPath = "/" + convTableYear + "/rpte/index.html"; 
}
else if (document.title.indexOf("SDAA") != -1)  
{
	testingProgram = "SDAA";
	convTableURLPath = "/" + convTableYear + "/sdaa/sprsdaa" + convTableYear.slice(2,3) + ".html"; 
}
else
{
	alert("ERROR: The program type is unknown. This test cannot be scored. Please notify your webmaster.");
	testingProgram = null;
}

var convTableURL = convTableURLRoot + convTableURLPath;  

var grade;           
var trueAns = new Array();
var studentExpectations = new Array();
var objMeasured = new Array(); 
var Scale = new Array();
var highestObjective = 1;  // there's at least 1 objective
var listOfQuestionsForObjective = new Array();

// these values below are derived from the above extracted values
var userAns;  
var qMark;   
var userName;
var totalScore; 
var objScore = new Array();
var text;  // this will become an object that has all the language-specific text


function avoiderror()
{
    var browserVer = parseInt(navigator.appVersion, 10);
	
    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.");
    }
}

// convenience function to trim leading and trailing spaces in a string
function trim(s)
{
	var start = 0;
	var end = s.length - 1;

	if (start > end)
	{
		return "";
	}

	do
	{
		if (s.charAt(start) != " ")
		{
			break;
		}
		start++;
	}
	while (start <= end);
	
	if (start > end)
	{
		return "";
	}
	
	do
	{
		if (s.charAt(end) != " ")
		{
			break;
		}
		end--;
	}
	while (start <= end);
	
	if (start > end)
	{
		return "";
	}
    else
	{
		return s.substring(start,end + 1);
	}
}

// converts the rawAnswerKey, rawScoreKey vars into the global vars needed to
// score the test
function parseAnswerAndScoreKey()
{
	parseScoreKey();
	parseAnswerKey();
}

function parseScoreKey()  // Version 0.8
{
	// EXTRACT DATA FROM rawScoreKey.js	
	// Assumes rawScoreKey is a single string, with each visual row on the screen
	//   being its own line, with a CR at the end of each
	
	// convert rawScoreKey to upper-case to make case a non-issue when searching,
	// and split rawScoreKey into its component lines
	rawScoreKey = rawScoreKey.toUpperCase();
	var scoreKeyRows = rawScoreKey.split("\n");
	

    // find the row that contains the word "rounded"
  	var rowIndex = -1;
	var index = 0;
	var value = 0;

	do 
	{
		rowIndex++;
	}
	while ((rowIndex < scoreKeyRows.length) && (scoreKeyRows[rowIndex].indexOf("ROUNDED") == -1));

	
	// ok, so "rounded" (and the rest of the legend) is in scoreKeyRows[i]
	// let's find out the order of the columns
	var valuePosition = scoreKeyRows[rowIndex].indexOf("ROUNDED");	
	var rawPosition = scoreKeyRows[rowIndex].indexOf("RAW"); // only used to determine if row is to be skipped
	var raw = "";
	var skippedRowsAfterHeader = 0;
	
	rowIndex++;
	var indexOffset = rowIndex;

	do
	{
		value = parseInt(trim(scoreKeyRows[rowIndex].substring(valuePosition, valuePosition + 6)),10); 
		raw = trim(scoreKeyRows[rowIndex].substring(rawPosition, rawPosition + 4));

		if (raw.length > 0 && raw.charAt(0) != "*")  // skip row when blank or * in raw field
		{
			
			Scale[rowIndex - indexOffset - skippedRowsAfterHeader] = value;
		}
		else
		{
			skippedRowsAfterHeader++;
		}
		rowIndex++;
		
	}
    while (rowIndex < scoreKeyRows.length);
	
	if (debug)
	{
		var s = "SCALE VALUES\n\n";
		for (var x = 0; x < Scale.length; x++)
		{
			s = s + "[" + x + "] = [" + Scale[x] + "]\n";
		}
		alert(s);
	}
}


function parseAnswerKey()
{
	// EXTRACT DATA FROM rawAnswerKey.js
	// Assumes rawAnswerKey is a single string, with each visual row on the screen
	//   being its own line, with a CR at the end of each
	
	// convert rawAnswerKey to upper-case to make case a non-issue when searching,
	// and split rawAnswerKey into its component lines
	rawAnswerKey = rawAnswerKey.toUpperCase();
	var answerKeyRows = rawAnswerKey.split("\n");
	


    // find the row that contains the word "response"
  	var rowIndex = -1;
	
	do 
	{
		rowIndex++;
	}
	while ((rowIndex < answerKeyRows.length) && (answerKeyRows[rowIndex].indexOf("RESPONSE") == -1));

	
	// ok, so "response" (and the rest of the legend) is in answerKeyRows[i]
	// let's find out the order of the columns
	
	var gradePosition = answerKeyRows[rowIndex].indexOf("GRADE");
	var languagePosition = answerKeyRows[rowIndex].indexOf("LANGUAGE");
	var subjectPosition = answerKeyRows[rowIndex].indexOf("SUBJECT");
	var numberPosition = answerKeyRows[rowIndex].indexOf("NUMBER");
	var responsePosition = answerKeyRows[rowIndex].indexOf("RESPONSE");
	var objectivePosition = answerKeyRows[rowIndex].indexOf("OBJECTIVE");
	var expectationPosition = answerKeyRows[rowIndex].indexOf("EXPECTATION");
	var datePosition = answerKeyRows[rowIndex].indexOf("DATE");


	var response = "";
	var objective = "";
	var stuExp = "";
    var startOfDataIndex = rowIndex + 1;

	// set the grade	
	grade = trim(answerKeyRows[startOfDataIndex].substring(gradePosition, gradePosition + 5)); 
	if (grade.charAt(0) == "0")
	{
		grade = grade.substring(1, grade.length);
	}

	// set the subject
	subject = trim(answerKeyRows[startOfDataIndex].substring(subjectPosition, subjectPosition + 5));

	// set language
	var language = trim(answerKeyRows[startOfDataIndex].substring(languagePosition, languagePosition + 3)); 
	if (language == "S")
	{
		text = new Spanish(subject, grade, testingProgram);
	}
	else if (language == "E")
	{
		text = new English(subject, grade, testingProgram);
	}
	else if (testingProgram == "RPTE" && language == "R")
	{
		text = new English("R", grade, testingProgram);  // RPTE is always R (reading) because that code is not present in the answer key
	}
	else  // english is default. Note: is "E" in 2006 TAKS and "R" in 2006 RPTE
	{
		text = new English(subject, grade, testingProgram);
	}	
	if (debugSpanishLanguage)
	{
		text = new Spanish(subject, grade, testingProgram);  // overrides value found in rawAnswerKey.js
	}
	if (debug)
	{
		alert("SCALARS\n\ngrade = [" + grade + "]\nlanguage = [" + language + "]\nsubject = [" + subject + "]\n");
	}
        // ok, now let's extract trueAns, objective, and studentExpectations
    do
	{   // up to -9999 to 99999, ZZZZZ is valid. Blank and "*" is not (means skip this row)
		response = trim(answerKeyRows[startOfDataIndex].substring(responsePosition, responsePosition + 8)); 
		if (response.length > 0 && response != "*")
		{
			trueAns.push(response);
		
			//allows for up to 10 chars
			stuExp =  trim(answerKeyRows[startOfDataIndex].substring(expectationPosition, expectationPosition + 10));   
			studentExpectations.push(stuExp);
		
			objective = parseInt(answerKeyRows[startOfDataIndex].substring(objectivePosition, objectivePosition + 4),10); 
			objMeasured.push(objective);
			if (objective > highestObjective)
			{
				highestObjective = objective;
			}
		}
		startOfDataIndex++;
	}
    while (startOfDataIndex < answerKeyRows.length);
	
	// now let's generate listOfQuestionsForObjective1 through listOfQuestionsForObjective6
	for (var i = 1; i <= highestObjective; i++)
	{
		listOfQuestionsForObjective[i] = new Array();
	}
	
	for (var i = 0; i < trueAns.length; i++)
	{
		/* This is equivalent to:
	  	     if      (objMeasured[i] == 1)  listOfQuestionsForObjective[1].push(i);
		     else if (objMeasured[i] == 2)  listOfQuestionsForObjective[2].push(i);
		     else if (objMeasured[i] == 3)  listOfQuestionsForObjective[3].push(i);
		           (etc.)                      (etc.)                    (etc.)
		     else    (objMeasured[i] == n)  listOfQuestionsForObjective[n].push(i);
		  Where 'n' is the highest possible objective number
		
		  Alternately described, there is a list of objectives associated with each question, so if there
		  are 42 questions, the list will have 42 elements, each with a value that's one of the possible
		  objective numbers.  (ie: if there's 5 objectives, the value will be 1,2,3,4 or 5).  We call that
		  list 'objMeasured', and the value at index 'i' within 'objMeasured' is 'objMeasured[i]'.
			
		  We also have an array called 'listOfQuestionsForObjective' which contains an element for each
		  possible objective (so if there's 5 objectives, the index can be 1,2,3,4 or 5). Each of those
		  elements starts as an empty array. (see previous For block) and is intended to have a list of
		  questions numbers that correspond to that array element.
		  
		  We take objMeasured[i] and use it as an index into listOfQuestionsForObjective. Then we append
		  'i' to the array we're referencing, and this makes sense because i is the number of the question.
		  		  
		 */ 
		  listOfQuestionsForObjective[objMeasured[i]].push(i);
	}
	
	if (debug)
	{
		var s = "ARRAYS\n";
		for (var x = 0; x < trueAns.length; x++) 
		{ 
	    	s = s + "\n" + "[" + x + "] = \"" + trueAns[x] +"\" , \"" + studentExpectations[x] + "\"    \"" + objMeasured[x] + "\""; 
    	} 
		s += "\n\n";
		for (var i = 1; i <= 6; i++)
		{
			s+= "\nlistOfQuestionsForObjective[" + i + "] = ";
			for (var x = 0; x < listOfQuestionsForObjective[i].length; x++)
			{
				s+= listOfQuestionsForObjective[i][x] + ",";
			}
		}

		alert(s);  // note: will not remove the final comma on each line
	}
	
}

function validateAndSubmit(theForm) 
{
   // Get the browser version and issue a warning,  if old
   var browserVer = parseInt(navigator.appVersion,10);
   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 
	   initializeGetValue = true;
       for (var j=1 ; j<= trueAns.length; j++)
       {
           var controlName = "Q" + j;
           userAns[j-1] = getValue(theForm, controlName);
       }

       // Next, score the test
       scoreAnswers();
   
       // Finally, report the results
	   if (testingProgram != null)
	   {
          var scoreWindow=window.open("", "","toolbar=yes,scrollbars=yes");
          reportScoreCard(scoreWindow);
	   }
	   else
	   {
	      alert("ERROR: The program type is unknown. This test cannot be scored. Please notify your webmaster.");
	   }
   }
}



// Initializes all global variables needed to score the test.
function initializeTables()
{
	 userAns = new Array(trueAns.length);
     qMark = new Array(trueAns.length);
     
	 for (var i = 0 ; i < trueAns.length; i++)
	 {
         qMark[i] = false;
     }     
     totalScore = 0;
	 for (var i = 1; i < listOfQuestionsForObjective.length; i++)  // size (listOfQuestionsForObjective.length) so can do objScore[6]
	 	objScore[i] = 0;
}


// Resets all answers  
function doReset()
{
	initializeTables();
	initializeGetValue = true;
    answerControls = new Array();
}

// This function returns the value of a test question (Q1, Q2, etc)
// as selected by the user. If the student didn't select an answer,
// the function returns "NR".  Questions must be in order.

var initializeGetValue = true;
var answerControls = new Array();
var NORESPONSE = "NR";  // constant value that represents "no response" 

function getValue(theForm, questionName)
{	
	// if it's the first time this function is called, builds a collection that
	// contains the answers from the form. All questions must have a name starting with 'Q'
	if (initializeGetValue == true)
	{
		var j = -1;
        var lastQNumber = 0;
		var currentQNumber;  // used to detect out of order questions
		var questionsOutOfOrder = -1  // used to detect out of order questions
		
		for (var i=0; i<theForm.elements.length; i++)
		{  
			if (theForm.elements[i].name.charAt(0) == "Q")
			{
				currentQNumber = parseInt(theForm.elements[i].name.substring(1,theForm.elements[i].name.length),10)
				// this if-else block is used to detect out of order questions
				// Note: is '>' not '>=' because with radio buttons there will be a sequence of questions with
				// the same index
				if (((lastQNumber > currentQNumber) || (currentQNumber - lastQNumber > 1)) && (questionsOutOfOrder == -1))
				{
					questionsOutOfOrder = lastQNumber;
				}
				else
				{
					lastQNumber = currentQNumber;
				}
				if ((theForm.elements[i].type == "radio") && (theForm.elements[i].checked))
				{
					j++;
					answerControls[j] = new Array();
					answerControls[j]["name"] = theForm.elements[i].name;
					answerControls[j]["value"] = theForm.elements[i].value;
				}
				else if (theForm.elements[i].type == "text")
				{
					j++;
					answerControls[j] = new Array();
					answerControls[j]["name"] = theForm.elements[i].name;
					if (theForm.elements[i].value != "")
					{
						answerControls[j]["value"] = trim(theForm.elements[i].value);  
						
					}
					else
						answerControls[j]["value"] = NORESPONSE;
				}
			}
		}
		if (questionsOutOfOrder != -1)  // this block is used to detect out of order questions
		{
			alert("WARNING!  The questions are out of order starting after Question Q" + questionsOutOfOrder + "!\n\n"
				 + "If this test has been deployed, the scoring may be incorrect!");
		}
		initializeGetValue = false;
	}
	
	for (var i = 0; i < answerControls.length; i++)
	{
		if (answerControls[i]["name"] == questionName)
		{
			return answerControls[i]["value"];
		}
	}
	return NORESPONSE;   // the question with the name indicated was not answered by the student
}

// 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 in initializeTables(), and the qMark
// array is then used to score the objectives.

function scoreAnswers()
{
    for(var i=0; i<trueAns.length; i++)
    {
        if(userAns[i] == trueAns[i] ) 
        {
            qMark[i] = true;
            totalScore++;
        }
    }
	for (var i=1; i < objScore.length; i++) 
	{
        for(var j=0; j<listOfQuestionsForObjective[i].length; j++)
        {
         	var k = listOfQuestionsForObjective[i][j];
           	if(qMark[k])
           	{	
                objScore[i]++;
          	}
        }
	}
}




// Reports the results to the user in a separate window.
function reportScoreCard(scoreWindow) 
{
      var output = "";
	   
      output += "<head>"
             +  "<title>"+text.scoreCardTitle+"</title>"
             +  "</head>"
             +  "<body>"
             +  "<form>"
             +  "<center><H3>"+document.title+"</H3><H3> "+text.prefixName+" "+userName+" </H3></center>"
             +  "<table border=0 cellspacing=0 align=\"center\">"
	         +  "<tr><td>&nbsp;"+text.headerItemNum1+"&nbsp;</td><td>&nbsp;"
	         +  text.headerObjective1+"&nbsp;</td><td>&nbsp;"
	         +  text.headerStudentExpectation1+"&nbsp;</td><td>&nbsp;"
	         +  text.headerCorrectAnswer1+"&nbsp;</td><td>&nbsp;"
	         +  text.headerStudentAnswer1+"&nbsp;&nbsp;</td></tr>"
	         +  "<tr><td>&nbsp;"+text.headerItemNum2+"&nbsp;</td><td>&nbsp;"
	         +  text.headerObjective2+"&nbsp;</td><td>&nbsp;"
	         +  text.headerStudentExpectation2+"&nbsp;</td><td>&nbsp;"
	         +  text.headerCorrectAnswer2+"&nbsp;</td><td>&nbsp;"
	         +  text.headerStudentAnswer2+"&nbsp;</td></tr>"						 
             +  "<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)
             {
                 output += "<tr bgcolor=\"white\">";
             }
             else
             {
                 output += "<tr bgcolor=\"yellow\">";
             }
             output += "<td align=\"center\">"+j+"</td><td align=\"center\">"
                    + objMeasured[j-1]+"</td><td align=\"center\">"
	                + studentExpectations[j-1]+"</td>"
                    + "<td align=\"center\">"
                    + trueAns[j-1]+"</td><td align=\"center\">";      
             if(qMark[j-1])
             { 
                 output += "+";
             }
             else
             {
                 output += userAns[j-1];
             }
             output += "</td></tr>";
       }
  
       output += "</table>"
              + "<br>"
              + "<table><tr><td><b>+</b></td><td> = </td><td>"+text.footerIsCorrect+"</td></tr>"
              + "<tr><td>NR</td><td> = </td><td>"+text.footerIsNotCorrect+"</td></tr></table>"
              + "<br>"
              + "<table><tr><td colspan=4 align=left><b>"+text.titleObjectives+"</b>";
		
       // here we display the results for each objective. If an objective is not being tested, it won't show up
       for (var i = 1; i <= highestObjective; i++)	  
       {
           if (listOfQuestionsForObjective[i].length > 0)  
   	       {
              output += "<tr><td valign=top>"+ "<b>"+text.objectivePrefix+" "+i+":</b></td>"
   		            +  "<td>"+text.objective[i]+"</td> "
       		        +  "<td></td>"
		            +  "<td valign=top><b>"+objScore[i]+"/"+listOfQuestionsForObjective[i].length+"</b></td></tr>"; 
	       }
       }
       output += "<tr><td></td><td></td><td></td><td>____</td></tr>"
              +  "<tr><td colspan=2 align=right><b>Total:</b></td><td></td><td><b>"+totalScore+"/"+trueAns.length+"</b></td></tr>"
              +  "</table>"
              +  "<br>";

  
       output += text.scaleScore1 + " " + totalScore + " " 
	          +  text.scaleScore2 + " " + trueAns.length + " " + text.scaleScore3 
	          + "<br><br>"
	          +  text.scaleScore4 + " " 
	          +  Scale[totalScore]+ "." +  "<br>" 
              +  "<hr>"
    	      +  text.scaleScore5 + ": " 
	          +  "<a href=\"" + convTableURL + "\">" 
			  +  convTableURL
			  +  "</a><br>"
              +  "<hr>"
  	          +  text.scoreDisclaimer1
	          +  " <strong>"
	          +  text.notInCaps
	          +  "</strong> "
	          +  text.scoreDisclaimer2
	          +  " " + testingProgram + " "
	          +  text.scoreDisclaimer3	
              +  "<hr>"
	          +  text.scoreDisclaimer4	
	          +  " " + testingProgram + " "		
	          +  text.scoreDisclaimer5			  
              +  "<hr>";
 //    output += "<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>"
       output += "<input type=\"submit\" value=\"Close Score Card\" onClick=\"window.close()\">"
              +  "</form>"
              +  "</body>";

       scoreWindow.document.open("text/html","replace");
       scoreWindow.document.write(output);
       scoreWindow.document.close();
}

/**** LANGUAGE-SPECIFIC TEXT STARTS HERE ******************************/
// This is the english text. 
// ALL English-language specific text in this file goes here
//
function English(subject, grade, program)
{
	this.subject = subject;
	this.grade = grade;
	this.program = program;
	
	this.unknownSubjectGrade = false;
	//this.languageCode = "E";
	this.scoreCardTitle = "Your Score Card";
	this.administered = "Administered";
	this.prefixName = "Score report for";
	this.headerItemNum1 = "Item";
	this.headerItemNum2 = "Number";
	this.headerObjective1 = "Objective";
	this.headerObjective2 = "Measured";	
	this.headerStudentExpectation1 = "Student";
	this.headerStudentExpectation2 = "Expectations";	
	this.headerCorrectAnswer1 = "Correct";
	this.headerCorrectAnswer2 = "Answer";	
	this.headerStudentAnswer1 = "Student's";
	this.headerStudentAnswer2 = "Answer";	
	this.footerIsCorrect = "student's answer correct";
	this.footerIsNotCorrect = "no response, student did not answer";
	this.titleObjectives = "Your total number of items correct by objective:";
    this.objectivePrefix = "Objective";
	this.objective = new Array();

	// while it's poor style visually, the assignments in this function are to the left of the page in order
	// to make it easier to enter or modify.
	switch (this.subject)
	{
		case "M":  // Math
			switch(this.grade)
			{
				case "K":
this.objective[1] = "The student will demonstrate an understanding of numbers, operations, and quantitative reasoning.";
this.objective[2] = "The student will demonstrate an understanding of patterns, relationships, and algebraic reasoning.";
this.objective[3] = "The student will demonstrate an understanding of geometry and spatial reasoning.";
this.objective[4] = "The student will demonstrate an understanding of the concepts and uses of measurement.";
this.objective[5] = "The student will demonstrate an understanding of probability and statistics.";
				break;				
				case "1":
this.objective[1] = "The student will demonstrate an understanding of numbers, operations, and quantitative reasoning.";
this.objective[2] = "The student will demonstrate an understanding of patterns, relationships, and algebraic reasoning.";
this.objective[3] = "The student will demonstrate an understanding of geometry and spatial reasoning.";
this.objective[4] = "The student will demonstrate an understanding of the concepts and uses of measurement.";
this.objective[5] = "The student will demonstrate an understanding of probability and statistics.";
				break;
				case "2":
this.objective[1] = "The student will demonstrate an understanding of numbers, operations, and quantitative reasoning.";
this.objective[2] = "The student will demonstrate an understanding of patterns, relationships, and algebraic reasoning.";
this.objective[3] = "The student will demonstrate an understanding of geometry and spatial reasoning.";
this.objective[4] = "The student will demonstrate an understanding of the concepts and uses of measurement.";
this.objective[5] = "The student will demonstrate an understanding of probability and statistics.";
this.objective[6] = "The student will demonstrate an understanding of the mathematical processes and tools used in problem solving.";
				break;				
				case "3":   
this.objective[1] = "The student will demonstrate an understanding of numbers, operations, and quantitative reasoning.";
this.objective[2] = "The student will demonstrate an understanding of patterns, relationships, and algebraic reasoning.";
this.objective[3] = "The student will demonstrate an understanding of geometry and spatial reasoning.";
this.objective[4] = "The student will demonstrate an understanding of the concepts and uses of measurement.";
this.objective[5] = "The student will demonstrate an understanding of probability and statistics.";
this.objective[6] = "The student will demonstrate an understanding of the mathematical processes and tools used in problem solving.";
				break;
				case "4":
this.objective[1] = "The student will demonstrate an understanding of numbers, operations, and quantitative reasoning.";
this.objective[2] = "The student will demonstrate an understanding of patterns, relationships, and algebraic reasoning.";
this.objective[3] = "The student will demonstrate an understanding of geometry and spatial reasoning.";
this.objective[4] = "The student will demonstrate an understanding of the concepts and uses of measurement.";
this.objective[5] = "The student will demonstrate an understanding of probability and statistics.";
this.objective[6] = "The student will demonstrate an understanding of the mathematical processes and tools used in problem solving.";
				break;				
				case "5":
this.objective[1] = "The student will demonstrate an understanding of numbers, operations, and quantitative reasoning.";
this.objective[2] = "The student will demonstrate an understanding of patterns, relationships, and algebraic reasoning.";
this.objective[3] = "The student will demonstrate an understanding of geometry and spatial reasoning.";
this.objective[4] = "The student will demonstrate an understanding of the concepts and uses of measurement.";
this.objective[5] = "The student will demonstrate an understanding of probability and statistics.";
this.objective[6] = "The student will demonstrate an understanding of the mathematical processes and tools used in problem solving.";
				break;				
				case "6":
this.objective[1] = "The student will demonstrate an understanding of numbers, operations, and quantitative reasoning.";
this.objective[2] = "The student will demonstrate an understanding of patterns, relationships, and algebraic reasoning.";
this.objective[3] = "The student will demonstrate an understanding of geometry and spatial reasoning.";
this.objective[4] = "The student will demonstrate an understanding of the concepts and uses of measurement.";
this.objective[5] = "The student will demonstrate an understanding of probability and statistics.";
this.objective[6] = "The student will demonstrate an understanding of the mathematical processes and tools used in problem solving.";
				break;				
				case "7":
this.objective[1] = "The student will demonstrate an understanding of numbers, operations, and quantitative reasoning.";
this.objective[2] = "The student will demonstrate an understanding of patterns, relationships, and algebraic reasoning.";
this.objective[3] = "The student will demonstrate an understanding of geometry and spatial reasoning.";
this.objective[4] = "The student will demonstrate an understanding of the concepts and uses of measurement.";
this.objective[5] = "The student will demonstrate an understanding of probability and statistics.";
this.objective[6] = "The student will demonstrate an understanding of the mathematical processes and tools used in problem solving.";
				break;				
				case "8":
this.objective[1] = "The student will demonstrate an understanding of numbers, operations, and quantitative reasoning.";
this.objective[2] = "The student will demonstrate an understanding of patterns, relationships, and algebraic reasoning.";
this.objective[3] = "The student will demonstrate an understanding of geometry and spatial reasoning.";
this.objective[4] = "The student will demonstrate an understanding of the concepts and uses of measurement.";
this.objective[5] = "The student will demonstrate an understanding of probability and statistics.";
this.objective[6] = "The student will demonstrate an understanding of the mathematical processes and tools used in problem solving.";
				break;
				case "9":
this.objective[1] = "The student will describe functional relationships in a variety of ways.";
this.objective[2] = "The student will demonstrate an understanding of the properties and attributes of functions.";
this.objective[3] = "The student will demonstrate an understanding of linear functions.";
this.objective[4] = "The student will formulate and use linear equations and inequalities.";
this.objective[5] = "The student will demonstrate an understanding of quadratic and other nonlinear functions.";
this.objective[6] = "The student will demonstrate an understanding of geometric relationships and spatial reasoning.";
this.objective[7] = "The student will demonstrate an understanding of two- and three-dimensional representations of geometric relationships and shapes.";
this.objective[8] = "The student will demonstrate an understanding of the concepts and uses of measurement and similarity.";
this.objective[9] = "The student will demonstrate an understanding of percents, proportional relationships, probability, and statistics in application problems involving percents and proportional relationships such as similarity and rates.";
this.objective[10] = "The student will demonstrate an understanding of the mathematical processes and tools used in problem solving.";
				break;				
				case "10":   
this.objective[1] = "The student will describe functional relationships in a variety of ways.";
this.objective[2] = "The student will demonstrate an understanding of the properties and attributes of functions.";
this.objective[3] = "The student will demonstrate an understanding of linear functions.";
this.objective[4] = "The student will formulate and use linear equations and inequalities.";
this.objective[5] = "The student will demonstrate an understanding of quadratic and other nonlinear functions.";
this.objective[6] = "The student will demonstrate an understanding of geometric relationships and spatial reasoning.";
this.objective[7] = "The student will demonstrate an understanding of two- and three-dimensional representations of geometric relationships and shapes.";
this.objective[8] = "The student will demonstrate an understanding of the concepts and uses of measurement and similarity.";
this.objective[9] = "The student will demonstrate an understanding of percents, proportional relationships, probability, and statistics in application problems involving percents and proportional relationships such as similarity and rates.";
this.objective[10] = "The student will demonstrate an understanding of the mathematical processes and tools used in problem solving.";
				break;
				case "11":
this.objective[1] = "The student will describe functional relationships in a variety of ways.";
this.objective[2] = "The student will demonstrate an understanding of the properties and attributes of functions.";
this.objective[3] = "The student will demonstrate an understanding of linear functions.";
this.objective[4] = "The student will formulate and use linear equations and inequalities.";
this.objective[5] = "The student will demonstrate an understanding of quadratic and other nonlinear functions.";
this.objective[6] = "The student will demonstrate an understanding of geometric relationships and spatial reasoning.";
this.objective[7] = "The student will demonstrate an understanding of two- and three-dimensional representations of geometric relationships and shapes.";
this.objective[8] = "The student will demonstrate an understanding of the concepts and uses of measurement and similarity.";
this.objective[9] = "The student will demonstrate an understanding of percents, proportional relationships, probability, and statistics in application problems.";
this.objective[10] = "The student will demonstrate an understanding of the mathematical processes and tools used in problem solving.";
				break;
				default:
				   unknownSubjectGrade = true;
			}
		break;
		case "R": // Reading
			switch(this.grade)
			{
				case "K":   
this.objective[1] = "The student will identify specific sounds within spoken words.";
this.objective[2] = "The student will use a variety of strategies to decode written language.";
this.objective[3] = "The student will demonstrate an understanding of important words, details, events, and ideas in orally presented texts.";
				break;				
				case "1":  
this.objective[1] = "The student will identify specific sounds within spoken words.";
this.objective[2] = "The student will use a variety of strategies to decode written language.";
this.objective[3] = "The student will demonstrate an understanding of important words, details, events, and ideas in orally presented texts.";
this.objective[4] = "The student will demonstrate an understanding of important words, details, events, and ideas in a variety of written texts.";				
				break;
				case "2":  
this.objective[1] = "The student will demonstrate a basic understanding of culturally diverse written texts.";
this.objective[2] = "The student will apply knowledge of literary elements to understand culturally diverse written texts.";
this.objective[3] = "The student will use a variety of strategies to analyze culturally diverse written texts.";
this.objective[4] = "The student will apply critical-thinking skills to analyze culturally diverse written texts.";	
				break;
				case "3":
					if (testingProgram == "RPTE")  
					{
this.objective[1] = "The student will decode and/or determine the meaning of words in a variety of written texts.";
this.objective[2] = "The student will identify supporting ideas in a variety of written texts.";
this.objective[3] = "The student will summarize a variety of written texts.";
this.objective[4] = "The student will analyze and evaluate ideas and information in a variety of written texts.";
					}
					else   
					{
this.objective[1] = "The student will demonstrate a basic understanding of culturally diverse written texts.";
this.objective[2] = "The student will apply knowledge of literary elements to understand culturally diverse written texts.";
this.objective[3] = "The student will use a variety of strategies to analyze culturally diverse written texts.";
this.objective[4] = "The student will apply critical-thinking skills to analyze culturally diverse written texts.";	
					}
				break;
				case "4":
					if (testingProgram == "RPTE")  
					{
this.objective[1] = "The student will decode and/or determine the meaning of words in a variety of written texts.";
this.objective[2] = "The student will identify supporting ideas in a variety of written texts.";
this.objective[3] = "The student will summarize a variety of written texts.";
this.objective[4] = "The student will analyze and evaluate ideas and information in a variety of written texts.";
					}	
					else   
					{
this.objective[1] = "The student will demonstrate a basic understanding of culturally diverse written texts.";
this.objective[2] = "The student will apply knowledge of literary elements to understand culturally diverse written texts.";
this.objective[3] = "The student will use a variety of strategies to analyze culturally diverse written texts.";
this.objective[4] = "The student will apply critical-thinking skills to analyze culturally diverse written texts.";	
					}
				break;					
				case "5":
					if (testingProgram == "RPTE")  
					{
this.objective[1] = "The student will decode and/or determine the meaning of words in a variety of written texts.";
this.objective[2] = "The student will identify supporting ideas in a variety of written texts.";
this.objective[3] = "The student will summarize a variety of written texts.";
this.objective[4] = "The student will analyze and evaluate ideas and information in a variety of written texts.";
					}	
					else   
					{
this.objective[1] = "The student will demonstrate a basic understanding of culturally diverse written texts.";
this.objective[2] = "The student will apply knowledge of literary elements to understand culturally diverse written texts.";
this.objective[3] = "The student will use a variety of strategies to analyze culturally diverse written texts.";
this.objective[4] = "The student will apply critical-thinking skills to analyze culturally diverse written texts.";	
					}
				break;	
				case "6":   
					if (testingProgram == "RPTE")  
					{
this.objective[1] = "The student will decode and/or determine the meaning of words in a variety of written texts.";
this.objective[2] = "The student will identify supporting ideas in a variety of written texts.";
this.objective[3] = "The student will summarize a variety of written texts.";
this.objective[4] = "The student will analyze and evaluate ideas and information in a variety of written texts.";
					}	
					else   
					{
this.objective[1] = "The student will demonstrate a basic understanding of culturally diverse written texts.";
this.objective[2] = "The student will apply knowledge of literary elements to understand culturally diverse written texts.";
this.objective[3] = "The student will use a variety of strategies to analyze culturally diverse written texts.";
this.objective[4] = "The student will apply critical-thinking skills to analyze culturally diverse written texts.";	
					}
				break;
				case "7":
					if (testingProgram == "RPTE")  
					{
this.objective[1] = "The student will decode and/or determine the meaning of words in a variety of written texts.";
this.objective[2] = "The student will identify supporting ideas in a variety of written texts.";
this.objective[3] = "The student will summarize a variety of written texts.";
this.objective[4] = "The student will analyze and evaluate ideas and information in a variety of written texts.";
					}	
					else   
					{
this.objective[1] = "The student will demonstrate a basic understanding of culturally diverse written texts.";
this.objective[2] = "The student will apply knowledge of literary elements to understand culturally diverse written texts.";
this.objective[3] = "The student will use a variety of strategies to analyze culturally diverse written texts.";
this.objective[4] = "The student will apply critical-thinking skills to analyze culturally diverse written texts.";	
					}
				break;				
				case "8":
					if (testingProgram == "RPTE")  
					{
this.objective[1] = "The student will decode and/or determine the meaning of words in a variety of written texts.";
this.objective[2] = "The student will identify supporting ideas in a variety of written texts.";
this.objective[3] = "The student will summarize a variety of written texts.";
this.objective[4] = "The student will analyze and evaluate ideas and information in a variety of written texts.";
					}	
					else   
					{				
this.objective[1] = "The student will demonstrate a basic understanding of culturally diverse written texts.";
this.objective[2] = "The student will apply knowledge of literary elements to understand culturally diverse written texts.";
this.objective[3] = "The student will use a variety of strategies to analyze culturally diverse written texts.";
this.objective[4] = "The student will apply critical-thinking skills to analyze culturally diverse written texts.";				
					}
				break;
				case "9":
					if (testingProgram == "RPTE")  
					{
this.objective[1] = "The student will decode and/or determine the meaning of words in a variety of written texts.";
this.objective[2] = "The student will identify supporting ideas in a variety of written texts.";
this.objective[3] = "The student will summarize a variety of written texts.";
this.objective[4] = "The student will analyze and evaluate ideas and information in a variety of written texts.";
					}	
					else   
					{	
this.objective[1] = "The student will demonstrate a basic understanding of culturally diverse written texts.";
this.objective[2] = "The student will demonstrate an understanding of the effects of literary elements and techniques in culturally diverse written texts.";
this.objective[3] = "The student will demonstrate the ability to analyze and critically evaluate culturally diverse written texts and visual representations.";
this.objective[4] = "The student will recognize correct and effective sentence construction in written text.";
this.objective[5] = "The student will recognize standard usage and appropriate word choice in written text.";
this.objective[6] = "The student will demonstrate the ability to revise and proofread to improve the clarity and effectiveness of a piece of writing.";		}		
				break;
					case "10":
					if (testingProgram == "RPTE")  
					{
this.objective[1] = "The student will decode and/or determine the meaning of words in a variety of written texts.";
this.objective[2] = "The student will identify supporting ideas in a variety of written texts.";
this.objective[3] = "The student will summarize a variety of written texts.";
this.objective[4] = "The student will analyze and evaluate ideas and information in a variety of written texts.";
					}		
				break;
					case "11":
					if (testingProgram == "RPTE")  
					{
this.objective[1] = "The student will decode and/or determine the meaning of words in a variety of written texts.";
this.objective[2] = "The student will identify supporting ideas in a variety of written texts.";
this.objective[3] = "The student will summarize a variety of written texts.";
this.objective[4] = "The student will analyze and evaluate ideas and information in a variety of written texts.";
					}	
				break;
					case "12":
					if (testingProgram == "RPTE")  
					{
this.objective[1] = "The student will decode and/or determine the meaning of words in a variety of written texts.";
this.objective[2] = "The student will identify supporting ideas in a variety of written texts.";
this.objective[3] = "The student will summarize a variety of written texts.";
this.objective[4] = "The student will analyze and evaluate ideas and information in a variety of written texts.";
					}	
				break;
				
				default:
				   unknownSubjectGrade = true;		
			}
		break;	
		case "E": // ELA (English Language Arts)
			switch(this.grade)
			{
				case "10":   
this.objective[1] = "The student will demonstrate a basic understanding of culturally diverse written texts.";
this.objective[2] = "The student will demonstrate an understanding of the effects of literary elements and techniques in culturally diverse written texts.";
this.objective[3] = "The student will demonstrate the ability to analyze and critically evaluate culturally diverse written texts and visual representations.";	
this.objective[4] = "The student will, within a given context, produce an effective composition for a specific purpose.";
this.objective[5] = "The student will produce a piece of writing that demonstrates a command of the conventions of spelling, capitalization, punctuation, grammar, usage, and sentence structure.";
this.objective[6] = "The student will demonstrate the ability to revise and proofread to improve the clarity and effectiveness of a piece of writing.";
				break;
				case "11":
this.objective[1] = "The student will demonstrate a basic understanding of culturally diverse written texts.";
this.objective[2] = "The student will demonstrate an understanding of the effects of literary elements and techniques in culturally diverse written texts.";
this.objective[3] = "The student will demonstrate the ability to analyze and critically evaluate culturally diverse written texts and visual representations.";
this.objective[4] = "The student will recognize correct and effective sentence construction in written text.";
this.objective[5] = "The student will recognize standard usage and appropriate word choice in written text.";
this.objective[6] = "The student will demonstrate the ability to revise and proofread to improve the clarity and effectiveness of a piece of writing.";				
				break;
				default:
				   unknownSubjectGrade = true;		
			}
		break;	
		case "W": // Writing
			switch(this.grade)
			{
				case "2":
				// 1-3, unknown text.  If 6 exists, unknown text. 2005 tests run fine as is.
this.objective[4] = "The student will recognize correct and effective sentence construction, standard usage, and appropriate word choice.";
this.objective[5] = "The student will proofread for correct punctuation, capitalization, and spelling in written text.";				
				break;
				case "3":
				// 1-2, unknown text. 2005 tests run fine as is.				
this.objective[3] = "The student will recognize appropriate organization of ideas in written text.";
this.objective[4] = "The student will recognize correct and effective sentence construction in written text.";
this.objective[5] = "The student will recognize standard usage and appropriate word choice in written text.";
this.objective[6] = "The student will proofread for correct punctuation, capitalization, and spelling in written text.";
				break;				
				case "4":
				// 1-2, unknown text. 2005 tests run fine as is.				
this.objective[3] = "The student will recognize appropriate organization of ideas in written text.";
this.objective[4] = "The student will recognize correct and effective sentence construction in written text.";
this.objective[5] = "The student will recognize standard usage and appropriate word choice in written text.";
this.objective[6] = "The student will proofread for correct punctuation, capitalization, and spelling in written text.";
				break;				
				case "5":
				// 1-2, unknown text. 2005 tests run fine as is.				
this.objective[3] = "The student will recognize appropriate organization of ideas in written text.";
this.objective[4] = "The student will recognize correct and effective sentence construction in written text.";
this.objective[5] = "The student will recognize standard usage and appropriate word choice in written text.";
this.objective[6] = "The student will proofread for correct punctuation, capitalization, and spelling in written text.";
				break;				
				case "6":
				// 1-2, unknown text. 2005 tests run fine as is.				
this.objective[3] = "The student will recognize appropriate organization of ideas in written text.";
this.objective[4] = "The student will recognize correct and effective sentence construction in written text.";
this.objective[5] = "The student will recognize standard usage and appropriate word choice in written text.";
this.objective[6] = "The student will proofread for correct punctuation, capitalization, and spelling in written text.";
				break;				
				case "7":
				// 1-2, unknown text. 2005 tests run fine as is.				
this.objective[3] = "The student will recognize appropriate organization of ideas in written text.";
this.objective[4] = "The student will recognize correct and effective sentence construction in written text.";
this.objective[5] = "The student will recognize standard usage and appropriate word choice in written text.";
this.objective[6] = "The student will proofread for correct punctuation, capitalization, and spelling in written text.";
				break;				
				case "8":
				// 1-2, unknown text. 2005 tests run fine as is.				
this.objective[3] = "The student will recognize appropriate organization of ideas in written text.";
this.objective[4] = "The student will recognize correct and effective sentence construction in written text.";
this.objective[5] = "The student will recognize standard usage and appropriate word choice in written text.";
this.objective[6] = "The student will proofread for correct punctuation, capitalization, and spelling in written text.";
				break;				
				case "9":
				// 1-2, unknown text. 2005 tests run fine as is.				
this.objective[3] = "The student will recognize appropriate organization of ideas in written text.";
this.objective[4] = "The student will recognize correct and effective sentence construction in written text.";
this.objective[5] = "The student will recognize standard usage and appropriate word choice in written text.";
this.objective[6] = "The student will proofread for correct punctuation, capitalization, and spelling in written text.";
				break;
				default:
				   unknownSubjectGrade = true;		
			}
		break;	
		case "N": // Science
			switch(this.grade)
			{
				case "5":
this.objective[1] = "The student will demonstrate an understanding of the nature of science.";
this.objective[2] = "The student will demonstrate an understanding of the life sciences.";
this.objective[3] = "The student will demonstrate an understanding of the physical sciences.";
this.objective[4] = "The student will demonstrate an understanding of the Earth sciences.";
				break;
				case "8":  
this.objective[1] = "The student will demonstrate an understanding of the nature of science.";
this.objective[2] = "The student will demonstrate an understanding of living systems and the environment.";
this.objective[3] = "The student will demonstrate an understanding of the structures and properties of matter.";
this.objective[4] = "The student will demonstrate an understanding of motion, forces, and energy.";
this.objective[5] = "The student will demonstrate an understanding of Earth and space systems.";
				break;					
				case "10":  
this.objective[1] = "The student will demonstrate an understanding of the nature of science.";
this.objective[2] = "The student will demonstrate an understanding of the organization of living systems.";
this.objective[3] = "The student will demonstrate an understanding of the interdependence of organisms and the environment.";
this.objective[4] = "The student will demonstrate an understanding of the structures and properties of matter.";
this.objective[5] = "The student will demonstrate an understanding of motion, forces, and energy.";
				break;				
				case "11":
this.objective[1] = "The student will demonstrate an understanding of the nature of science.";
this.objective[2] = "The student will demonstrate an understanding of the organization of living systems.";
this.objective[3] = "The student will demonstrate an understanding of the interdependence of organisms and the environment.";
this.objective[4] = "The student will demonstrate an understanding of the structures and properties of matter.";
this.objective[5] = "The student will demonstrate an understanding of motion, forces, and energy.";
				break;
				default:
				   unknownSubjectGrade = true;		   
			}
        break;
		case "T": // Social Studies
			switch(this.grade)
			{
				case "8":
this.objective[1] = "The student will demonstrate an understanding of issues and events in U.S. history.";
this.objective[2] = "The student will demonstrate an understanding of geographic influences on historical issues and events.";
this.objective[3] = "The student will demonstrate an understanding of economic and social influences on historical issues and events.";
this.objective[4] = "The student will demonstate an understanding of political influences on historical issues and events.";
this.objective[5] = "The student will use critical thinking skills to analyze social studies information.";				
				break;
				case "10":  
this.objective[1] = "The student will demonstrate an understanding of issues and events in U.S. history.";
this.objective[2] = "The student will demonstrate an understanding of geographic influences on historical issues and events.";
this.objective[3] = "The student will demonstrate an understanding of economic and social influences on historical issues and events.";
this.objective[4] = "The student will demonstate an understanding of political influences on historical issues and events.";
this.objective[5] = "The student will use critical thinking skills to analyze social studies information.";				
				break;				
				case "11":
this.objective[1] = "The student will demonstrate an understanding of issues and events in U.S. history.";
this.objective[2] = "The student will demonstrate an understanding of geographic influences on historical issues and events.";
this.objective[3] = "The student will demonstrate an understanding of economic and social influences on historical issues and events.";
this.objective[4] = "The student will demonstate an understanding of political influences on historical issues and events.";
this.objective[5] = "The student will use critical thinking skills to analyze social studies information.";				
				break;
				default:
				   unknownSubjectGrade = true;		
			}
		break;	
	
	}
	if (this.unknownSubjectGrade)
	{
		alert("No objectives text present for this combination of subject & grade!");
		for (var i = 1; i <= 10; i++)
		{
			this.objective[i] = "";
		}		
	}
	this.scaleScore1 = "Your multiple-choice score is" 
	this.scaleScore2 = "out of";
	this.scaleScore3 = "questions."
	this.scaleScore4 = "Your total score would correspond to a Scale Score of: ";
	this.scaleScore5 = "The student's Achievement Level is determined by the total multiple-choice items correct."
	     + " The conversion table used to determine the Achievement Level can be found at";

    this.scoreDisclaimer1 = "The score on this test is";
	this.notInCaps = "NOT";
    this.scoreDisclaimer2 = "an official";
	this.scoreDisclaimer3 = "test score.";
	this.scoreDisclaimer4 = "The results of the online versions of the released"
	this.scoreDisclaimer5 = "tests are intended for personal use only. The Texas Education Agency (TEA) will "
              +  "not collect or use the scores from the online version of the released tests for any purpose."
			  
}

// This is the spanish text. 
// ALL Spanish-specific text in this file goes here
//
function Spanish(subject, grade, program)
{
	this.subject = subject;
	this.grade = grade;	
	this.program = program;
	
	this.unknownSubjectGrade = false;	
	//this.languageCode = "S";
	this.scoreCardTitle = "Your Score Card";  // intentionally in English
	this.administered = "Administered";	// intentionally in English
	this.prefixName = "Reporte de Calificación de";
	this.headerItemNum1 = "Número de";
	this.headerItemNum2 = "Pregunta";	
	this.headerObjective1 = "Objetivo";
	this.headerObjective2 = "Evaluado";	
	this.headerStudentExpectation1 = "Expectativas";
	this.headerStudentExpectation2 = "Académicas";	
	this.headerCorrectAnswer1 = "Respuesta";
	this.headerCorrectAnswer2 = "Correcta";	
	this.headerStudentAnswer1 = "Respuesta del";
	this.headerStudentAnswer2 = "Estudiante";	
	this.footerIsCorrect = "respuesta correcta del estudiante";
	this.footerIsNotCorrect = "el estudiante no respondió";
	this.titleObjectives = "Número total de preguntas correctas por Objetivo:";
        this.objectivePrefix = "Objetivo";
	this.objective = new Array();
    
	// while it's poor style visually, the assignments in this function are to the left of the page in order
	// to make it easier to enter or modify.
	switch (this.subject)
	{
		case "M":  // Math
			switch(this.grade)
			{
				case "3":   
this.objective[1] = "El estudiante demostrará comprensión de números, operaciones y razonamiento cuantitativo.";
this.objective[2] = "El estudiante demostrará comprensión de patrones, relaciones y razonamiento algebraico.";
this.objective[3] = "El estudiante demostrará comprensión de geometría y razonamiento espacial.";
this.objective[4] = "El estudiante demostrará comprensión de los conceptos y usos de la medición.";
this.objective[5] = "El estudiante demostrará comprensión de probabilidad y estadística.";
this.objective[6] = "El estudiante demostrará comprensión de los procesos y recursos utilizados para solucionar problemas matemáticos.";
				break;
				case "4":
this.objective[1] = "El estudiante demostrará comprensión de números, operaciones y razonamiento cuantitativo.";
this.objective[2] = "El estudiante demostrará comprensión de patrones, relaciones y razonamiento algebraico.";
this.objective[3] = "El estudiante demostrará comprensión de geometría y razonamiento espacial.";
this.objective[4] = "El estudiante demostrará comprensión de los conceptos y usos de la medición.";
this.objective[5] = "El estudiante demostrará comprensión de probabilidad y estadística.";
this.objective[6] = "El estudiante demostrará comprensión de los procesos y recursos utilizados para solucionar problemas matemáticos.";
				break;				
				case "5":   
this.objective[1] = "El estudiante demostrará comprensión de números, operaciones y razonamiento cuantitativo.";
this.objective[2] = "El estudiante demostrará comprensión de patrones, relaciones y razonamiento algebraico.";
this.objective[3] = "El estudiante demostrará comprensión de geometría y razonamiento espacial.";
this.objective[4] = "El estudiante demostrará comprensión de los conceptos y usos de la medición.";
this.objective[5] = "El estudiante demostrará comprensión de probabilidad y estadística.";
this.objective[6] = "El estudiante demostrará comprensión de los procesos y recursos utilizados para solucionar problemas matemáticos.";
				break;
				case "6":
this.objective[1] = "El estudiante demostrará comprensión de números, operaciones y razonamiento cuantitativo.";
this.objective[2] = "El estudiante demostrará comprensión de patrones, relaciones y razonamiento algebraico.";
this.objective[3] = "El estudiante demostrará comprensión de geometría y razonamiento espacial.";
this.objective[4] = "El estudiante demostrará comprensión de los conceptos y usos de la medición.";
this.objective[5] = "El estudiante demostrará comprensión de probabilidad y estadística.";
this.objective[6] = "El estudiante demostrará comprensión de los procesos y recursos utilizados para solucionar problemas matemáticos.";
				break;
				default:
				   unknownSubjectGrade = true;				
			}
		break;
		case "R": // Reading
			switch(this.grade)
			{
				case "3":   
this.objective[1] = "El estudiante demostrará comprensión básica de textos escritos que reflejan una diversidad cultural.";
this.objective[2] = "El estudiante aplicará sus conocimientos de elementos literarios para comprender textos escritos que reflejan una diversidad cultural.";
this.objective[3] = "El estudiante usará una variedad de estrategias para analizar textos escritos que reflejan una diversidad cultural. ";
this.objective[4] = "El estudiante aplicará sus destrezas de razonamiento crítico para analizar textos escritos que reflejan una diversidad cultural.";
				break;
				case "4":
this.objective[1] = "El estudiante demostrará comprensión básica de textos escritos que reflejan una diversidad cultural.";
this.objective[2] = "El estudiante aplicará sus conocimientos de elementos literarios para comprender textos escritos que reflejan una diversidad cultural.";
this.objective[3] = "El estudiante usará una variedad de estrategias para analizar textos escritos que reflejan una diversidad cultural.";
this.objective[4] = "El estudiante aplicará sus destrezas de razonamiento crítico para analizar textos escritos que reflejan una diversidad cultural.";				
				break;				
				case "5":   
this.objective[1] = "El estudiante demostrará comprensión básica de textos escritos que reflejan una diversidad cultural.";
this.objective[2] = "El estudiante aplicará sus conocimientos de elementos literarios para comprender textos escritos que reflejan una diversidad cultural.";
this.objective[3] = "El estudiante usará una variedad de estrategias para analizar textos escritos que reflejan una diversidad cultural.";
this.objective[4] = "El estudiante aplicará sus destrezas de razonamiento crítico para analizar textos escritos que reflejan una diversidad cultural.";				
				break;				
				case "6":
this.objective[1] = "El estudiante demostrará comprensión básica de textos escritos que reflejan una diversidad cultural.";
this.objective[2] = "El estudiante aplicará sus conocimientos de elementos literarios para comprender textos escritos que reflejan una diversidad cultural.";
this.objective[3] = "El estudiante usará una variedad de estrategias para analizar textos escritos que reflejan una diversidad cultural.";
this.objective[4] = "El estudiante aplicará sus destrezas de razonamiento crítico para analizar textos escritos que reflejan una diversidad cultural.";				
				break;
				default:
				   unknownSubjectGrade = true;		
			}
		break;	
		case "E": // ELA (English Language Arts)
			switch(this.grade)
			{
				default:
				   unknownSubjectGrade = true;		
			}
		break;	
		case "W": // Writing
			switch(this.grade)
			{
				case "4":
				// 1-2, unknown text. 2004 tests run fine as is.
this.objective[3] = "El estudiante sabrá reconocer la organización apropiada de ideas en textos escritos.";
this.objective[4] = "El estudiante sabrá reconocer construcciones correctas y eficaces de oraciones en textos escritos.";
this.objective[5] = "El estudiante sabrá reconocer el uso estándar del idioma español y la selección apropiada de las palabras en textos escritos.";
this.objective[6] = "El estudiante revisará y corregirá la puntuación, el uso de mayúsculas y la ortografía en textos escritos.";
				break;
				default:
				   unknownSubjectGrade = true;		
			}
		break;	
		case "N": // Science
			switch(this.grade)
			{
				case "5":   
this.objective[1] = "El estudiante demostrará comprensión de los métodos y procesos de las ciencias.";
this.objective[2] = "El estudiante demostrará comprensión de las ciencias biológicas.";
this.objective[3] = "El estudiante demostrará comprensión de física y química.";
this.objective[4] = "El estudiante demostrará comprensión de las ciencias de la Tierra.";				
				break;
				default:
				   unknownSubjectGrade = true;		
			}
		break;	
		case "T": // Social Studies
			switch(this.grade)
			{
				default:
				   unknownSubjectGrade = true;		
			}
		break;	
	}
	if (this.unknownSubjectGrade)
	{
		alert("No objectives text present for this combination of subject & grade!");
		for (var i = 1; i <= 10; i++)
		{
			this.objective[i] = "";
		}		
	}
	this.scaleScore1 = "Your multiple-choice score is"  // intentionally in english   
	this.scaleScore2 = "out of"; // intentionally in english
	this.scaleScore3 = "questions." // intentionally in english
	this.scaleScore4 = "La calificación total correspondería a un Scale Score (Calificación a escala) de:";	
	this.scaleScore5 = "The student's Achievement Level is determined by the total multiple-choice items correct." 
	     + " The conversion table used to determine the Achievement Level can be found at";	 // intentionally in english 
    this.scoreDisclaimer1 = "The score on this test is";  // intentionally in english
	this.notInCaps = "NOT";  // intentionally in english
    this.scoreDisclaimer2 = "an official";  // intentionally in english
	this.scoreDisclaimer3 = "test score.";   // intentionally in english
	this.scoreDisclaimer4 = "The results of the online versions of the released" // intentionally in english
	this.scoreDisclaimer5 = "tests are intended for personal use only. The Texas Education Agency (TEA) will " // intentionally in english
              +  "not collect or use the scores from the online version of the released tests for any purpose."	
}
/*** LANGUAGE-SPECIFIC TEXT SECTION ENDS HERE ***/

//-->

