var Qnum = 1;
var Cnum = 1;
var k = 1; //every choice has a different k value
		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(Qnum = 1;question[Qnum]!=undefined;Qnum++)
		{
		 //display question
		 document.write("<br><li style=\"color:black;\"><b>" + question[Qnum][0] + "</b></li>");
		 document.write("<ol type=\"A\">");
		 if(Qtype[Qnum]=="checkbox" || Qtype[Qnum]=="radio")
		 {
  		 for(j = 1;question[Qnum][j]!=undefined;j++,k++)
  		 {
  		 	stuff = question[Qnum][j].split("||");
  			document.write("<li style=\"color:black\">");
      			if(Qtype[Qnum]=="radio")
  					{
  					 document.write("<input type=\"radio\" id=\"radio" + k + "\" name=\"radio" + Qnum + "\" value=\"" + Qnum+"|"+ j + "\" onClick=\"mult(" + Qnum + ", " + j + ",this);\" >");
  					 document.write("<label for=\"radio" + k + "\">" + stuff[0] + "</label>");
  					}
      			else if(Qtype[Qnum]=="checkbox")
  					{
  					 document.write("<input type=\"checkbox\" id=\"checkbox" + k + "\" name=\"checkbox" + Qnum + "\" value=\"" + Qnum+"|"+j + "\" onClick=\"mult(" + Qnum + ", " + j + ",this);\" >");
  					 document.write("<label for=\"checkbox" + k + "\">" + stuff[0] + "</label>");
  					}
  		 }
		 } //end of if Qtype[Qnum]=="checkbox" || Qtype[Qnum]=="radio"

		 
		 else if(Qtype[Qnum]=="matching")
		 {
				var s = new Array();
			 	document.write("<table width=\"70%\" border=0>");
				for(l = 1,m = 1;(question[Qnum][l]!=undefined)&&(matchingBoxes[Qnum][m]!=undefined);l++,m++)
				{
					s = String(matchingBoxes[Qnum][m]).split("||");
					if(question[Qnum][l]!=undefined && matchingBoxes[Qnum][m]!=undefined)
					{
    				document.write("<tr>");
      			if(matchingBoxes[Qnum][m]!=undefined) document.write("<td width=5>" + s[0]+"</td><td><input type=\"text\" maxlength=\"1\" size=\"1\" name=\"text\" value=\"\" onKeyUp=\"matching('" + s[1] + "',this.value,'z');\"></td>");
  					else document.write("<td>&nbsp;</td>");
    				if(question[Qnum][l]!=undefined) document.write("<td>" + question[Qnum][l] + "</td>");
						// here 'l' is incremented
						if(question[Qnum][l+1]!=undefined) document.write("<td>" + question[Qnum][++l] + "</td>");
						else document.write("<td>&nbsp;</td>");
      			document.write("</tr>");
					}
				}
				document.write("</table>");
			} //end of else if Qtype == 'matching'
			
			else if(Qtype[Qnum]=="textarea")
			{
			 document.write("<textarea rows="+question[Qnum][1]+" cols="+question[Qnum][2]+"></textarea>");
			}// end of else if Qtype == 'textarea'
		 document.write("</ol>"); //end tag for choices list
		}
		document.write("</ol>"); //end tag for questions list
		/*
		for(j = 1;question[Qnum][j]!=undefined;j++,Qnum++)
		{
		 currQ = question[Qnum][j].split
		 document.write("<li style=\"color:black;\"><b>" + question[Qnum][0] + "</b></li>");
		 document.write("<ol type=\"A\">");
		 //theIndex = Number(String(QuestionNum) + String(ChoiceNum));
		 if(Qtype[Qnum]!="matching")
		 {
  		 for(;currQ[0]!=undefined && Qtype[Qnum]!="matching";ChoiceNum++,k++)
  		 {
  		 	//theIndex = Number(String(QuestionNum) + String(ChoiceNum));
  			if(currQ[0]!=undefined && Qtype[Qnum]!="matching")
  			{
    		 	document.write("<li style=\"color:black\">");
    			if(Qtype[i]=="radio")
					{
					 document.write("<input type=\"radio\" id=\"radio" + k + "\" name=\"radio" + Qnum + "\" value=\"" + Qnum+"|"+ j + "\" onClick=\"mult(" + Qnum + ", " + j + ",this);\" >");
					 document.write("<label for=\"radio" + k + "\">" + currQ[0] + "</label>");
					}
    			else if(Qtype[i]=="checkbox")
					{
					 document.write("<input type=\"checkbox\" id=\"checkbox" + k + "\" name=\"checkbox" + Qnum + "\" value=\"" + Qnum+"|"+j + "\" onClick=\"mult(" + Qnum + ", " + j + ",this);\" >");
					 document.write("<label for=\"checkbox" + k + "\">" + currQ[0] + "</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>");
*/