//Calculator-------------------------------------------------------
function number(form,key){
if ((key==".")&&(point==0))  {key="";}
if (key=="."){point=0;}
if (key!="c"){total+=key;}
else{ total="";key="";point=1}
if(clear==1)total=key;clear=0;
form.name.value = total;
}

function calc_code(calc_char){
document.calc.calc_ans.focus();
backspace=document.calc.calc_ans.value;
//alert(backspace.length);
if (calc_char=="b")document.calc.calc_ans.value=backspace.slice(0,backspace.length-1);
else document.calc.calc_ans.value+=calc_char;
}



function check_calc(form) {
answer1=form.calc_ans.value.toLowerCase();
if(answer1==calc_solution1||answer1==calc_solution2||answer1==calc_solution3||answer1==calc_solution4||answer1==calc_solution5){alert('Well done!\nYou cracked it.');return false};

if(!confirm("You have not found the correct answer\n\nClick okay to keep trying.\nClick cancel to see the answer "))form.calc_ans.value=calc_solution1;

form.calc_ans.focus();
return false;
}

calc_map="<MAP NAME='pad'> <AREA SHAPE='rect' ALT='7' COORDS='2,2,23,25' HREF='javascript:number(this.document.calc,&quot;7&quot;)'> <AREA SHAPE='rect' ALT='8' COORDS='26,2,50,25' HREF='javascript:number(document.calc,&quot;8&quot;)'> <AREA SHAPE='rect' ALT='9' COORDS='51,2,75,25' HREF='javascript:number(document.calc,&quot;9&quot;)'> <AREA SHAPE='rect' ALT='4' COORDS='2,30,25,51' HREF='javascript:number(document.calc,&quot;4&quot;)'> <AREA SHAPE='rect' ALT='5' COORDS='26,30,50,51' HREF='javascript:number(document.calc,&quot;5&quot;)'> <AREA SHAPE='rect' ALT='6' COORDS='51,30,75,51' HREF='javascript:number(document.calc,&quot;6&quot;)'> <AREA SHAPE='rect' ALT='1' COORDS='2,55,25,80' HREF='javascript:number(document.calc,&quot;1&quot;)'> <AREA SHAPE='rect' ALT='2' COORDS='26,55,50,80' HREF='javascript:number(document.calc,&quot;2&quot;)'> <AREA SHAPE='rect' ALT='3' COORDS='52,55,75,80' HREF='javascript:number(document.calc,&quot;3&quot;)'> <AREA SHAPE='rect' ALT='0' COORDS='2,80,50,105' HREF='javascript:number(document.calc,&quot;0&quot;)'> <AREA SHAPE='rect' ALT='.' COORDS='50,80,75,105' HREF='javascript:number(document.calc,&quot;.&quot;)'> <AREA SHAPE='rect' ALT='cancel' COORDS='75,2,100,51' HREF='javascript:number(document.calc,&quot;c&quot;)'> <AREA SHAPE='rect' ALT='=' COORDS='75,55,100,105' HREF='javascript:calc(document.calc)'> </MAP>";


calc_chars2="<MAP NAME='chars_map'> <AREA SHAPE='rect' COORDS='135,1,148,10' alt='Delete' HREF='javascript:calc_code(&quot;b&quot;)'> <AREA SHAPE='rect' COORDS='3,13,14,28' HREF='javascript:calc_code(&quot;x&quot;)'> <AREA SHAPE='rect' COORDS='16,13,27,28' HREF='javascript:calc_code(&quot;0&quot;)'> <AREA SHAPE='rect' COORDS='29,13,40,28' HREF='javascript:calc_code(&quot;1&quot;)'> <AREA SHAPE='rect' COORDS='42,13,53,28' HREF='javascript:calc_code(&quot;2&quot;)'> <AREA SHAPE='rect' COORDS='55,13,66,28' HREF='javascript:calc_code(&quot;3&quot;)'> <AREA SHAPE='rect' COORDS='68,13,79,28' HREF='javascript:calc_code(&quot;4&quot;)'> <AREA SHAPE='rect' COORDS='81,13,92,28' HREF='javascript:calc_code(&quot;5&quot;)'> <AREA SHAPE='rect' COORDS='94,13,105,28' HREF='javascript:calc_code(&quot;6&quot;)'> <AREA SHAPE='rect' COORDS='107,13,118,28' HREF='javascript:calc_code(&quot;7&quot;)'> <AREA SHAPE='rect' COORDS='120,13,131,28' HREF='javascript:calc_code(&quot;8&quot;)'> <AREA SHAPE='rect' COORDS='133,13,144,28' HREF='javascript:calc_code(&quot;9&quot;)'> <AREA SHAPE='rect' COORDS='3,30,14,45' HREF='javascript:calc_code(&quot;.&quot;)'> <AREA SHAPE='rect' COORDS='16,30,27,45' HREF='javascript:calc_code(&quot;²&quot;)'> <AREA SHAPE='rect' COORDS='29,30,40,45' HREF='javascript:calc_code(&quot;³&quot;)'> <AREA SHAPE='rect' COORDS='42,30,53,45' HREF='javascript:calc_code(&quot;+&quot;)'> <AREA SHAPE='rect' COORDS='55,30,66,45' HREF='javascript:calc_code(&quot;&#45;&quot;)'> <AREA SHAPE='rect' COORDS='68,30,79,45' HREF='javascript:calc_code(&quot;&times;&quot;)'> <AREA SHAPE='rect' COORDS='81,30,92,45' HREF='javascript:calc_code(&quot;&divide;&quot;)'> <AREA SHAPE='rect' COORDS='94,30,105,45' HREF='javascript:calc_code(&quot;(&quot;)'> <AREA SHAPE='rect' COORDS='107,30,118,45' HREF='javascript:calc_code(&quot;)&quot;)'> <AREA SHAPE='rect' COORDS='120,30,131,45' HREF='javascript:calc_code(&quot;&#40;&quot;)'> <AREA SHAPE='rect' COORDS='133,30,144,45' HREF='javascript:calc_code(&quot;&#41;&quot;)'></MAP>";


//---------------Bears n buns-------------------------------------------
function bun(x){
//sequence=new Array(12,2,25,14,6);  now defined in games.html
if (x==sequence[f]&count<3){
eval("self.document.slab"+x+".src='../images/"+prize2+".gif'");
f++;
if (f==5&count==0)alert("Well done\nYou found all five "+prize+"\nand woke no "+danger+"s!"); 
if (f==5&count==1)alert("Well done\nYou found all five "+prize+"\nand woke only one "+danger+"."); 
if (f==5&count==2)alert("Well done\nYou found all five "+prize+"\nbut you woke two "+danger+"s!"); 
}
else {eval("self.document.slab"+x+".src='../images/"+danger+".gif'");
count++
if (count<3){alert("Oops!\nTry that one again.");
}
if (f<5&count==3){alert("Bad luck\nYou've woken three "+danger+"s!\nThey've moved all their other "+prize+" now!\n\nClick okay to clear the board for another attempt.\nRemember to find the "+prize+" in the correct order.");
init();}
}
}

function setUp() {
//alert('got here');
count=0;
f=0;
bun_count=1;
while (bun_count<26){
eval("self.document.slab"+bun_count+".src='../images/"+slab+".gif'");
bun_count++;
}
}



grid="<TABLE cellspacing=0 cellpadding=0><TR> <TD><a href='javascript:bun(1)'><img src='' name='slab1' width=40 height=40 alt='(1,5) Is it here?'></a></TD> <TD><a href='javascript:bun(2)'><img src='' name='slab2' name='slab3' width=40 height=40 alt='(2,5) Is it here?'></a></TD> <TD><a href='javascript:bun(3)'><img src='' name='slab3' width=40 height=40 alt='(3,5) Is it here?'></a></TD> <TD><a href='javascript:bun(4)'><img src='' name='slab4' width=40 height=40 alt='(4,5) Is it here?'></a></TD> <TD><a href='javascript:bun(5)'><img src='' name='slab5' width=40 height=40 alt='(5,5) Is it here?'></a></TD> </TR> <TR> <TD><a href='javascript:bun(6)'><img src='' name='slab6' width=40 height=40 alt='(1,4) Is it here?'></a></TD> <TD><a href='javascript:bun(7)'><img src='' name='slab7' width=40 height=40 alt='(2,4) Is it here?'></a></TD> <TD><a href='javascript:bun(8)'><img src='' name='slab8' width=40 height=40 alt='(3,4) Is it here?'></a></TD> <TD><a href='javascript:bun(9)'><img src='' name='slab9' width=40 height=40 alt='(4,4) Is it here?'></a></TD> <TD><a href='javascript:bun(10)'><img src='' name='slab10' width=40 height=40 alt='(5,4) Is it here?'></a></TD> </TR> <TR> <TD><a href='javascript:bun(11)'><img src='' name='slab11' width=40 height=40 alt='(1,3) Is it here?'></a></TD> <TD><a href='javascript:bun(12)'><img src='' name='slab12' width=40 height=40 alt='(2,3) Is it here?'></a></TD> <TD><a href='javascript:bun(13)'><img src='' name='slab13' width=40 height=40 alt='(3,3) Is it here?'></a></TD> <TD><a href='javascript:bun(14)'><img src='' name='slab14' width=40 height=40 alt='(4,3) Is it here?'></a></TD> <TD><a href='javascript:bun(15)'><img src='' name='slab15' width=40 height=40 alt='(5,3) Is it here?'></a></TD> </TR> <TR> <TD><a href='javascript:bun(16)'><img src='' name='slab16' width=40 height=40 alt='(1,2) Is it here?'></a></TD> <TD><a href='javascript:bun(17)'><img src='' name='slab17' width=40 height=40 alt='(2,2) Is it here?'></a></TD> <TD><a href='javascript:bun(18)'><img src='' name='slab18' width=40 height=40 alt='(3,2) Is it here?'></a></TD> <TD><a href='javascript:bun(19)'><img src='' name='slab19' width=40 height=40 alt='(4,2) Is it here?'></a></TD> <TD><a href='javascript:bun(20)'><img src='' name='slab20' width=40 height=40 alt='(5,2) Is it here?'></a></TD> </TR> <TR> <TD><a href='javascript:bun(21)'><img src='' name='slab21' width=40 height=40 alt='(1,1) Is it here?'></a></TD> <TD><a href='javascript:bun(22)'><img src='' name='slab22' width=40 height=40 alt='(2,1) Is it here?'></a></TD> <TD><a href='javascript:bun(23)'><img src='' name='slab23' width=40 height=40 alt='(3,1) Is it here?'></a></TD> <TD><a href='javascript:bun(24)'><img src='' name='slab24' width=40 height=40 alt='(4,1) Is it here?'></a></TD> <TD><a href='javascript:bun(25)'><img src='' name='slab25' width=40 height=40 alt='(5,1) Is it here?'></a></TD> </TR> </TABLE>";

//---------------Crossword-------------------------------------------
function check_across(form) {
cross_count1=0;
while (cross_count1<100){ 
//take out next line
//if((eval("self.document.table.cross"+cross_count1+".value.toUpperCase()")==""))eval("self.document.table.cross"+cross_count1+".value=' '");
if((eval("self.document.table.cross"+cross_count1+".value.toUpperCase()")!=answer[cross_count1])){ if(!confirm("You have not completed the crossword correctly\n\nClick okay to keep trying.\nClick cancel to see the answer "))fill_across(answer);return false; }
cross_count1++;}
alert("Well done\n\nAll correct");
return false;
}



cross="<FONT face='Arial, Helvetica, sans-serif';Font size=3><B>Maths Crossword</B></font> <FORM name=table  onSubmit='return check_across(this)'> <TABLE cellspacing=0 cellpadding=0 border=0 ALIGN=RIGHT> <TR><td></td><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>a</font></td><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>b</font></td><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>c</font></td><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>d</font></td><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>e</font></td><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>f</font></td><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>g</font></td><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>h</font></td><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>i</font></td><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>j</font></td><td width=40 rowspan=6></td></TR> <TR><td align=center width=20><FONT face='Arial, Helvetica, sans-serif';Font size=1>1</font></td><TD><input name=cross0 size=1 maxlength=1></INPUT></td><TD><input name=cross1 size=1 maxlength=1></INPUT></td><TD><input name=cross2 size=1 maxlength=1></INPUT></td><TD><input name=cross3 size=1 maxlength=1></INPUT></td><TD><input name=cross4 size=1 maxlength=1></INPUT></td><TD><input name=cross5 size=1 maxlength=1></INPUT></td><TD><input name=cross6 size=1 maxlength=1></INPUT></td><TD><input name=cross7 size=1 maxlength=1></INPUT></td><TD><input name=cross8 size=1 maxlength=1></INPUT></td><TD><input name=cross9 size=1 maxlength=1></INPUT></td></TR> <TR><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>2</font></td> <TD><input name=cross10 size=1 maxlength=1></INPUT></td><TD><input name=cross11 size=1 maxlength=1></INPUT></td><TD><input name=cross12 size=1 maxlength=1></INPUT></td><TD><input name=cross13 size=1 maxlength=1></INPUT></td><TD><input name=cross14 size=1 maxlength=1></INPUT></td><TD><input name=cross15 size=1 maxlength=1></INPUT></td><TD><input name=cross16 size=1 maxlength=1></INPUT></td><TD><input name=cross17 size=1 maxlength=1></INPUT></td><TD><input name=cross18 size=1 maxlength=1></INPUT></td><TD><input name=cross19 size=1 maxlength=1></INPUT></td></TR> <TR><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>3</font></td><TD><input name=cross20 size=1 maxlength=1></INPUT></td><TD><input name=cross21 size=1 maxlength=1></INPUT></td><TD><input name=cross22 size=1 maxlength=1></INPUT></td><TD><input name=cross23 size=1 maxlength=1></INPUT></td><TD><input name=cross24 size=1 maxlength=1></INPUT></td><TD><input name=cross25 size=1 maxlength=1></INPUT></td><TD><input name=cross26 size=1 maxlength=1></INPUT></td><TD><input name=cross27 size=1 maxlength=1></INPUT></td><TD><input name=cross28 size=1 maxlength=1></INPUT></td><TD><input name=cross29 size=1 maxlength=1></INPUT></td></TR> <TR><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>4</font></td><TD><input name=cross30 size=1 maxlength=1></INPUT></td><TD><input name=cross31 size=1 maxlength=1></INPUT></td><TD><input name=cross32 size=1 maxlength=1></INPUT></td><TD><input name=cross33 size=1 maxlength=1></INPUT></td><TD><input name=cross34 size=1 maxlength=1></INPUT></td><TD><input name=cross35 size=1 maxlength=1></INPUT></td><TD><input name=cross36 size=1 maxlength=1></INPUT></td><TD><input name=cross37 size=1 maxlength=1></INPUT></td><TD><input name=cross38 size=1 maxlength=1></INPUT></td><TD><input name=cross39 size=1 maxlength=1></INPUT></td></TR> <TR><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>5</font></td><TD><input name=cross40 size=1 maxlength=1></INPUT></td><TD><input name=cross41 size=1 maxlength=1></INPUT></td><TD><input name=cross42 size=1 maxlength=1></INPUT></td><TD><input name=cross43 size=1 maxlength=1></INPUT></td><TD><input name=cross44 size=1 maxlength=1></INPUT></td><TD><input name=cross45 size=1 maxlength=1></INPUT></td><TD><input name=cross46 size=1 maxlength=1></INPUT></td><TD><input name=cross47 size=1 maxlength=1></INPUT></td><TD><input name=cross48 size=1 maxlength=1></INPUT></td><TD><input name=cross49 size=1 maxlength=1></INPUT></td></TR> <TR><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>6</font></td><TD><input name=cross50 size=1 maxlength=1></INPUT></td><TD><input name=cross51 size=1 maxlength=1></INPUT></td><TD><input name=cross52 size=1 maxlength=1></INPUT></td><TD><input name=cross53 size=1 maxlength=1></INPUT></td><TD><input name=cross54 size=1 maxlength=1></INPUT></td><TD><input name=cross55 size=1 maxlength=1></INPUT></td><TD><input name=cross56 size=1 maxlength=1></INPUT></td><TD><input name=cross57 size=1 maxlength=1></INPUT></td><TD><input name=cross58 size=1 maxlength=1></INPUT></td><TD><input name=cross59 size=1 maxlength=1></INPUT></td></TR> <TR><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>7</font></td><TD><input name=cross60 size=1 maxlength=1></INPUT></td><TD><input name=cross61 size=1 maxlength=1></INPUT></td><TD><input name=cross62 size=1 maxlength=1></INPUT></td><TD><input name=cross63 size=1 maxlength=1></INPUT></td><TD><input name=cross64 size=1 maxlength=1></INPUT></td><TD><input name=cross65 size=1 maxlength=1></INPUT></td><TD><input name=cross66 size=1 maxlength=1></INPUT></td><TD><input name=cross67 size=1 maxlength=1></INPUT></td><TD><input name=cross68 size=1 maxlength=1></INPUT></td><TD><input name=cross69 size=1 maxlength=1></INPUT></td></TR> <TR><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>8</font></td><TD><input name=cross70 size=1 maxlength=1></INPUT></td><TD><input name=cross71 size=1 maxlength=1></INPUT></td><TD><input name=cross72 size=1 maxlength=1></INPUT></td><TD><input name=cross73 size=1 maxlength=1></INPUT></td><TD><input name=cross74 size=1 maxlength=1></INPUT></td><TD><input name=cross75 size=1 maxlength=1></INPUT></td><TD><input name=cross76 size=1 maxlength=1></INPUT></td><TD><input name=cross77 size=1 maxlength=1></INPUT></td><TD><input name=cross78 size=1 maxlength=1></INPUT></td><TD><input name=cross79 size=1 maxlength=1></INPUT></td></TR> <TR><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>9</font></td><TD><input name=cross80 size=1 maxlength=1></INPUT></td><TD><input name=cross81 size=1 maxlength=1></INPUT></td><TD><input name=cross82 size=1 maxlength=1></INPUT></td><TD><input name=cross83 size=1 maxlength=1></INPUT></td><TD><input name=cross84 size=1 maxlength=1></INPUT></td><TD><input name=cross85 size=1 maxlength=1></INPUT></td><TD><input name=cross86 size=1 maxlength=1></INPUT></td><TD><input name=cross87 size=1 maxlength=1></INPUT></td><TD><input name=cross88 size=1 maxlength=1></INPUT></td><TD><input name=cross89 size=1 maxlength=1></INPUT></td></TR> <TR><td align=center><FONT face='Arial, Helvetica, sans-serif';Font size=1>10</font></td><TD><input name=cross90 size=1 maxlength=1></INPUT></td><TD><input name=cross91 size=1 maxlength=1></INPUT></td><TD><input name=cross92 size=1 maxlength=1></INPUT></td><TD><input name=cross93 size=1 maxlength=1></INPUT></td><TD><input name=cross94 size=1 maxlength=1></INPUT></td><TD><input name=cross95 size=1 maxlength=1></INPUT></td><TD><input name=cross96 size=1 maxlength=1></INPUT></td><TD><input name=cross97 size=1 maxlength=1></INPUT></td><TD><input name=cross98 size=1 maxlength=1></INPUT></td><TD><input name=cross99 size=1 maxlength=1></INPUT></td></TR><tr><td colspan=11 align= center height=30 valign=bottom> <INPUT NAME='' TYPE='Submit' value='Check Answers'></INPUT></td><td></td></tr> </TABLE> </FORM>";


 



