// JavaScript Document

var score =0;

var questions = new Array(
	"Grandad carries a mug up the stairs.",
	"1. Grandad talks to his friend.",
	"2. The milk cart was pulled by one horse.",
	"3. Grandad talked to the workman.",
	"4. Grandad’s foot is cold", 
	"5.  The house had a slate roof.", 
	"6. The horse’s hoof struck the cobbles.", 
	"7. The barge sailed past the wharf.",
	"8. A fat country mouse ran out of the hay.",
	"9. Grandad set the watch to Greenwich time.",
	"The bargee was cutting up a loaf.",
	"The donkey chewed hay from a bale.", 
	"Grandad saw a ferry at the pier.",
	"Grandad put some coal in the stove .",
	"Horace and George played a board game.",
	"Grandad dropped a dice on the table.", 
	"Horace moved the piece on the board.",
	"Old Mr Rose put the pieces away in a box."
	);

var correct= new Array(
	"1 Grandad carries two mugs up the stairs.",
	"1. Grandad talks to his friends.",
	"2. The milk cart was pulled by two horses.",
	"3. Grandad talked to the workmen.",
	"4. Grandad’s feet are cold.",
	"5. The houses had slate roofs.",
	"6. The horse’s hooves struck the cobbles.",
	"7. The barge sailed past the wharves.",
	"8. Several fat country mice ran out of the hay.",
	"9. Grandad set the watches to Greenwich time.", 
	"The bargees were cutting up loaves.", 
	"The donkeys chewed hay from a bale.",
	"Grandad saw two ferries at the pier.",
	"Grandad put some coal in the stove.", 
	"Horace and George played board games.", 
	"Grandad dropped two dice on the table.", 
	"Horace moved the pieces on the board.", 
	"Old Mr Rose put the pieces away in the boxes."
	);

var  wrong = new Array(
	"Grandad carries two muges up the stairs.",
	"1. Grandad talks to his friendes.",
	"2. The milk cart was pulled by two horsies.",
	"3. Grandad talked to the workmans.",
	"4. Grandad’s foots are cold.",
	"5. The houses had slate rooves.",
	"6. The horse’s hoofes struck the cobbles.",
	"7. The barge sailed past the wharfies.",
	"8. Several fat country mouses ran out of the hay.",
	"9. Grandad set the watchs to Greenwich time.", 
	"The bargees were cutting up loafs.", 
	"The donkies chewed hay from a bale.",
	"Grandad saw two ferrys at the pier.",
	"Grandad put some coals in the stove.", 
	"Horace and George played board game.", 
	"Grandad dropped two dices on the table.", 
	"Horace moved the piecen on the board.", 
	"Old Mr Rose put the boxsen away in the boxes."
	);
var possanswers1= new Array(
	"two mugs",
	"friends",
	"two horses",
	"workmen",
	"feet",
	"roofs",
	"hooves",
"wharves",
"mice",
"watches", 
"loaves.", 
"donkeys",
"two ferries",
"coal", 
"games.", 
"dice", 
"pieces", 
"boxes");



var possanswers2 = new Array(
"two muges",
"friendes",
"two horsies",
"workmans",
"foots",
"rooves",
"hoofes",
"wharfies",
"mouses",
"watchs",
"loafs",
"donkies",
"two ferrys",
"coals",
"game",
"dices",
"piecs",
"boxs");

var anscode= new Array( 
"b",
"b",
"b",
"b",
"b",
"b",
"b",
"b",
"b",
"b",
"b",
"b",
"b",
"b",
"b",
"b",
"b",
"b",
"b"
);


function changetext(thequestion, theval){ //nb change index now at 1 not 0
	if (theval.indexOf('a')>1){ //right
		var changeto=correct[parseInt(thequestion) ];
		score++;
		getscore();
		eval("q0"+thequestion).innerHTML=changeto;
		MM_swapImage('tb0'+thequestion,'','../img/tickboxticksmall.gif',1)
	//alert(score);
	}else if (theval.indexOf('b')>1){ //wrong
		//alert("wrong");
		var changeit=wrong[parseInt(thequestion)];
		eval("q0"+thequestion).innerHTML=changeit;
		MM_swapImage('tb0'+thequestion,'','../img/tickboxsmallcross.gif',1)
	}else{ //not done
	}
}

function getscore(){
	if (score >9){score=9}
	 var sendText = "You have scored " + score;
   window.document.myFlash.SetVariable("score", sendText);
//	var picpath="../img/skittles" +score+".jpg";
//	MM_swapImage('p0','','../img/skittles9.jpg','p0','',picpath,1);
}

function giveanswers(){
	for (var thequestion=1; thequestion<= 9; thequestion++){
	var changeto=correct[parseInt(thequestion) ];
	eval("q0"+thequestion).innerHTML=changeto;
	MM_swapImage('tb0'+thequestion,'','../img/tickboxticksmall.gif',1)// remove if we do not want the ticks
	}
}
