//<!--
//******************************************
//***	Total number of questions (1 to 10)
//******************************************

var NumQuestions  = 11;

var questiontext = new Array();
var questionpic = new Array();

var optionA = new Array();
var optionB = new Array();
var optionC = new Array();
var optionD = new Array();

var optionApic = new Array();
var optionBpic = new Array();
var optionCpic = new Array();
var optionDpic = new Array();

var correct = new Array();

var errorfeedback = new Array();
var finalmarkfeedback = new Array();
var forename;

var questionDone = new Array();
for (i = 0; i < NumQuestions+1; i++)
{
	questionDone[i] = 0;
}


//********************************************************************************
//***
//***	Editable properties start here
//***
//********************************************************************************




//******************************************
//***	Main title
//******************************************

var titleText     = "Spot the Birdies!";


//********************************************************************************
//***
//***       Enter your questions & answers carefuly between the quotes...
//***
//********************************************************************************

questiontext[1]  = "What species is this...?";
optionA[1]       = "Blue Tit";
optionB[1]       = "Bittern";
optionC[1]       = "Barn Owl";

questionpic[1]	 = 0;
optionApic[1]	 = 0;
optionBpic[1]	 = 0;
optionCpic[1]	 = 0;

correct[1]       =2;		// *** REMEMBER THAT 0=A  1=B  2=C  3=D ***

errorfeedback[1] = "Oh no! It's got BIG eyes!";
 

//********************************************************************************

questiontext[2]  = "What species is this...?";
optionA[2]       = "Bittern";
optionB[2]       = "Cuckoo";
optionC[2]       = "Robin";

questionpic[2] = 0;
optionApic[2]	 = 0;
optionBpic[2]	 = 0;
optionCpic[2]	 = 0;

correct[2]       = 0; 		// *** REMEMBER THAT 0=A  1=B  2=C  3=D *** 

errorfeedback[2] = "Oh no! Correct answer begins with B...";

//********************************************************************************

questiontext[3]  = "What species is this...?";
optionA[3]       = "Wren";
optionB[3]       = "Blue tit";
optionC[3]       = "Nightingale";

questionpic[3] = 0;
optionApic[3]	 = 0;
optionBpic[3]	 = 0;
optionCpic[3]	 = 0;
optionDpic[3]	 = 0;

correct[3]       = 1; 		// *** REMEMBER THAT 0=A  1=B  2=C  3=D ***

errorfeedback[3] = "Oh no! This is what blue sounds like...";

//********************************************************************************

questiontext[4]  = "What species is this...?";
optionA[4]       = "Kestrel";
optionB[4]       = "Woodpecker";
optionC[4]       = "Cuckoo";

questionpic[4] = 1;
optionApic[4]	 = 0;
optionBpic[4]	 = 0;
optionCpic[4]	 = 0;
optionDpic[4]	 = 0;

correct[4]       = 2; 		// *** REMEMBER THAT 0=A  1=B  2=C  3=D ***

errorfeedback[4] = "Oh no! Correct answer starts with B...";

//********************************************************************************

questiontext[5]  = "What species is this...?";
optionA[5]       = "Red Grouse";
optionB[5]       = "Green Woodpecker";
optionC[5]       = "Blue Tit";

questionpic[5] = 1;
optionApic[5]	 = 0;
optionBpic[5]	 = 0;
optionCpic[5]	 = 0;
optionDpic[5]	 = 0;

correct[5]       = 1; 		// *** REMEMBER THAT 0=A  1=B  2=C  3=D *** 
errorfeedback[5] = "Oh no! This one has a tough beak, too!";

//********************************************************************************

questiontext[6]  = "What species is this...?";
optionA[6]       = "Pigeon";
optionB[6]       = "Common Gull";
optionC[6]       = "Herring Gull";

questionpic[6] = 1;
optionApic[6]	 = 0;
optionBpic[6]	 = 0;
optionCpic[6]	 = 0;
optionDpic[6]	 = 0;

correct[6]       = 2; // *** REMEMBER THAT 0=A  1=B  2=C  3=D ***
errorfeedback[6] = "Oh no! It's not the one called common...";

//********************************************************************************

questiontext[7]  = "What species is this...?";
optionA[7]       = "Kestrel";
optionB[7]       = "Sparrow Hawk";
optionC[7]       = "Buzzard";

questionpic[7] =1;
optionApic[7]	 = 0;
optionBpic[7]	 = 0;
optionCpic[7]	 = 0;
optionDpic[7]	 = 0;

correct[7]       =0; // *** REMEMBER THAT 0=A  1=B  2=C  3=D *** 
errorfeedback[7] = "Oh no! Correct answer was once also known as Kes...";

//********************************************************************************

questiontext[8]  = "What species is this...?";
optionA[8]       = "Pied wagtail";
optionB[8]       = "Chaffinch";
optionC[8]       = "Nightingale";

questionpic[8] = 1;
optionApic[8]	 = 0;
optionBpic[8]	 = 0;
optionCpic[8]	 = 0;
optionDpic[8]	 = 0;

correct[8]       = 2; // *** REMEMBER THAT 0=A  1=B  2=C  3=D ***
errorfeedback[8] = "Oh no! Correct answer starts with N...";

//********************************************************************************

questiontext[9]  = "What species is this...?";
optionA[9]       = "Wren";
optionB[9]       = "Red Grouse";
optionC[9]       = "Willow Warbler";

questionpic[9] = 1;
optionApic[9]	 = 0;
optionBpic[9]	 = 0;
optionCpic[9]	 = 0;
optionDpic[9]	 = 0;

correct[9]       = 1; // *** REMEMBER THAT 0=A  1=B  2=C  3=D *** 
errorfeedback[9] = "Oh no! Correct answer lives on the moors...";

//********************************************************************************

questiontext[10] = "What species is this...?";
optionA[10]       = "Robin";
optionB[10]       = "Wren";
optionC[10]       = "Swallow";

questionpic[10] = 1;
optionApic[10]	 = 0;
optionBpic[10]	 = 0;
optionCpic[10]	 = 0;
optionDpic[10]	 = 0;

correct[10]      = 0; // *** REMEMBER THAT 0=A  1=B  2=C  3=D ***
errorfeedback[10] = "Oh no! Correct answer is popular at Xmas...";

//********************************************************************************

questiontext[11] = "What species is this...?";
optionA[11]       = "Parrot";
optionB[11]       = "Curlew";
optionC[11]       = "Wren";

questionpic[11] = 1;
optionApic[11]	 = 0;
optionBpic[11]	 = 0;
optionCpic[11]	 = 0;
optionDpic[11]	 = 0;

correct[11]      = 2; // *** REMEMBER THAT 0=A  1=B  2=C  3=D ***
errorfeedback[11] = "Oh no! Correct answer starts with W...";

//********************************************************************************

questiontext[12] = "What species is this...?";
optionA[12]       = "Greenfinch";
optionB[12]       = "Jay";
optionC[12]       = "Song thrush";

questionpic[12] = 1;
optionApic[12]	 = 0;
optionBpic[12]	 = 0;
optionCpic[12]	 = 0;
optionDpic[12]	 = 0;

correct[12]      = 0; // *** REMEMBER THAT 0=A  1=B  2=C  3=D ***
errorfeedback[12] = "Oh no! Correct answer starts with G...";

//********************************************************************************

//********************************************************************************





//********************************************************************************
//***
//***       Don't change anything below here
//***		
//***       ...except for the "bgcolor" in the BODY tag at bottom of file
//***
//********************************************************************************


	var code = "";

		code +='<table border="0" width="160" align="center" cellspacing="0" cellpadding="0" style="margin-top: 0px; margin-bottom: 0px">';

		code +='<tr>';
		code +='<td valign="top">';

			code +='<table border="0"  align="center" height="100%" cellspacing="0" cellpadding="0" style="margin-top: 0px; margin-bottom: 0px">';
	
				
 				var c = getRandom(NumQuestions);

				// Remember - you cannot check for repeats since page is reloaded each time. Doh!!
				questionDone[c]=1;


				code +='<form name="frmTeaser" style="margin-top:0px; margin-bottom: 0px">';

				code +='<tr>';
				code +='<td colspan="3" >';

				code += '<p class=brainTeaserQuestion>'+questiontext[c]+'</p>';

				code +='</td>';
				code +='</tr>';


				
					code +='<tr>';

					code +='<td align="center" colspan=3 valign="middle">';
					
					code +='<object style="margin-top: 3px; margin-bottom: 6px;" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="100" height="54"><param name="movie" value="/home/special/0910/birds/sounds/'+c+'.swf"><param name="quality" value="high"><embed src="/home/special/0910/birds/sounds/'+c+'.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100" height="54"></embed></object>';
					
					
					//code +='<a href="#" onmouseover="return overlib(\'<img src=/home/special/0809/birds/images/large/'+c+'.jpg>rspb.org.uk\', CAPTION, \'Spot the Birdie! What species is this...\', CAPCOLOR, \'#FFFFFF\', FGCOLOR, \'white\', BGCOLOR, \'#0000ff\', WIDTH, 150, OFFSETX, -300, OFFSETY, 20, BELOW, BORDER, 2, CAPTIONFONT, \'Arial\', CAPTIONSIZE, 1)" onmouseout="return nd();"><img border="0" src="/home/special/0809/birds/images/' + c + '.gif"></a>';
					
					
					
					code +='</td>';
					code +='</tr>';

				
				


				//********************************************************************************
				/* Option A */

				if (optionApic[c]==1)
				{
					code +='<tr>';

					code += '<td width=" " align="right" valign="middle"><img border="0" src="/home/special/0809/birds/images/blank.gif" width="30" height="14"></td>';

					code +='<td width="95%" align="left" valign="middle">';
					code +='<img border="0" src="/home/special/0809/birds/images/questions/option' + c + 'a.gif">';
					code +='</td>';
					code +='</tr>';

				}

				code +='<tr>';
				code +='<td width="20" align="right" valign="top" ><div id="mark' + c + '0"><img border="0" src="/home/special/0809/birds/images/blank.gif" width="14" height="14"></div></td>';
				code +='<td width="8" align="left" valign="top">';
				code +='<input type="radio" name="options" onchange="markit(' + c + ')"></td>';
				code +='<td width="132" align="left" ><p class="brainTeaserAnswer">' + optionA[c] + '</p>';
				code +='</td>';
				code +='</tr>';


				//********************************************************************************
				/* Option B */

				if (optionBpic[c]==1)
				{
					code +='<tr>';

					code += '<td width="5%" align="left" valign="middle"><img border="0" src="/home/special/0809/birds/images/blank.gif" width="30" height="14"></td>';

					code +='<td width="95%" align="left" valign="middle" class="maintext">';
					code +='<img border="0" src="/home/special/0809/birds/images/questions/option' + c + 'b.gif">';
					code +='</td>';
					code +='</tr>';

				}

				code +='<tr>';

				code +='<tr>';
				code +='<td width="20" align="right" valign="top" ><div id="mark' + c + '1"><img border="0" src="/home/special/0809/birds/images/blank.gif" width="14" height="14"></div></td>';
				code +='<td width="8"  align="left" valign="top">';
				code +='<input type="radio" name="options" onchange="markit(' + c + ')"></td>';
				code +='<td width="132" align="left"><p class="brainTeaserAnswer">' + optionB[c] + '</p>';
				code +='</td>';
				code +='</tr>';


				//********************************************************************************
				/* Option C */

				if (optionCpic[c]==1)
				{
					code +='<tr>';

					code += '<td width="5%" align="left" valign="middle"><img border="0" src="/home/special/0809/birds/images/blank.gif" width="30" height="14"></td>';

					code +='<td width="95%" align="left" valign="middle"  class="maintext">';
					code +='<img border="0" src="/home/special/0809/birds/images/questions/option' + c + 'c.gif">';
					code +='</td>';
					code +='</tr>';

				}

				code +='<tr>';
				code +='<td width="20" align="right" valign="top" ><div id="mark' + c + '2"><img border="0" src="/home/special/0809/birds/images/blank.gif" width="14" height="14"></div></td>';
				code +='<td width="8" align="left" valign="top">';
				code +='<input type="radio" name="options" onchange="markit(' + c + ')"></td>';
				code +='<td width="132" align="left"><p class="brainTeaserAnswer">' + optionC[c] + '</p>';
				code +='</td>';
				code +='</tr>';
				
				code +='</table>';


				code +='<table border="0" width="90%" align="center" cellspacing="0" cellpadding="0" style="margin-top: 3px; margin-bottom: 3px">';
				code +='<tr><td ><input type="button" class="brainTeaserCheckIt"  name="Button" value="Check It" onClick="markit(' + c +')"</td>';
				code +='<td><input type="button" class="brainTeaserTryAnother" name="Button" value="Try Another" onClick="window.location.reload()"></td></tr>';
				code +='</table>';
				
							
				code +='</form>';


		code +='</td>';
		code +='</tr>';
		code +='</table>';
		


	//alert ("code is " + code);
	document.write(code);



function markit(questnumber)
{

     	var group = document.frmTeaser.options;
	var passedTests = 0;

     		for (var i=0; i<group.length; i++) 
		{
       			if (group[i].checked) break;
     		}

		if (i==group.length) return alert ("No answer selected.");
	

		var dummy = correct[questnumber];

		//alert ("i is " + i + "questnumber is " + questnumber + " dummy is " + dummy);
     	if (i==dummy)
		{
			var temp = "mark" + questnumber + i;
			var mark = document.getElementById(temp);
			mark.innerHTML = '<img src="/home/special/0809/birds/images/tick.gif" width="14" height="14">';
		}
		else
		{
			switch (dummy)
			{
				case 0:
					var correctanswer="A";
					break;
				case 1:
					var correctanswer="B";
					break;
				case 2:
					var correctanswer="C";
					break;
				case 3:
					var correctanswer="D";
					break;
			}
			

			var temp = "mark" + questnumber + i;
			var mark = document.getElementById(temp);
			mark.innerHTML = '<img src="/home/special/0809/birds/images/cross.gif" width="14" height="14">';
		for (var i=0; i<group.length; i++) 
		{
			//alert("disabling " + i);
       			group[i].disabled = true;
     	}
     		//alert("Wrong!\nThe correct answer was " + correctanswer + ".\n" + errorfeedback[questnumber]);

		var test2= eval('option'+correctanswer+'['+questnumber+']');
		
		//alert("Wrong!\nThe correct answer was " + test2 + ".\n");

		alert(errorfeedback[questnumber]);

	}
}


//-->
