// JavaScript Document

var score =0;

var questions = new Array(

"",
"1. Sam has lucky got a job at the boatbuilders.",
"2. At the boxing club, Bill and Sam spar  lazy. ",
"3. Sam walks leisure to the swimming pool.",
"4. The pool attendant  due  hands Sam a towel.",
"5. \"This towel is damp!\" says Sam  polite.",
"6. \"The mangle is broken,\" says the attendant  apologetic.",
"7. Sam swims  energetic  in the first class pool.",
"8. The woollen costume is  horrible  itchy.",
"9. Sam   easy  falls asleep."
);

var correct= new Array(
"",
"1. Sam has luckily got a job at the boatbuilders.",
"2. At the boxing club, Bill and Sam spar lazily. ",
"3. Sam takes a leisurely walk to the swimming pool.",
"4. The pool attendant  duly  hands Sam a towel.",
"5. \"This towel is damp!\" says Sam  politely.",
"6. \"The mangle is broken,\" says the attendant  apologetically.",
"7. Sam swims  energetically   in the first class pool.",
"8. The woollen costume is  horribly  itchy.",
"9. Sam  easily  falls asleep."
);
	
var  wrong = new Array(
"",
"1. Sam has luckyly  got a job at the boatbuilders.",
"2. At the boxing club, Bill and Sam spar lazally. ",
"3. Sam walks leisurelily to the swimming pool.",
"4. The pool attendant  duely  hands Sam a towel.",
"5. \"This towel is damp!\" says Sam  politly.",
"6. \"The mangle is broken,\" says the attendant apologeticly.",
"7. Sam swims  energeticly   in the first class pool.",
"8. The woollen costume is  horribley  itchy.",
"9. Sam  easyly  falls asleep."
)


var possanswers1= new Array(
"",
"luckyly ",
"lazily",
"takes a leisurely walk",
"duly",
"politely",
"apologetically",
"energeticaly",
"horribley", 
"easily"
);


var possanswers2 = new Array(
"",
"luckily",
"lazally ",
"walks leisurelily ",
"duely",
"politly",
"apologeticly ",
"energetically",
"horribly",
"easyly"
);

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;
	}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(){
bname=navigator.appName
	if (bname.indexOf("Netscape")!=-1)
	{
		//window.location="game101nsa.htm"
		 window.setTimeout(window.location="game502nsa.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
		}
	}
}
