setUpPage();
function setUpPage(){
	
	for(suindex = 0;suindex<questionArray.length;suindex++){
		document.write("<div style='font-size: 10pt; width:510px; border:solid 1px #cccccc; border-bottom: 0px; line-height: 25px'>");
		document.write("<div style='background-color:#eeeeee; padding-left:5px'><strong>" + (suindex+1) + " " + questionArray[suindex][0] + "</strong></div>");
		document.write("<div style='margin: 5px 0px 0px 14px'><div style='width:300px; display:inline; float:left'>&nbsp;" + questionArray[suindex][1] + "</div>");
		document.write("<div style='display:inline; float:right'>&nbsp;<img src='/images/elt/product_site_graphics/clocktransparent.gif' name='im" + (suindex +1) + "'>&nbsp;</div>");
		document.write("<div style='display:inline; float:right'> <input size=" + questionArray[suindex][3] + " name=ans" + (suindex+1) + "></div></div><br />");
        document.write("</div>");    		            		
		
		}
		{
			document.write("<div style='width:510px; border:solid 1px #cccccc; line-height: 30px; margin-right: 5px;'> <span style='float:right'> <input onClick=checkScore() type=button value='Score' name='button'> <input type=button value='See answers' onClick='reveal()' name='button2'> <input type='reset' onClick='again()' name='reset' value='Start again'></span><br /></div>");
			}
		
}

var answerArray = new Array(document.form1.ans1,document.form1.ans2,document.form1.ans3,document.form1.ans4,document.form1.ans5,document.form1.ans6);
var imageArray = new Array(document.images.im1,document.images.im2,document.images.im3,document.images.im4,document.images.im5,document.images.im6);
function checkScore() {
var answerArray = new Array(document.form1.ans1,document.form1.ans2,document.form1.ans3,document.form1.ans4,document.form1.ans5,document.form1.ans6);
var imageArray = new Array(document.images.im1,document.images.im2,document.images.im3,document.images.im4,document.images.im5,document.images.im6);
	if(cheat){
		alert("Please press Start again to try again.")
	}else{
		var score = 0;
		for(csindex = 0;csindex<questionArray.length;csindex++){
			if (answerArray[csindex].value == questionArray[csindex][2]) {
				imageArray[csindex].src="/images/elt/product_site_graphics/clocktick.gif";
				score++;
			} else {
				imageArray[csindex].src="/images/elt/product_site_graphics/clockcross.gif";
			}
		}
		alert("Your score is "+score+" / " + questionArray.length + ".");
	}
}




function reveal() {
var answerArray = new Array(document.form1.ans1,document.form1.ans2,document.form1.ans3,document.form1.ans4,document.form1.ans5,document.form1.ans6);
var imageArray = new Array(document.images.im1,document.images.im2,document.images.im3,document.images.im4,document.images.im5,document.images.im6);
	for(revindex = 0;revindex<questionArray.length;revindex++){
		answerArray[revindex].value = questionArray[revindex][2];
		imageArray[revindex].src="/images/elt/product_site_graphics/clocktransparent.gif";
	}
	cheat = true;
}
function again() {
var answerArray = new Array(document.form1.ans1,document.form1.ans2,document.form1.ans3,document.form1.ans4,document.form1.ans5,document.form1.ans6);
var imageArray = new Array(document.images.im1,document.images.im2,document.images.im3,document.images.im4,document.images.im5,document.images.im6);
	cheat = false;
	for(agindex = 0;agindex<questionArray.length;agindex++){
		answerArray[agindex].value = "";
		imageArray[agindex].src="/images/elt/product_site_graphics/clocktransparent.gif";
	}

}




