var text1=''

var score=0
var noq=0
var a1=0
var a2=0
var a3=0
var a4=0
var a5=0
var a6=0
var a7=0
var a8=0
var a9=0
var a10=0

var c1=0
var c2=0
var c3=0
var c4=0
var c5=0
var c6=0
var c7=0
var c8=0
var c9=0
var c10=0

var text1='WHITE TO MOVE'
var ans1a='Rxf7'
var ans1b='Rf7'
var ans1c=ans1a
var c1t1='White has a forced checkmate in three moves'
var c1t2='The first move is a sacrifice'
var c1t3='Which enemy piece is preventing your queen playing a strong check?'

var text2='BLACK TO MOVE'
var ans2a='Qxc1'
var ans2b='Qc1'
var ans2c=ans2a
var c2t1='If you look ahead a few moves you might see a fork coming'
var c2t2='Sometimes pieces are not as well defended as they seem'
var c2t3='Try to visualise the position after two captures for each side'

var text3='WHITE TO MOVE'
var ans3a='Qxh7'
var ans3b='Qh7'
var ans3c=ans3a
var c3t1='White has set up a familiar checkmate situation'
var c3t2='You can do a brilliant checkmate in two moves here'
var c3t3='Might a sacrifice work for you here?'

var text4='BLACK TO MOVE'
var ans4a='Rxf3'
var ans4b='Rf3'
var ans4c=ans4a
var c4t1='You can win material - but accurate calculation is required to work it out'
var c4t2='In one variation you get a back rank mate'
var c4t3='Look for a way to destroy a defending piece'

var text5='BLACK TO MOVE'
var ans5a='Nd4'
var ans5b=ans5a
var ans5c=ans5a
var c5t1='Many people have fallen for this opening trap - but what is Black\'s winning move?'
var c5t2='One idea is to try to decoy an important defender'
var c5t3='Don\'t worry about the threat to your knight - instead find a way to target the enemy queen and - indirectly - the king'

var text6='WHITE TO MOVE'
var ans6a='Rxf6'
var ans6b='Rf6'
var ans6c=ans6a
var c6t1='You have to find a clearance sacrifice'
var c6t2='One of your own pieces is in the way - what\'s the best way to get rid of it?'
var c6t3='You could play a deadly fork - but one of your own pieces is occupying the forking square'

var text7='WHITE TO MOVE'
var ans7a='d6'
var ans7b='Pd6'
var ans7c=ans7a
var c7t1='You can win a piece by means of a double threat'
var c7t2='You can threaten one piece directly while using a discovered attack to open up another threat'
var c7t3='Look at the two black bishops - how can you threaten them?'

var text8='BLACK TO MOVE'
var ans8a='Rxa2'
var ans8b='Ra2'
var ans8c=ans8a
var c8t1='You can win a pawn - and maybe also a king'
var c8t2='Can you see how to set up a queen and rook checkmate?'
var c8t3='If White accepts your sacrifice he will be mated in three more moves' 

var text9='BLACK TO MOVE'
var ans9a='Nd3'
var ans9b=ans9a
var ans9c=ans9a
var c9t1='White has just played d2-d4 - but you can do better than capturing en passant'
var c9t2='The main idea is to set up a discovered check'
var c9t3='How can you try to get those pawns off the e-file?'

var text10='WHITE TO MOVE'
var ans10a='Qxe5'
var ans10b='Qe5'
var ans10c=ans10a
var c10t1='Be careful - Black is threatening checkmate'
var c10t2='If you look for checks you\'ll see that you can mate Black before he mates you'
var c10t3='The first move is a sacrifice which opens a line for another of your pieces'

function clue1(){
c1=c1+1							   
if (c1<4) a1=a1-2 	 
if (c1==1) {setTimeout("q1c.innerHTML='<br>'+c1t1+'<br>'",6000)}
else {if (c1==2) {setTimeout("q1c.innerHTML='<br>'+c1t2+'<br>'",6000)}
else {if (c1==3) {setTimeout("q1c.innerHTML='<br>'+c1t3+'<br>'",6000)}}} 
}

function clue2(){
c2=c2+1	
if (c2<4) a2=a2-2 
if (c2==1) {setTimeout("q2c.innerHTML='<br>'+c2t1+'<br>'",6000)}
else {if (c2==2) {setTimeout("q2c.innerHTML='<br>'+c2t2+'<br>'",6000)}
else {if (c2==3) {setTimeout("q2c.innerHTML='<br>'+c2t3+'<br>'",6000)}}} 
}

function clue3(){
c3=c3+1	
if (c3<4) a3=a3-2 
if (c3==1) {setTimeout("q3c.innerHTML='<br>'+c3t1+'<br>'",6000)}
else {if (c3==2) {setTimeout("q3c.innerHTML='<br>'+c3t2+'<br>'",6000)}
else {if (c3==3) {setTimeout("q3c.innerHTML='<br>'+c3t3+'<br>'",6000)}}} 
}

function clue4(){
c4=c4+1	
if (c4<4) a4=a4-2 
if (c4==1) {setTimeout("q4c.innerHTML='<br>'+c4t1+'<br>'",6000)}
else {if (c4==2) {setTimeout("q4c.innerHTML='<br>'+c4t2+'<br>'",6000)}
else {if (c4==3) {setTimeout("q4c.innerHTML='<br>'+c4t3+'<br>'",6000)}}} 
}

function clue5(){
c5=c5+1	
if (c5<4) a5=a5-2 
if (c5==1) {setTimeout("q5c.innerHTML='<br>'+c5t1+'<br>'",6000)}
else {if (c5==2) {setTimeout("q5c.innerHTML='<br>'+c5t2+'<br>'",6000)}
else {if (c5==3) {setTimeout("q5c.innerHTML='<br>'+c5t3+'<br>'",6000)}}} 
} 

function clue6(){
c6=c6+1	
if (c6<4) a6=a6-2 
if (c6==1) {setTimeout("q6c.innerHTML='<br>'+c6t1+'<br>'",6000)}
else {if (c6==2) {setTimeout("q6c.innerHTML='<br>'+c6t2+'<br>'",6000)}
else {if (c7==3) {setTimeout("q7c.innerHTML='<br>'+c7t3+'<br>'",6000)}}} 
}

function clue7(){
c7=c7+1	
if (c7<4) a7=a7-2 
if (c7==1) {setTimeout("q7c.innerHTML='<br>'+c7t1+'<br>'",6000)}
else {if (c7==2) {setTimeout("q7c.innerHTML='<br>'+c7t2+'<br>'",6000)}
else {if (c7==3) {setTimeout("q7c.innerHTML='<br>'+c7t3+'<br>'",6000)}}} 
}

function clue8(){
c8=c8+1	
if (c8<4) a8=a8-2 
if (c8==1) {setTimeout("q8c.innerHTML='<br>'+c8t1+'<br>'",6000)}
else {if (c8==2) {setTimeout("q8c.innerHTML='<br>'+c8t2+'<br>'",6000)}
else {if (c8==3) {setTimeout("q8c.innerHTML='<br>'+c8t3+'<br>'",6000)}}} 
}

function clue9(){
c9=c9+1	
if (c9<4) a9=a9-2 
if (c9==1) {setTimeout("q9c.innerHTML='<br>'+c9t1+'<br>'",6000)}
else {if (c9==2) {setTimeout("q9c.innerHTML='<br>'+c9t2+'<br>'",6000)}
else {if (c9==3) {setTimeout("q9c.innerHTML='<br>'+c9t3+'<br>'",6000)}}} 
}

function clue10(){
c10=c10+1	
if (c10<4) a10=a10-2 
if (c10==1) {setTimeout("q10c.innerHTML='<br>'+c10t1+'<br>'",6000)}
else {if (c10==2) {setTimeout("q10c.innerHTML='<br>'+c10t2+'<br>'",6000)}
else {if (c10==3) {setTimeout("q10c.innerHTML='<br>'+c10t3+'<br>'",6000)}}} 
}	  

function checkans1(){
if (q1div.innerHTML==ans1a||q1div.innerHTML==ans1b||q1div.innerHTML==ans1c) {setTimeout("DHTMLSound('excellnt.wav')",1000);a1=a1+10;document.q1kp.src="tactr.gif"}
else {setTimeout("DHTMLSound('shoot.wav')",1000);a1=a1-1;document.q1kp.src="tactw.gif";setTimeout("document.q1kp.src='keypad.gif'",3000);q1div.innerHTML=''}
}

function checkans2(){
if (q2div.innerHTML==ans2a||q2div.innerHTML==ans2b||q2div.innerHTML==ans2c) {setTimeout("DHTMLSound('excellnt.wav')",1000);a2=a2+10;document.q2kp.src="tactr.gif"}
else {setTimeout("DHTMLSound('shoot.wav')",1000);a2=a2-1;document.q2kp.src="tactw.gif";setTimeout("document.q2kp.src='keypad.gif'",3000);q2div.innerHTML=''}
}

function checkans3(){
if (q3div.innerHTML==ans3a||q3div.innerHTML==ans3b||q3div.innerHTML==ans3c) {setTimeout("DHTMLSound('excellnt.wav')",1000);a3=a3+10;document.q3kp.src="tactr.gif"}
else {setTimeout("DHTMLSound('shoot.wav')",1000);a3=a3-1;document.q3kp.src="tactw.gif";setTimeout("document.q3kp.src='keypad.gif'",3000);q3div.innerHTML=''}
}

function checkans4(){
if (q4div.innerHTML==ans4a||q4div.innerHTML==ans4b||q4div.innerHTML==ans4c) {setTimeout("DHTMLSound('excellnt.wav')",1000);a4=a4+10;document.q4kp.src="tactr.gif"}
else {setTimeout("DHTMLSound('shoot.wav')",1000);a4=a4-1;document.q4kp.src="tactw.gif";setTimeout("document.q4kp.src='keypad.gif'",3000);q4div.innerHTML=''}
}

function checkans5(){
if (q5div.innerHTML==ans5a||q5div.innerHTML==ans5b||q5div.innerHTML==ans5c) {setTimeout("DHTMLSound('excellnt.wav')",1000);a5=a5+10;document.q5kp.src="tactr.gif"}
else {setTimeout("DHTMLSound('shoot.wav')",1000);a5=a5-1;document.q5kp.src="tactw.gif";setTimeout("document.q5kp.src='keypad.gif'",3000);q5div.innerHTML=''}
}

function checkans6(){
if (q6div.innerHTML==ans6a||q6div.innerHTML==ans6b||q6div.innerHTML==ans6c) {setTimeout("DHTMLSound('excellnt.wav')",1000);a6=a6+10;document.q6kp.src="tactr.gif"}
else {setTimeout("DHTMLSound('shoot.wav')",1000);a6=a6-1;document.q6kp.src="tactw.gif";setTimeout("document.q6kp.src='keypad.gif'",3000);q6div.innerHTML=''}
}

function checkans7(){
if (q7div.innerHTML==ans7a||q7div.innerHTML==ans7b||q7div.innerHTML==ans7c) {setTimeout("DHTMLSound('excellnt.wav')",1000);a7=a7+10;document.q7kp.src="tactr.gif"}
else {setTimeout("DHTMLSound('shoot.wav')",1000);a7=a7-1;document.q7kp.src="tactw.gif";setTimeout("document.q7kp.src='keypad.gif'",3000);q7div.innerHTML=''}
}

function checkans8(){
if (q8div.innerHTML==ans8a||q8div.innerHTML==ans8b||q8div.innerHTML==ans8c) {setTimeout("DHTMLSound('excellnt.wav')",1000);a8=a8+10;document.q8kp.src="tactr.gif"}
else {setTimeout("DHTMLSound('shoot.wav')",1000);a8=a8-1;document.q8kp.src="tactw.gif";setTimeout("document.q8kp.src='keypad.gif'",3000);q8div.innerHTML=''}
}

function checkans9(){
if (q9div.innerHTML==ans9a||q9div.innerHTML==ans9b||q9div.innerHTML==ans9c) {setTimeout("DHTMLSound('excellnt.wav')",1000);a9=a9+10;document.q9kp.src="tactr.gif"}
else {setTimeout("DHTMLSound('shoot.wav')",1000);a9=a9-1;document.q9kp.src="tactw.gif";setTimeout("document.q9kp.src='keypad.gif'",3000);q9div.innerHTML=''}
}

function checkans10(){
if (q10div.innerHTML==ans10a||q10div.innerHTML==ans10b||q10div.innerHTML==ans10c) {setTimeout("DHTMLSound('excellnt.wav')",1000);a10=a10+10;document.q10kp.src="tactr.gif"}
else {setTimeout("DHTMLSound('shoot.wav')",1000);a10=a10-1;document.q10kp.src="tactw.gif";setTimeout("document.q10kp.src='keypad.gif'",3000);q10div.innerHTML=''}
}

function popupMessage() {

/***********************************************
* Encrypt Email script- Please keep notice intact.
* Tool URL: http://www.dynamicdrive.com/emailriddler/
* **********************************************/

var emailarray1677= new Array(99,104,101,115,115,107,105,100,115,97,99,97,100,101,109,121,64,103,111,111,103,108,101,109,97,105,108,46,99,111,109)
var postemail1677=''
for (i=0;i<emailarray1677.length;i++)
postemail1677+=String.fromCharCode(emailarray1677[i])


  // SET MESSAGE VALUES
  var name = document.rjform.rjname.value
  var to = postemail1677
  var subject = "chessKIDS academy tactics quiz 8"
  var body =
  "Name of pupil: "+name+  
  "\n\nScore in tactics quiz 8: "+score+
  "\n\n"+a1+' '+a2+' '+a3+' '+a4+' '+a5+' '+a6+' '+a7+' '+a8+' '+a9+' '+a10

  // BUILD MAIL MESSAGE COMPONENTS 
  var doc = "mailto:" + to + 
      "?subject=" + escape(subject) + 
      "&body=" + escape(body); 

  // POP UP EMAIL MESSAGE WINDOW
  window.location = doc;
}

function finish(){

if (a1<0||a1>10) a1=0
if (a2<0||a2>10) a2=0
if (a3<0||a3>10) a3=0
if (a4<0||a4>10) a4=0
if (a5<0||a5>10) a5=0
if (a6<0||a6>10) a6=0
if (a7<0||a7>10) a7=0
if (a8<0||a8>10) a8=0
if (a9<0||a9>10) a9=0
if (a10<0||a10>10) a10=0

score=a1+a2+a3+a4+a5+a6+a7+a8+a9+a10 

result.innerHTML="<br><br>You scored " 
result.innerHTML+=score
result.innerHTML+="% in the chess<font color=red>KIDS<font color=black> academy Tactics Quiz 8"

popupMessage()

}

function DHTMLSound(surl) {
  document.getElementById("dummyspan").innerHTML=
    "<embed src='"+surl+"' hidden=true autostart=true loop=false>";
}



