// JavaScript Document

var score =0;

var questions = new Array(
"Sam has lucky got a job at the boatbuilders.",
"1. The company has recent got an order for four lighters.",
"2. The iron plates are simple fastened with rivets.",
"3. Sam picks up a red hot rivet careful.",
"4. One man beats the rivet noisy with a sledgehammer.",
"5. The lighters are pulled quick by tugboats.",
"6. Sam runs frantic through the gates to the yard.",
"7. The streets are full of people brisk walking home.",
"8. Sam is complete tired out.",
"9. Sam chats comfortable with Henry."
);

var correct= new Array(
"Sam has luckily got a job at the boatbuilders.",
"1. The company has recently got an order for four lighters.",
"2. The iron plates are simply fastened with rivets.",
"3. Sam picks up a red hot rivet carefully.",
"4. One man beats the rivet noisily with a sledgehammer.",
"5. The lighters are pulled quickly by tugboats.",
"6. Sam runs frantically through the gates to the yard.",
"7. The streets are full of people briskly walking home.",
"8. Sam is completely tired out.",
"9. Sam chats comfortably with Henry."
);
	
var  wrong = new Array(
	"0. Sam has luckyly got a job at the boatbuilders.",
	"1. The company has recentily got an order for four lighters.",
	"2. The iron plates are simplely fastened with rivets.",
	"3. Sam picks up a red hot rivet carefuly.",
	"4. One man beats the rivet noisyly with a sledgehammer.",
	"5. The lighters are pulled quickily by tugboats.",
	"6. Sam runs franticaly through the gates to the yard.",
	"7. The streets are full of people briskilly walking home.",
	"8. Sam is completly tired out.",
	"9. Sam chats comfortablely with Henry."
)

var possanswers1= new Array(
"luckyly ",
"recentily",
"simply",
"carefully",
"noisyly",
"quickly",
"frantically",
"briskly",
"completely",
"comfortably"
);


var possanswers2 = new Array(
"luckily",
"recently",
"simplely",
"carefuly",
"noisily",
"quickily",
"franticly",
"briskilly",
"completly",
"comfortablely"
);

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
		score++;
	with (navigator) if (appVersion.indexOf('Mac')==-1)	{
		getscore();
	}else {
	// alert("you have scored " + score);
	}
		var changeto=correct[parseInt(thequestion) ];
	
		MM_swapImage('tb0'+thequestion,'','../img/tickboxticksmall.gif',1);
		eval("q0"+thequestion).innerHTML=changeto;
	} else if (theval.indexOf("b")>1) { //wrong
		var changeit=wrong[parseInt(thequestion)];
		MM_swapImage('tb0'+thequestion,'','../img/tickboxsmallcross.gif',1);
		eval("q0"+thequestion).innerHTML=changeit;
	} 
}


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(){
bname=navigator.appName
	if (bname.indexOf("Netscape")!=-1)
	{
		//window.location="game101nsa.htm"
		 window.setTimeout(window.location="game501nsa.htm",100);
		return
	}
	if (bname.indexOf("Microsoft")!=-1){
		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
		}
	}
}