
var lom_img=[['choosepackedlunch.png','chooseschooldinner.png','eatwell-starchy-new.png','eatwell-sugary-new.png','eatwell-dairy-new.png','eatwell-protein-new.png','eatwell-veg-new.png','eatwell-new.png','bubble-eatwell.png','bubble-starchy.png','bubble-vegetables.png','bubble-dairy.png','bubble-protein.png','bubble-sugar.png'],['choosesandwich.png','choosebread.png','noididnt.png'],['fillings-protein.png','protein.png','fillings-veg.png','veg.png','fillings-sweet.png','sweet.png','fillings-dairy.png','dairy.png','next.png'],['no-left.png','yes-right.png','sweeties.png','salty.png','fruit.png'],['other-veg.png','other-veg-pic.png','other-dairy.png','other-dairy-pic.png'],['drinks-water.png','water.png','drinks-juice.png','juice.png','drinks-sweet.png','drinks-sweet-pic.png','drinks-milk.png','milk.png']];var eatwelltext={'eatwell':'The eatwell plate makes healthy eating easier to understand by showing the types and proportions of foods we need to have a healthy and well balanced diet.','starchy':'Starchy foods such as bread, cereals, rice, pasta and potatoes are a really important part of a healthy diet, and should make up about a third of the food we eat. Try to choose wholegrain varieties whenever you can.','vegetables':'Fruit and veg should make up about a third of the food you eat each day. Try to eat at least 5 portions of a variety of fruit and veg every day. You can choose from fresh, frozen, tinned, dried or juiced - it might be easier than you think.','dairy':'Milk and dairy products such as cheese, yoghurt and fromage frais are great sources of protein and vitamins A and B12. They&rsquo;re also an important source of calcium, which helps to keep our bones strong. Try to choose healthier, lower fat varieties.','protein':'Protein foods, for example meat, fish, eggs, beans or pulses, build muscles and provide minerals. Oily fish such as sardines, herring, mackerel, trout and salmon are all rich sources of omega 3 fatty acids, which help prevent heart disease.','sugar':'Most adults and children in the UK eat too much sugar. We should all be trying to eat fewer sugary foods, such as sweets, cakes and biscuits, and drink fewer soft drinks. Foods high in fat can cause excessive weight and may lead to heart disease.'}
$(function(){$('body').prepend($('<div/>').attr('id','loading').css({position:'absolute','text-align':'center',left:'0',top:'50px',height:'350px',width:'100%',background:'#fff url(/images/loading.png) no-repeat center 110px','z-Index':100}));var results={'schoolName':'','schoolID':'','groupID':'','userName':'','pl':0,'sd':0,'st-s':0,'st-b':0,'st-n':0,'sf-p':0,'sf-v':0,'sf-d':0,'sf-s':0,'sn-sa':0,'sn-sw':0,'fr':0,'o-p':0,'o-v':0,'o-d':0,'d-m':0,'d-s':0,'d-j':0,'d-w':0};if($('#loginform').length){$('#submitbutton').remove();$('#loginform').append($('<div/>').css({float:'right',marginTop:-30,width:114,height:80,overflow:'hidden',cursor:'pointer',background:'#fff url(/images/start.png) no-repeat 0 0','z-index':100}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){$.post('/',{'start':1,'passkey':$('#passkey').val(),'group':$('#group').val(),'username':$('#username').val()},function(data,textstatus){if(data==0){$('#container').prepend($('<div/>').css({position:'absolute','text-align':'center',left:0,top:50,height:350,width:530,background:'#fff url(/images/login-error.gif) no-repeat center 50px','z-Index':101,'cursor':'pointer'}).click(function(){$('#passkey').val("");$('#loginform').fadeIn('fast');$(this).fadeOut('fast',function(){$(this).remove();});}));}else{results.schoolName=data.values.org.org_name;results.schoolID=data.values.org.org_id;results.groupID=data.values.group||0;results.userName=data.values.username||'';$('#paneltext').html('<span style="color:#090">'+results.schoolName+'</span><br />(<a href=\"/\">Click here if this isn\'t your school</a>)');$('#panel').append('<img id="eatwell" usemap="#eatwellmap" width="200" height="165" style="margin:10px 25px" title="This image (the Eatwell plate) shows the proportions of each type of food you should have to maintain a healthy, balanced diet" src="/images/eatwell-new.png" />');$('area').click(function(){var key=$(this).attr('href').substr(1);thoughtBubble(key);return false;});$.preload(lom_img[0],{'base':'/images/','onFinish':function(hash){$('#loading').fadeOut('slow');goToPage(1);}});}},"json");$('#loginform').fadeOut('fast');}));$('#loading').hide();}
function goToPage(no,fDir){if(no<lom_img.length){$.preload(lom_img[no],{'base':'/images/'});}
$('#container').children(":not(#panel)").remove();switch(fDir){case'l':startX=-850;startY=0;break;case'r':startX=850;startY=0;break;case't':startX=0;startY=-500;break;case'b':startX=0;startY=500;break;default:startX=-850;startY=0;break;}
var offset={left:0,top:100};var nextpage;switch(no){case 1:offset={left:0,top:100};$('<div/>').css({background:'#fff url(/images/choosepackedlunch.png) no-repeat 0px 0px',width:500,height:100,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){results.pl=1;$(this).animate({left:'-850px'},'slow','swing',function(){goToPage(2,'r');}).siblings(":not(:first)").animate({left:'-850px',opacity:0},'slow','swing');}).appendTo('#container').animate(offset);offset={left:0,top:230};$('<div/>').css({background:'#fff url(/images/chooseschooldinner.png) no-repeat 0px 0px',width:500,height:100,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){results.pl=0;$(this).animate({left:'850px'},'slow','swing',function(){goToPage(2,'l');}).siblings(":not(:first)").animate({left:'850px',opacity:0},'slow','swing');}).appendTo('#container').animate(offset);break;case 2:$("#eatwell").attr("src","/images/eatwell-starchy-new.png");$('#eatwellLink').click(function(){thoughtBubble(eatwelltext.starchy);return false;});$("<p class=\"question\">Did you have any starchy food in your lunch today?</p>").appendTo('#container');offset={left:0,top:100};$('<div/>').css({background:'#fff url(/images/choosesandwich.png) no-repeat 0px 0px',width:500,height:100,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){results['st-s']=1;$(this).animate({left:850},'slow','swing',function(){goToPage(3,'l');}).siblings(":not(:first)").animate({left:850,opacity:0},'slow','swing');}).appendTo('#container').animate(offset);offset={left:0,top:200};$('<div/>').css({background:'#fff url(/images/choosebread.png) no-repeat 0px 0px',width:500,height:160,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -200px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){results['st-b']=1;$(this).animate({top:-500},'slow','swing',function(){nextpage=(results.pl==0)?10:7;goToPage(nextpage,'b');}).siblings(":not(:first)").animate({top:-500,opacity:0},'slow','swing');}).appendTo('#container').animate(offset);offset={left:310,top:300};$('<div/>').css({background:'#fff url(/images/noididnt.png) no-repeat 0px 0px',width:190,height:80,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){results['st-n']=1;$(this).animate({left:-850},'slow','swing',function(){nextpage=(results.pl==0)?10:7;goToPage(nextpage,'t');}).siblings(":not(:first)").animate({left:-850,opacity:0},'slow','swing');}).appendTo('#container').animate(offset);break;case 3:$("#eatwell").attr("src","/images/eatwell-new.png");$("<p class=\"question\">What did you have in your sandwich/wrap?</p>").appendTo('#container');offset={left:0,top:100};$('<div/>').css({background:'#fff url(/images/fillings-protein.png) no-repeat 120px 0px',width:500,height:85,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).append($('<div/>').css({background:'#fff url(/images/protein.png) no-repeat 0px 0px',width:109,height:80,overflow:'hidden',position:'absolute',left:0,top:0})).hover(function(){$(this).css({'background-position':'120px -150px'});$("#eatwell").attr("src","/images/eatwell-protein-new.png");},function(){if(!results['sf-p']){$(this).css({'background-position':'120px 0'});}$("#eatwell").attr("src","/images/eatwell-new.png");}).click(function(){if(results['sf-p']){$(":first",this).css({'background-position':'0 0'});results['sf-p']=0;}else{$(":first",this).css({'background-position':'0 -150px'});results['sf-p']=1;}}).appendTo('#container').animate(offset);offset={left:0,top:180};$('<div/>').css({background:'#fff url(/images/fillings-veg.png) no-repeat 0px 0px',width:500,height:80,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).append($('<div/>').css({background:'#fff url(/images/veg.png) no-repeat 0px 0px',width:76,height:70,overflow:'hidden',position:'absolute',left:410,top:0})).hover(function(){$(this).css({'background-position':'0px -150px'});$("#eatwell").attr("src","/images/eatwell-veg-new.png");},function(){if(!results['sf-v']){$(this).css({'background-position':'0 0'});}$("#eatwell").attr("src","/images/eatwell-new.png");}).click(function(){if(results['sf-v']){$(":first",this).css({'background-position':'0 0'});results['sf-v']=0;}else{$(":first",this).css({'background-position':'0 -150px'});results['sf-v']=1;}}).appendTo('#container').animate(offset);offset={left:0,top:260};$('<div/>').css({background:'#fff url(/images/fillings-sweet.png) no-repeat 92px 0px',width:500,height:85,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).append($('<div/>').css({background:'#fff url(/images/sweet.png) no-repeat 0px 0px',width:90,height:80,overflow:'hidden',position:'absolute',left:0,top:0})).hover(function(){$(this).css({'background-position':'92px -150px'});$("#eatwell").attr("src","/images/eatwell-sugary-new.png");},function(){if(!results['sf-s']){$(this).css({'background-position':'92px 0'});}$("#eatwell").attr("src","/images/eatwell-new.png");}).click(function(){if(results['sf-s']){$(":first",this).css({'background-position':'0 0'});results['sf-s']=0;}else{$(":first",this).css({'background-position':'0 -150px'});results['sf-s']=1;}}).appendTo('#container').animate(offset);offset={left:0,top:340};$('<div/>').css({background:'#fff url(/images/fillings-dairy.png) no-repeat 0px 0px',width:500,height:85,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).append($('<div/>').css({background:'#fff url(/images/dairy.png) no-repeat 0px 0px',width:76,height:70,overflow:'hidden',position:'absolute',left:267,top:10})).hover(function(){$(this).css({'background-position':'0px -150px'});$("#eatwell").attr("src","/images/eatwell-dairy-new.png");},function(){if(!results['sf-d']){$(this).css({'background-position':'0 0'});}$("#eatwell").attr("src","/images/eatwell-new.png");}).click(function(){if(results['sf-d']){$(":first",this).css({'background-position':'0 0'});results['sf-d']=0;}else{$(":first",this).css({'background-position':'0 -150px'});results['sf-d']=1;}}).appendTo('#container').animate(offset);offset={left:386,top:340};$('<div/>').css({background:'#fff url(/images/next.png) no-repeat 0px 0px',width:114,height:77,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){$(this).animate({left:-850},'slow','swing',function(){goToPage(4,'r');}).siblings(":not(:first)").animate({left:-850,opacity:0},'slow','swing');}).appendTo('#container').animate(offset);break;case 4:$("#eatwell").attr("src","/images/eatwell-veg-new.png");$('#eatwellLink').click(function(){thoughtBubble(eatwelltext.vegetables);return false;});$("<p class=\"question\">Did you have any fruit with your lunch?</p>").appendTo('#container');offset={left:0,top:140};$('<div/>').css({background:'#fff url(/images/no-left.png) no-repeat 0 0',width:156,height:110,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){$(this).animate({left:850},'slow','swing',function(){nextpage=(results.pl==1)?5:6;goToPage(nextpage,'l');}).siblings(":not(:first)").animate({left:850,opacity:0},'slow','swing');}).appendTo('#container').animate(offset);offset={left:344,top:140};$('<div/>').css({background:'#fff url(/images/yes-right.png) no-repeat 0 0',width:156,height:110,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){results.fr=1;$(this).animate({left:-850},'slow','swing',function(){nextpage=(results.pl==1)?5:6;goToPage(nextpage,'r');}).siblings(":not(:first)").animate({left:-850,opacity:0},'slow','swing');}).appendTo('#container').animate(offset);offset={left:160,top:140};$('<div/>').css({background:'#fff url(/images/fruit.png) no-repeat 0px 0px',width:180,height:120,overflow:'hidden',position:'absolute',left:(startX+offset.left),top:(startY+offset.top)}).appendTo('#container').animate(offset);break;case 5:$("#eatwell").attr("src","/images/eatwell-sugary-new.png");$("<p class=\"question\">Did you have any salty snacks with your lunch?</p>").appendTo('#container');offset={left:0,top:140};$('<div/>').css({background:'#fff url(/images/no-left.png) no-repeat 0px 0px',width:156,height:110,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){$(this).animate({left:850},'slow','swing',function(){goToPage(6,'l');}).siblings(":not(:first)").animate({left:850,opacity:0},'slow','swing');}).appendTo('#container').animate(offset);offset={left:344,top:140};$('<div/>').css({background:'#fff url(/images/yes-right.png) no-repeat 0 0',width:156,height:110,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){results['sn-sa']=1;$(this).animate({left:-850},'slow','swing',function(){goToPage(6,'r');}).siblings(":not(:first)").animate({left:-850,opacity:0},'slow','swing');}).appendTo('#container').animate(offset);offset={left:160,top:140};$('<div/>').css({background:'#fff url(/images/salty.png) no-repeat 0px 0px',width:180,height:120,overflow:'hidden',position:'absolute',left:(startX+offset.left),top:(startY+offset.top)}).appendTo('#container').animate(offset);break;case 6:$("#eatwell").attr("src","/images/eatwell-sugary-new.png");msg=(results.pl==1)?'Did you have any sweet snacks with your lunch?':'Did you have any sweet with your lunch?';$("<p class=\"question\">"+msg+"</p>").appendTo('#container');offset={left:0,top:140};nextpage=(results.pl==1&&results['st-s']==1)?7:8;$('<div/>').css({background:'#fff url(/images/no-left.png) no-repeat 0px 0px',width:156,height:120,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){$(this).animate({left:850},'slow','swing',function(){goToPage(nextpage,'l');}).siblings(":not(:first)").animate({left:850,opacity:0},'slow','swing');}).appendTo('#container').animate(offset);offset={left:344,top:140};$('<div/>').css({background:'#fff url(/images/yes-right.png) no-repeat 0 0',width:156,height:110,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){results['sn-sw']=1;$(this).animate({left:-850},'slow','swing',function(){goToPage(nextpage,'r');}).siblings(":not(:first)").animate({left:-850,opacity:0},'slow','swing');}).appendTo('#container').animate(offset);offset={left:160,top:140};imgsrc=(results.pl==0)?'sd-sweeties.png':'sweeties.png';$('<div/>').css({background:'#fff url(/images/'+imgsrc+') no-repeat 0px 0px',width:180,height:120,overflow:'hidden',position:'absolute',left:(startX+offset.left),top:(startY+offset.top)}).appendTo('#container').animate(offset);break;case 7:$("<p class=\"question\">What else did you have with your lunch?</p>").appendTo('#container');offset={left:0,top:100};nextpage=(results.pl==1&&results['st-b']==1)?4:8;$('<div/>').css({background:'#fff url(/images/other-dairy.png) no-repeat 115px 0px',width:500,height:85,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).append($('<div/>').css({background:'#fff url(/images/other-dairy-pic.png) no-repeat 0px 0px',width:110,height:80,overflow:'hidden',position:'absolute',left:0,top:0})).hover(function(){$(this).css({'background-position':'115px -150px'});$("#eatwell").attr("src","/images/eatwell-dairy-new.png");},function(){if(!results['o-d']){$(this).css({'background-position':'115px 0'});}$("#eatwell").attr("src","/images/eatwell-new.png");}).click(function(){if(results['o-d']){$(":first",this).css({'background-position':'0 0'});results['o-d']=0;}else{$(":first",this).css({'background-position':'0 -150px'});results['o-d']=1;}}).appendTo('#container').animate(offset);offset={left:0,top:180};$('<div/>').css({background:'#fff url(/images/other-veg.png) no-repeat 0px 0px',width:500,height:80,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).append($('<div/>').css({background:'#fff url(/images/other-veg-pic.png) no-repeat 0px 0px',width:90,height:70,overflow:'hidden',position:'absolute',left:410,top:0})).hover(function(){$(this).css({'background-position':'0px -150px'});$("#eatwell").attr("src","/images/eatwell-veg-new.png");},function(){if(!results['o-v']){$(this).css({'background-position':'0 0'});}$("#eatwell").attr("src","/images/eatwell-new.png");}).click(function(){if(results['o-v']){$(":first",this).css({'background-position':'0 0'});results['o-v']=0;}else{$(":first",this).css({'background-position':'0 -150px'});results['o-v']=1;}}).appendTo('#container').animate(offset);offset={left:0,top:260};$('<div/>').css({background:'#fff url(/images/fillings-protein.png) no-repeat 120px 0px',width:500,height:85,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).append($('<div/>').css({background:'#fff url(/images/protein.png) no-repeat 0px 0px',width:109,height:80,overflow:'hidden',position:'absolute',left:0,top:0})).hover(function(){$(this).css({'background-position':'120px -150px'});$("#eatwell").attr("src","/images/eatwell-protein-new.png");},function(){if(!results['o-p']){$(this).css({'background-position':'120px 0'});}$("#eatwell").attr("src","/images/eatwell-new.png");}).click(function(){if(results['o-p']){$(":first",this).css({'background-position':'0 0'});results['o-p']=0;}else{$(":first",this).css({'background-position':'0 -150px'});results['o-p']=1;}}).appendTo('#container').animate(offset);offset={left:386,top:340};$('<div/>').css({background:'#fff url(/images/next.png) no-repeat 0px 0px',width:114,height:77,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){$(this).animate({left:-850},'slow','swing',function(){nextpage=(results.pl==1&&results['st-s']==1)?8:4;goToPage(nextpage,'r');}).siblings(":not(:first)").animate({left:-850,opacity:0},'slow','swing');}).appendTo('#container').animate(offset);break;case 10:$("<p class=\"question\">What else did you have with your lunch?</p>").appendTo('#container');offset={left:0,top:100};$('<div/>').css({background:'#fff url(/images/sd-dairy.png) no-repeat 188px 0px',width:500,height:85,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).append($('<div/>').css({background:'#fff url(/images/sd-dairy-pic.png) no-repeat 0px 0px',width:175,height:80,overflow:'hidden',position:'absolute',left:0,top:0})).hover(function(){$(this).css({'background-position':'188px -150px'});$("#eatwell").attr("src","/images/eatwell-dairy-new.png");},function(){if(!results['o-d']){$(this).css({'background-position':'188px 0'});}$("#eatwell").attr("src","/images/eatwell-new.png");}).click(function(){if(results['o-d']){$(":first",this).css({'background-position':'0 0'});results['o-d']=0;}else{$(":first",this).css({'background-position':'0 -150px'});results['o-d']=1;}}).appendTo('#container').animate(offset);offset={left:0,top:180};$('<div/>').css({background:'#fff url(/images/sd-veg.png) no-repeat 0px 0px',width:500,height:80,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).append($('<div/>').css({background:'#fff url(/images/sd-veg-pic.png) no-repeat 0px 0px',width:101,height:75,overflow:'hidden',position:'absolute',left:399,top:0})).hover(function(){$(this).css({'background-position':'0px -150px'});$("#eatwell").attr("src","/images/eatwell-veg-new.png");},function(){if(!results['o-v']){$(this).css({'background-position':'0 0'});}$("#eatwell").attr("src","/images/eatwell-new.png");}).click(function(){if(results['o-v']){$(":first",this).css({'background-position':'0 0'});results['o-v']=0;}else{$(":first",this).css({'background-position':'0 -150px'});results['o-v']=1;}}).appendTo('#container').animate(offset);offset={left:0,top:260};$('<div/>').css({background:'#fff url(/images/fillings-protein.png) no-repeat 120px 0px',width:500,height:85,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).append($('<div/>').css({background:'#fff url(/images/sd-protein-pic.png) no-repeat 0px 0px',width:109,height:80,overflow:'hidden',position:'absolute',left:0,top:0})).hover(function(){$(this).css({'background-position':'120px -150px'});$("#eatwell").attr("src","/images/eatwell-protein-new.png");},function(){if(!results['o-p']){$(this).css({'background-position':'120px 0'});}$("#eatwell").attr("src","/images/eatwell-new.png");}).click(function(){if(results['o-p']){$(":first",this).css({'background-position':'0 0'});results['o-p']=0;}else{$(":first",this).css({'background-position':'0 -150px'});results['o-p']=1;}}).appendTo('#container').animate(offset);offset={left:386,top:340};$('<div/>').css({background:'#fff url(/images/next.png) no-repeat 0px 0px',width:114,height:77,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){$(this).animate({left:-850},'slow','swing',function(){goToPage(4,'r');}).siblings(":not(:first)").animate({left:-850,opacity:0},'slow','swing');}).appendTo('#container').animate(offset);break;case 8:$("<p class=\"question\">What did you have to drink with your lunch?</p>").appendTo('#container');offset={left:0,top:100};$('<div/>').css({background:'#fff url(/images/drinks-milk.png) no-repeat 65px 0px',width:165,height:90,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).append($('<div/>').css({background:'#fff url(/images/milk.png) no-repeat 0px 0px',width:60,height:90,overflow:'hidden',position:'absolute',left:0,top:0})).hover(function(){$(this).css({'background-position':'65px -150px'});$("#eatwell").attr("src","/images/eatwell-dairy-new.png");},function(){if(!results['d-m']){$(this).css({'background-position':'65px 0'});}$("#eatwell").attr("src","/images/eatwell-new.png");}).click(function(){if(results['d-m']){$(":first",this).css({'background-position':'0 0'});results['d-m']=0;}else{$(":first",this).css({'background-position':'0 -150px'});results['d-m']=1;}}).appendTo('#container').animate(offset);offset={left:178,top:100};$('<div/>').css({background:'#fff url(/images/drinks-juice.png) no-repeat 0px 0px',width:310,height:90,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).append($('<div/>').css({background:'#fff url(/images/juice.png) no-repeat 0px 0px',width:70,height:90,overflow:'hidden',position:'absolute',left:240,top:0})).hover(function(){$(this).css({'background-position':'0px -150px'});$("#eatwell").attr("src","/images/eatwell-veg-new.png");},function(){if(!results['d-j']){$(this).css({'background-position':'0 0'});}$("#eatwell").attr("src","/images/eatwell-new.png");}).click(function(){if(results['d-j']){$(":first",this).css({'background-position':'0 0'});results['d-j']=0;}else{$(":first",this).css({'background-position':'0 -150px'});results['d-j']=1;}}).appendTo('#container').animate(offset);offset={left:0,top:195};$('<div/>').css({background:'#fff url(/images/drinks-sweet.png) no-repeat 80px 0px',width:500,height:90,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).append($('<div/>').css({background:'#fff url(/images/drinks-sweet-pic.png) no-repeat 0px 0px',width:70,height:90,overflow:'hidden',position:'absolute',left:0,top:0})).hover(function(){$(this).css({'background-position':'80px -150px'});$("#eatwell").attr("src","/images/eatwell-sugary-new.png");},function(){if(!results['d-s']){$(this).css({'background-position':'80px 0'});}$("#eatwell").attr("src","/images/eatwell-new.png");}).click(function(){if(results['d-s']){$(":first",this).css({'background-position':'0 0'});results['d-s']=0;}else{$(":first",this).css({'background-position':'0 -150px'});results['d-s']=1;}}).appendTo('#container').animate(offset);offset={left:0,top:290};$('<div/>').css({background:'#fff url(/images/drinks-water.png) no-repeat 0px 0px',width:221,height:90,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).append($('<div/>').css({background:'#fff url(/images/water.png) no-repeat 0px 0px',width:70,height:90,overflow:'hidden',position:'absolute',left:151,top:0})).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){if(!results['d-w']){$(this).css({'background-position':'0 0'});}}).click(function(){if(results['d-w']){$(":first",this).css({'background-position':'0 0'});results['d-w']=0;}else{$(":first",this).css({'background-position':'0 -150px'});results['d-w']=1;}}).appendTo('#container').animate(offset);offset={left:386,top:290};$('<div/>').css({background:'#fff url(/images/next.png) no-repeat 0px 0px',width:114,height:77,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){$(this).animate({left:-850},'slow','swing',function(){goToPage(9,'r');}).siblings(":not(:first)").animate({left:-850,opacity:0},'slow','swing');}).appendTo('#container').animate(offset);break;case 9:$("#eatwell").attr("src","/images/eatwell-new.png");offset={left:30,top:100};$('<div/>').css({background:'#fff url(/images/writing.png) no-repeat 0px 0px',width:440,height:178,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).appendTo('#container').animate(offset,'slow','swing',function(){var auditdata=(results['st-s']==1||results['st-b']==1)?"x":"o";auditdata+=results['sf-p']==1?"x":"o";auditdata+=results['sf-d']==1?"x":"o";auditdata+=results['sf-s']==1?"x":"o";auditdata+=(results['o-d']==1||results['d-m']==1)?"x":"o";auditdata+=results['o-p']==1?"x":"o";auditdata+=(results['sf-v']==1||results['o-v']==1)?"x":"o";auditdata+=results.fr==1?"x":"o";auditdata+=results['sn-sa']==1?"x":"o";auditdata+=results['sn-sw']==1?"x":"o";auditdata+=(results['d-s']==1||results['d-j']==1)?"x":"o";auditdata+=results['d-w']==1?"x":"o";$.post('/',{'auditdata':auditdata,'org_id':results.schoolID,'group':results.groupID,'username':results.userName,'packedlunch':results.pl},function(data,textStatus){switch(data){case"0":alert("no organisation specified");break;case"1":alert("no audit data submitted");break;case"2":alert(" error adding data to database");break;case"3":window.setTimeout(function(){$('#container :last-child').animate({left:offset.left,top:500},'slow','swing',function(){goToPage(11,'t');});},2000);break;}});});break;case 11:$("#eatwell").attr("src","/images/eatwell-new.png");offset={left:67,top:80};$('<div/>').css({background:'#fff url(/images/thanks.png) no-repeat 0px 0px',width:366,height:238,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).appendTo('#container').animate(offset);offset={left:316,top:300};$('<div/>').css({background:'#fff url(/images/startagain.png) no-repeat 0px 0px',width:184,height:90,overflow:'hidden',position:'absolute',cursor:'pointer',left:(startX+offset.left),top:(startY+offset.top)}).hover(function(){$(this).css({'background-position':'0 -150px'});},function(){$(this).css({'background-position':'0 0'});}).click(function(){$(this).animate({left:-850},'slow','swing',function(){window.location.href='/';}).siblings(":not(:first)").animate({left:-850,opacity:0},'slow','swing');}).appendTo('#container').animate(offset);break;}}
function thoughtBubble(which)
{var offsetLeft=$('#container').offset().left;if(!$('#smallbubble').length){$('<div id="smallbubble" />').css({cursor:'pointer',zIndex:10000,position:'absolute',left:(525+offsetLeft),top:411,width:40,height:40,background:'transparent url(/images/thoughtbubble-small.gif) no-repeat 0 0',display:'none'}).appendTo('body');$('<div id="mediumbubble" />').css({cursor:'pointer',zIndex:10000,position:'absolute',left:(447+offsetLeft),top:359,width:70,height:70,background:'transparent url(/images/thoughtbubble-medium.gif) no-repeat 0 0',display:'none'}).appendTo('body');$('<div id="textbubble" />').css({cursor:'pointer',zIndex:10000,position:'absolute',left:(87+offsetLeft),top:87,width:400,height:300,background:'transparent url(/images/thoughtbubble-large.gif) no-repeat 0 0',display:'none'}).appendTo('body');}
$('#textbubble').html('<div style="cursor:pointer;font:bold 1.2em \'Comic Sans MS\',arial,verdana,sans-serif;padding:30px 50px;"><img src="/images/bubble-'+which+'.png" style="margin:0 1em 0.5em 0" width="300" height="80" /><p style="clear:both;margin:0;padding:0;">'+eatwelltext[which]+'</p></div>');if(!$('#smallbubble:visible').length){$('#smallbubble').fadeIn(150,function(){$('#mediumbubble').fadeIn(150,function(){$('#textbubble').fadeIn(150);});});}
$('#textbubble,#mediumbubble,#smallbubble').one('click',null,function(){$('#textbubble').fadeOut(150,function(){$('#mediumbubble').fadeOut(150,function(){$('#smallbubble').fadeOut(150);});});});}});;(function($){var n=$.preload=function(c,d){if(c.split)c=$(c);d=$.extend({},n.defaults,d);var f=$.map(c,function(a){if(!a)return;if(a.split)return d.base+a+d.ext;var b=a.src||a.href;if(typeof d.placeholder=='string'&&a.src)a.src=d.placeholder;if(b&&d.find)b=b.replace(d.find,d.replace);return b||null}),g={loaded:0,failed:0,next:0,done:0,total:f.length};if(!g.total)return m();var h='<img/>',j=d.threshold;while(--j>0)h+='<img/>';h=$(h).load(k).error(k).bind('abort',k).each(l);function k(e){g.found=e.type=='load';g.image=this.src;var a=g.original=c[this.index];g[g.found?'loaded':'failed']++;g.done++;if(d.placeholder&&a.src)a.src=g.found?g.image:d.notFound||a.src;if(d.onComplete)d.onComplete(g);if(g.done<g.total)l(0,this);else{if(h.unbind)h.unbind('load').unbind('error').unbind('abort');h=null;m()}};function l(i,a,b){if($.browser.msie&&g.next&&g.next%n.gap==0&&!b){setTimeout(function(){l(i,a,1)},0);return!1}if(g.next==g.total)return!1;a.index=g.next;a.src=f[g.next++];if(d.onRequest){g.image=a.src;g.original=c[g.next-1];d.onRequest(g)}};function m(){if(d.onFinish)d.onFinish(g)}};n.gap=14;n.defaults={threshold:2,base:'',ext:'',replace:''};$.fn.preload=function(a){n(this,a);return this}})(jQuery);