
//rgt detects a right (1) or wrong(2) answer or if someone has refreshed the screen (0)
var rgt=Get_Cookie('rgt');
if (rgt == null) {rgt=0};

//q is level
var q=Get_Cookie('q');
if (q == null) {q=0};

//sc is score
var sc=Get_Cookie('sc');
if (sc == null) {sc=0};






x=0;
// main picture
var mymainpic = new Array();
//option 1
var mysubpic1 = new Array();
//option 1 close up
var mysubpic1b = new Array();
//option 2
var mysubpic2 = new Array();
//option 2 close up
var mysubpic2b = new Array();
//option 3
var mysubpic3 = new Array();
//option 3 close up
var mysubpic3b = new Array();
//right answer number 1 to 3
var myrightans = new Array();
//previous right answer pic
var myrightanspic = new Array();
//previous right question pic
var myrightansqpic = new Array();
//text for question
var mytext = new Array();
//text for footer
var mytext2 = new Array();

// level 1 variables
mymainpic[x] = "main-1.jpg";
mysubpic1[x] = "box24a.jpg";
mysubpic1b[x] = "box24b.jpg";
mysubpic2[x] = "box20a.jpg";
mysubpic2b[x] = "box20b.jpg";
mysubpic3[x] = "box4a.jpg";
mysubpic3b[x] = "box4b.jpg";
myrightans[x] = 3;
myrightanspic[x] = "a1.jpg";
myrightansqpic[x] = "ans-1.jpg";
mytext[x] = "<p>I've got 15 Ready Meals but - quelle horreur! - all the boxes and contents have been mixed up. Help!</p>";
mytext[x] = mytext[x] + "<p>This quiz tests your skills in recognising ready meals which, to be honest, don't always look quite as good out of the box as they do on the picture.</p>";
mytext[x] = mytext[x] + "<p><b>Can you tell which box this food came out of?</b></p>";
mytext2[x] = "Click on the box you think it is";
x++;


// level 2 variables
mymainpic[x] = "main-2.jpg";
mysubpic1[x] = "box1a.jpg";
mysubpic1b[x] = "box1b.jpg";
mysubpic2[x] = "box18a.jpg";
mysubpic2b[x] = "box18b.jpg";
mysubpic3[x] = "box32a.jpg";
mysubpic3b[x] = "box32b.jpg";
myrightans[x] = 1;
myrightanspic[x] = "a2.jpg";
myrightansqpic[x] = "ans-2.jpg";
mytext[x] = "I've made these lovely looking dollops of.. erm... what is it again?";
mytext2[x] = "Click on an option";
x++;

// level 3 variables
mymainpic[x] = "main-3.jpg";
mysubpic1[x] = "box13a.jpg";
mysubpic1b[x] = "box13b.jpg";
mysubpic2[x] = "box5a.jpg";
mysubpic2b[x] = "box5b.jpg";
mysubpic3[x] = "box19a.jpg";
mysubpic3b[x] = "box19b.jpg";
myrightans[x] = 2;
myrightanspic[x] = "a3.jpg";
myrightansqpic[x] = "ans-3.jpg";
mytext[x] = "I really don't think there is a technique in which this could come out of the box as anything but a mess.  But what is it?";
mytext2[x] = "Click on a box";
x++;

// level 4 variables
mymainpic[x] = "main-4.jpg";
mysubpic1[x] = "box12a.jpg";
mysubpic1b[x] = "box12b.jpg";
mysubpic2[x] = "box26a.jpg";
mysubpic2b[x] = "box26b.jpg";
mysubpic3[x] = "box29a.jpg";
mysubpic3b[x] = "box29b.jpg";
myrightans[x] = 1;
myrightanspic[x] = "a4.jpg";
myrightansqpic[x] = "ans-4.jpg";
mytext[x] = "Yummy yummy yum yum yum. If you don't look at what's going into your mouth, this one actually tasted surprisingly good. That said, it did cost about twice the price and you get half the amount of a home made one.";
mytext2[x] = "Click on what you think it is";
x++;

// level 5 variables
mymainpic[x] = "main-5.jpg";
mysubpic1[x] = "box7a.jpg";
mysubpic1b[x] = "box7b.jpg";
mysubpic2[x] = "box25a.jpg";
mysubpic2b[x] = "box25b.jpg";
mysubpic3[x] = "box27a.jpg";
mysubpic3b[x] = "box27b.jpg";
myrightans[x] = 1;
myrightanspic[x] = "a5.jpg";
myrightansqpic[x] = "ans-5.jpg";
mytext[x] = "One of the two and a half meals that went to waste during the course of making this quiz. See if you can guess what the others were while you play.  And what is this?";
mytext2[x] = "Click on a box";
x++;

// level 6 variables
mymainpic[x] = "main-6.jpg";
mysubpic1[x] = "box14a.jpg";
mysubpic1b[x] = "box14b.jpg";
mysubpic2[x] = "box3a.jpg";
mysubpic2b[x] = "box3b.jpg";
mysubpic3[x] = "box31a.jpg";
mysubpic3b[x] = "box31b.jpg";
myrightans[x] = 2;
myrightanspic[x] = "a6.jpg";
myrightansqpic[x] = "ans-6.jpg";
mytext[x] = "Okay, a bit different now.  This is the food exactly as it comes out of the microwave.  Can you tell what it is at this stage?";
mytext2[x] = "Click on some cardboard with pictures printed on it";
x++;

// level 7 variables
mymainpic[x] = "main-7.jpg";
mysubpic1[x] = "box22a.jpg";
mysubpic1b[x] = "box22b.jpg";
mysubpic2[x] = "box30a.jpg";
mysubpic2b[x] = "box30b.jpg";
mysubpic3[x] = "box8a.jpg";
mysubpic3b[x] = "box8b.jpg";
myrightans[x] = 3;
myrightanspic[x] = "a7.jpg";
myrightansqpic[x] = "ans-7.jpg";
mytext[x] = "5 minutes...bzzz 4...bzzz 3...bzz 2...bzz 1...bzz  beep beep beep.  What has just cooked?";
mytext2[x] = "Click on an option";
x++;

// level 8 variables
mymainpic[x] = "main-8.jpg";
mysubpic1[x] = "box16a.jpg";
mysubpic1b[x] = "box16b.jpg";
mysubpic2[x] = "box17a.jpg";
mysubpic2b[x] = "box17b.jpg";
mysubpic3[x] = "box9a.jpg";
mysubpic3b[x] = "box9b.jpg";
myrightans[x] = 3;
myrightanspic[x] = "a8.jpg";
myrightansqpic[x] = "ans-8.jpg";
mytext[x] = "What is this? What is this? What is this? What is this? What is this? What is this? Well?";
mytext2[x] = "Click on a box";
x++;

// level 9 variables
mymainpic[x] = "main-9.jpg";
mysubpic1[x] = "box15a.jpg";
mysubpic1b[x] = "box15b.jpg";
mysubpic2[x] = "box10a.jpg";
mysubpic2b[x] = "box10b.jpg";
mysubpic3[x] = "box2a.jpg";
mysubpic3b[x] = "box2b.jpg";
myrightans[x] = 2;
myrightanspic[x] = "a9.jpg";
myrightansqpic[x] = "ans-9.jpg";
mytext[x] = "But what about <b>before the meals are even cooked</b>, hmm?  This is what fell out of the box, but what box did it fall out of?";
mytext2[x] = "Click on an clickety area";
x++;

// level 10 variables
mymainpic[x] = "main-11.jpg";
mysubpic1[x] = "box5a.jpg";
mysubpic1b[x] = "box5b.jpg";
mysubpic2[x] = "box23a.jpg";
mysubpic2b[x] = "box23b.jpg";
mysubpic3[x] = "box6a.jpg";
mysubpic3b[x] = "box6b.jpg";
myrightans[x] = 3;
myrightanspic[x] = "a10.jpg";
myrightansqpic[x] = "ans-11.jpg";
mytext[x] = "This certainly looks good enough to eat raw.  But what could it possibly be?";
mytext2[x] = "Press one! Press one now!!!";
x++;

// level 11 variables
mymainpic[x] = "main-12.jpg";
mysubpic1[x] = "left.jpg";
mysubpic1b[x] = "left2.jpg";
mysubpic2[x] = "right.jpg";
mysubpic2b[x] = "right2.jpg";
mysubpic3[x] = "both.jpg";
mysubpic3b[x] = "both2.jpg";
myrightans[x] = 2;
myrightanspic[x] = "a11.jpg";
myrightansqpic[x] = "ans-12.jpg";
mytext[x] = "New round.  Can you spot a ready meal from a <b>home cooked meal</b>?  My mum cooked one of these and it was lovely, the other was a microwave one and it was 'a bit chewy'.  But which is which?";
mytext2[x] = "Click on an option";
x++;

// level 12 variables
mymainpic[x] = "main-11b.jpg";
mysubpic1[x] = "left.jpg";
mysubpic1b[x] = "left2.jpg";
mysubpic2[x] = "right.jpg";
mysubpic2b[x] = "right2.jpg";
mysubpic3[x] = "both.jpg";
mysubpic3b[x] = "both2.jpg";
myrightans[x] = 3;
myrightanspic[x] = "a12.jpg";
myrightansqpic[x] = "ans-11b.jpg";
mytext[x] = "Two baked potato meals.  One with beans, and one with chilli.  But which is a ready meal?";
mytext2[x] = "Click on an option";
x++;

// level 13 variables
mymainpic[x] = "main-13.jpg";
mysubpic1[x] = "left.jpg";
mysubpic1b[x] = "left2.jpg";
mysubpic2[x] = "right.jpg";
mysubpic2b[x] = "right2.jpg";
mysubpic3[x] = "both.jpg";
mysubpic3b[x] = "both2.jpg";
myrightans[x] = 1;
myrightanspic[x] = "a13.jpg";
myrightansqpic[x] = "ans-13.jpg";
mytext[x] = "Okay.  How about pizzas?  Can you tell which of these was done in a microwave and which was a <b>take out</b>?";
mytext2[x] = "Click on an option";
x++;

// level 14 variables
mymainpic[x] = "main-14.jpg";
mysubpic1[x] = "left.jpg";
mysubpic1b[x] = "left2.jpg";
mysubpic2[x] = "right.jpg";
mysubpic2b[x] = "right2.jpg";
mysubpic3[x] = "both.jpg";
mysubpic3b[x] = "both2.jpg";
myrightans[x] = 2;
myrightanspic[x] = "a14.jpg";
myrightansqpic[x] = "ans-14.jpg";
mytext[x] = "Which of these came from the bakers and which came in a plastic wrapper from the corner shop and microwaved?";
mytext2[x] = "Click on an option";
x++;

// level 15 variables
mymainpic[x] = "main-15.jpg";
mysubpic1[x] = "left.jpg";
mysubpic1b[x] = "left2.jpg";
mysubpic2[x] = "right.jpg";
mysubpic2b[x] = "right2.jpg";
mysubpic3[x] = "both.jpg";
mysubpic3b[x] = "both2.jpg";
myrightans[x] = 2;
myrightanspic[x] = "a15.jpg";
myrightansqpic[x] = "ans-15.jpg";
mytext[x] = "Final round now.  Which of these is a ready meal and which is some <b>dog food</b>?";
mytext2[x] = "Click on an option";
x++;


// preload images for end here
mysubpic1[x] = sc+".jpg";
mysubpic1b[x] =(sc+1)+".jpg";




function randOrd(){
return (Math.round(Math.random())-0.5); }


////////////////////////////////////////////////////////////////////////////////


function newquestion()
{


// detect if someone has refreshed the page. If so, back to level 1
if (rgt==0) {
q=0;
sc=0;
document.getElementById('rm-lastpics').style.display="none";
}
else {
document.getElementById('rm-lastpics').style.display="block";
}

if (rgt==1) {
document.getElementById('rm-marks').innerHTML="CORRECT!";
}

if (rgt==2) {
document.getElementById('rm-marks').innerHTML="WRONG!";
}

q++;

Set_Cookie( 'q', q, 30, '/', '', '' );

if (q<16) {

document.getElementById('rm-level').innerHTML=""+q;
document.getElementById('rm-answersright').innerHTML=""+sc;
document.getElementById('rm-answerssofar').innerHTML=""+(q-1);

var numb=q-1;
document.getElementById('rm-textbox').innerHTML=mytext[numb];
document.getElementById('rm-mainpic2').src=mymainpic[numb];
document.getElementById('rm-lastq2').src=myrightansqpic[numb-1];
document.getElementById('rm-lasta2').src=myrightanspic[numb-1];
document.getElementById('rm-box1pic').src=mysubpic1[numb];
document.getElementById('rm-box2pic').src=mysubpic2[numb];
document.getElementById('rm-box3pic').src=mysubpic3[numb];
document.getElementById('rm-basetext').innerHTML=mytext2[numb];

var bit1="<img src='"+mymainpic[numb+1]+"'>";
var bit2="<img src='"+myrightansqpic[numb]+"'>";
var bit3="<img src='"+myrightanspic[numb]+"'>";
var bit4="<img src='"+mysubpic1[numb+1]+"'>";
var bit5="<img src='"+mysubpic2[numb+1]+"'>";
var bit6="<img src='"+mysubpic3[numb+1]+"'>";


document.getElementById('preloadarea').innerHTML=bit1+bit2+bit3+bit4+bit5+bit6;


rgt=0;
Set_Cookie( 'rgt', rgt, 30, '/', '', '' );
}

else {
var numb=q-1;


document.getElementById('rm-levelbox').innerHTML="Ping!";
document.getElementById('rm-lastq2').src=myrightansqpic[numb-1];
document.getElementById('rm-lasta2').src=myrightanspic[numb-1];
document.getElementById('rm-mainpic2').src=sc+".jpg";
document.getElementById('rm-answersright').innerHTML=""+sc;
document.getElementById('rm-answerssofar').innerHTML=""+(q-1);
document.getElementById('rm-basetext').innerHTML="Click to play again";
document.getElementById('rm-box1pic').src="again1.jpg";
document.getElementById('rm-box2pic').src="again1.jpg";
document.getElementById('rm-box3pic').src="again1.jpg";

document.getElementById('rm-textbox').innerHTML="Congratulations, you scored <b>"+sc+" out of a possible 15</b>.  That result can be seen illustrated in binary by the eggs to the left.";

rgt=0;
Set_Cookie( 'rgt', rgt, 30, '/', '', '' );

}

}


function closeup(bit,bit2){
var num=q-1;

if (bit2==1){
document.getElementById(bit).style.border="1px solid #000";
}
if (bit2==2){
document.getElementById(bit).style.border="1px solid #000";
}
if (bit2==3){
document.getElementById(bit).style.border="1px solid #000";

}
}

function closeout(bit,bit2) {
var num=q-1;

if (bit2==1){
document.getElementById(bit).style.border="1px solid #fff";
}
if (bit2==2){
document.getElementById(bit).style.border="1px solid #fff";
}
if (bit2==3){
document.getElementById(bit).style.border="1px solid #fff";
}

}

function clickoption(bit) {
var num=q-1;


if (q>15) {
// reset the scores so that clicking an answer starts again
rgt=0;
q=0;
sc=0;
Set_Cookie( 'rgt', rgt, 30, '/', '', '' );
Set_Cookie( 'q', q, 30, '/', '', '' );
Set_Cookie( 'sc', sc, 30, '/', '', '' );
reloadpage();
}

else {

if (bit==myrightans[num]) {
// rrrrrrright!
sc++;
Set_Cookie( 'sc', sc, 30, '/', '', '' );
rgt=1;
Set_Cookie( 'rgt', rgt, 30, '/', '', '' );
}
else {
// wrong answer
rgt=2;
Set_Cookie( 'rgt', rgt, 30, '/', '', '' );
}
newquestion();

}
}

////////////////////////////////////////////////////////////////////////////////





////////////////////////////////////////////////////////////////////////////////



function removeallcookies()
{
Delete_Cookie('q','/');
Delete_Cookie('sc','/');
reloadpage();
}

function reloadpage()
{
window.location.reload();
}



