var QuestionNum = 1;
var ChoiceNum = 1;
var k = 1;
		document.write("<style type=\"text/css\">label:hover{color: #356;}label{font-weight: 200;cursor: pointer;}</style>");
		document.write("<blockquote>&nbsp;</blockquote>");
		document.write("<ol type=\"1\">");
		//for(i = 1;i <= TotalQuestions;i++,QuestionNum++)
		for(i = 1;questions[i]!=undefined;i++,QuestionNum++)
		{
		 document.write("<li style=\"color:black;\"><b>" + questions[i] + "</b></li>");
		 document.write("<ol type=\"A\">");
		 theIndex = Number(String(QuestionNum) + String(ChoiceNum));
		 if(Qtype[i]!="matching")
		 {
  		 for(;choices[theIndex]!=undefined && Qtype[i]!="matching";ChoiceNum++,k++)
  		 {
  		 	theIndex = Number(String(QuestionNum) + String(ChoiceNum));
  			if(choices[theIndex]!=undefined && Qtype[i]!="matching")
  			{
    		 	document.write("<li style=\"color:black\">");
    			if(Qtype[i]=="radio")
					{
					 document.write("<input type=\"radio\" id=\"radio" + k + "\" name=\"radio" + i + "\" value=\"" + theIndex + "\" onClick=\"mult(" + theIndex + ",this);\" >");
					 document.write("<label for=\"radio" + k + "\">" +choices[theIndex] + "</label>");
					}
    			else if(Qtype[i]=="checkbox")
					{
					 document.write("<input type=\"checkbox\" id=\"checkbox" + k + "\" name=\"checkbox" + i + "\" value=\"" + theIndex + "\" onClick=\"mult(" + theIndex + ",this);\" >");
					 document.write("<label for=\"checkbox" + k + "\">" +choices[theIndex] + "</label>");
					}
    			
    			document.write("</li>");
  			}
  		 }
		 }
		 if(Qtype[i]=="matching")
		 {
		 		var matchingChoiceIndex = ChoiceNum;
				var s = new Array();
			 	document.write("<table width=\"70%\" border=0>");
				for(;choices[theIndex]!=undefined;ChoiceNum++)
				{
				 //the next 2 lines takes care of questions that are numbered more than 10 and have
				 //more than 10 choices i.e. 1210 = question 12 choice 10
				 	theIndex = Number(String(QuestionNum) + String(ChoiceNum));
					theChoicesIndex = Number(String(QuestionNum) + String(matchingChoiceIndex));
					//the matchingBoxes array in the .js files are formated as "X|y" where X is the
					//label for the box, and y is the correct answer. '|' is the splitter
					s = String(matchingBoxes[theIndex]).split("|");
					if(choices[theChoicesIndex]!=undefined || matchingBoxes[theIndex]!=undefined)
					{
    				document.write("<tr>");
      			if(matchingBoxes[theIndex]!=undefined) document.write("<td>" + s[0]+"&nbsp;<input type=\"text\" maxlength=\"1\" size=\"1\" name=\"text\" value=\"\" onKeyUp=\"matching('" + s[1] + "',this.value,'z');\"></td>");
  					else document.write("<td>&nbsp;</td>");
    				document.write("<td>" + choices[theChoicesIndex] + "</td>");
						// here theChoicesIndex is incremented
						theChoicesIndex = Number(String(QuestionNum) + String(++matchingChoiceIndex));
						document.write("<td>" + choices[theChoicesIndex] + "</td>");
						matchingChoiceIndex++;
      			document.write("</tr>");
					}
				}
				document.write("</table>");
			}
		 ChoiceNum = 1;
		 document.write("</ol><br>");
		}
		//document.write("</ol>");