/*  Copyright 2015, University of St Andrews QuVis Interactive Simulations
jQuery JavaScript Library v2.0.n Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors http://jquery.com/ Released under the MIT license http://jquery.org/license
edge Adobe Edge Animate JavaScript Library v3.0 Copyright 2014 Adobe Systems Inc. and its licensors. Released under the CC BY-NC-SA license, creativecommons.org/licenses   
fastclick.js Version: 1.0.6 Copyright (c) 2014 The Financial Times Ltd. https://github.com/ftlabs/fastclick Released under the MIT license https://github.com/ftlabs/fastclick/blob/master/LICENSE
normalize.css v3 Copyright (c) Nicolas Gallagher and Jonathan Neal https://github.com/necolas/normalize.css Released under the MIT license https://github.com/necolas/normalize.css/blob/master/LICENSE.md
*/



(function($,Edge,compId){var Composition=Edge.Composition,Symbol=Edge.Symbol;var startValue=0;var endValue=0;startScoreAnimation=function(a,b){startValue=a;endValue=b;scoreIncrementer=setInterval(function(){incrementScore(startValue,endValue)},40);}
incrementScore=function(lastValue,endValue){startValue++;$('#Stage_scoreText').text(startValue+'/100');if(startValue==endValue){clearInterval(scoreIncrementer);}}
function step_functions(step){switch(step){case 1:break;}}
function sym_features(){$('#Stage').css({'-webkit-user-select':'none','-moz-user-select':'none','-ms-user-select':'none','user-select':'none'});if(sym_ie()==9){makeUnselectable($('#Stage')[0]);function makeUnselectable(node){if(node.nodeType==1)node.setAttribute("unselectable","on");var child=node.firstChild;while(child){makeUnselectable(child);child=child.nextSibling;}}}
if(!$('#Stage').data('link_areas')){$('#Stage').data('link_areas',true);$('#Stage_links').children().each(function(){$(this).append('<div id="'+$(this).attr('id')+'_area"></div>');$('#'+$(this).attr('id')+'_area').css({'background':'black','opacity':'0','position':'absolute','width':'100%','height':'100%','left':'0px','top':'0px'});});}
$('#Stage').find('.button > div, .checkbox .tickbox, .radio .tickbox, .radio .tickbox div').css({'border-top-color':'#B5B8BA','border-right-color':'#898E91','border-bottom-color':'#5A6165','border-left-color':'#898E91'});$('#Stage .slider').not('.vertical').children().children().css({'width':'100%','border-top-color':'#575E62','border-right-color':'#8C9295','border-bottom-color':'#AEB2B4','border-left-color':'#8C9295'});$('#Stage .slider.vertical').children().children().css({'height':'100%','border-top-color':'#8C9295','border-right-color':'#575E62','border-bottom-color':'#8C9295','border-left-color':'#AEB2B4'});if(sym_ie()==9){$('#Stage').find('.button > div, .checkbox .tickbox, .radio .tickbox').css({'background':'url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZkZmRmZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlYmViZWIiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+)'});$('#Stage .radio .tickbox div').css({'background':'url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPHJhZGlhbEdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgY3g9IjUwJSIgY3k9IjUwJSIgcj0iNzUlIj4KICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiMwMDJkMDAiIHN0b3Atb3BhY2l0eT0iMSIvPgogICAgPHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjYmZmZmJmIiBzdG9wLW9wYWNpdHk9IjEiLz4KICA8L3JhZGlhbEdyYWRpZW50PgogIDxyZWN0IHg9Ii01MCIgeT0iLTUwIiB3aWR0aD0iMTAxIiBoZWlnaHQ9IjEwMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+)'});}
$('#Stage').find('*').each(function(){if($(this).css('-webkit-transform')!=''&&$(this).css('-webkit-transform')!='none')
$(this).css('-webkit-transform',$(this).css('-webkit-transform'));});$('#Stage').find('.button, .checkbox, .radio, .slider').each(function(){if(!$(this).hasClass('disabled'))sym_enable(this)});$('#Stage .disabled').each(function(){sym_disable(this)});$('#Stage').find('.checkbox, .radio').each(function(){if(!$(this).hasClass('selected'))sym_deselect(this)});$('#Stage .selected').each(function(){sym_select(this)});$('#Stage .slider').each(function(){if(!$(this).attr('class').match(/min_(\d+)/))var min=0;else var min=$(this).attr('class').match(/min_(\d+)/)[1]*1;if(!$(this).attr('class').match(/max_\d+/))var max=100;else var max=$(this).attr('class').match(/max_(\d+)/)[1]*1;if(!$(this).attr('class').match(/snap_\d+/))var snap=1;else var snap=$(this).attr('class').match(/snap_(\d+)/)[1]*1;if(!$(this).attr('class').match(/val_\d+/))var val=min;else var val=$(this).attr('class').match(/val_(\d+)/)[1]*1;$(this).data('min',min);$(this).data('max',max);$(this).data('snap',snap);$(this).data('default',val);sym_val(this,$(this).data('val')===undefined?val:$(this).data('val'));});if(!$('#Stage').data('slider_events')){$('#Stage').data('slider_events',true);$(document).on('mousedown mousemove touchstart touchmove',function(e){var slider=$('#Stage .slider.active');if(slider.length){e.preventDefault();var min=slider.data('min');var max=slider.data('max');var snap=slider.data('snap');var range,pos;var scale=$('#Stage').attr('style').match(/scale *\(([0-9\.]+)\)/)[1]*1;if(slider.hasClass('vertical')){range=slider.children().height();pos=-slider.children().offset().top;if(e.type=='mousedown'||e.type=='mousemove')pos+=e.pageY;else pos+=e.originalEvent.touches[0].pageY;}else{range=slider.children().width();pos=-slider.children().offset().left;if(e.type=='mousedown'||e.type=='mousemove')pos+=e.pageX;else pos+=e.originalEvent.touches[0].pageX;}
pos=Math.min(Math.max(pos,0),range*scale)/scale;var snap_steps=(max-min)/snap;var snap_interval=range/snap_steps;pos=Math.round(pos/snap_interval)*snap_interval;slider.find('.handle').css(slider.hasClass('vertical')?'top':'left',pos+'px');var val=Math.round(min+pos/range*(max-min));slider.data('val',val);}});$(document).on('mouseup touchend',function(e){$('#Stage .slider.active').removeClass('active');});}
if(!$('#Stage').data('step_events')){$('#Stage').data('step_events',true);$('#Stage_steps').children().find('*').each(function(){if($(this).attr('id')&&$(this).attr('id').match(/_highlight_circle$/))
$(this).css({'outline':'transparent solid 1px'});});$('#Stage_steps_step_buttons').children().each(function(){$(this).append('<div id="'+$(this).attr('id')+'_area"></div>');$('#'+$(this).attr('id')+'_area').css({'background':'black','opacity':'0','position':'absolute','width':'100%','height':'100%','left':'0px','top':'0px'});});var i=1;while(i){if(!$('#Stage_steps_step'+i).length)break;$('#Stage_steps_step'+i).click(function(){sym_step(this.id.match(/\d+/)*1)});i++;}
$('#Stage').data('step_count',i-1);}}
function sym_enable(element){$(element).removeClass('disabled');$(element).css({'opacity':''});$('#'+$(element).attr('id')+'_mask').hide();if($(element).data('css_events'))return;$(element).data('css_events',true);$(element).append('<div id="'+$(element).attr('id')+'_area"></div>');$('#'+$(element).attr('id')+'_area').css({'background':'black','opacity':'0','position':'absolute','width':'100%','height':'100%','left':'0px','top':'0px'});if($(element).hasClass('button')){$(element).on('mouseover touchstart',function(){$(this).children().first().css({'border-top-color':'#009CFE','border-right-color':'#0089DF','border-bottom-color':'#0076C1','border-left-color':'#0089DF'});});$(element).on('mousedown touchstart',function(){$(this).children().first().attr('style',$(this).children().first().attr('style')
+'background:-moz-linear-gradient(top, #e1f3fe 0%, #9cd8fd 100%);'
+'background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#e1f3fe), color-stop(100%,#9cd8fd));'
+'background:-webkit-linear-gradient(top, #e1f3fe 0%,#9cd8fd 100%);'
+'background:-o-linear-gradient(top, #e1f3fe 0%,#9cd8fd 100%);'
+'background:-ms-linear-gradient(top, #e1f3fe 0%,#9cd8fd 100%);'
+'background:linear-gradient(to bottom, #e1f3fe 0%,#9cd8fd 100%);');if(sym_ie()==9)$(this).children().first().css({'background':'url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2UxZjNmZSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM5Y2Q4ZmQiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+)'});});$(element).on('mouseout touchend',function(){$(this).children().first().css({'border-top-color':'#B5B8BA','border-right-color':'#898E91','border-bottom-color':'#5A6165','border-left-color':'#898E91'});});$(element).on('mouseout mouseup touchend',function(){$(this).children().first().attr('style',$(this).children().first().attr('style')
+'background:-moz-linear-gradient(top, #fdfdfd 0%, #ebebeb 100%);'
+'background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#fdfdfd), color-stop(100%,#ebebeb));'
+'background:-webkit-linear-gradient(top, #fdfdfd 0%,#ebebeb 100%);'
+'background:-o-linear-gradient(top, #fdfdfd 0%,#ebebeb 100%);'
+'background:-ms-linear-gradient(top, #fdfdfd 0%,#ebebeb 100%);'
+'background:linear-gradient(to bottom, #fdfdfd 0%,#ebebeb 100%);');if(sym_ie()==9)$(this).children().first().css({'background':'url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZkZmRmZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlYmViZWIiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+)'});});}
else if($(element).hasClass('checkbox')||$(element).hasClass('radio')){$('#'+$(element).attr('id')+'_area').on('click',function(){if($(this).parent().hasClass('selected')){if($(this).parent().hasClass('radio'))return;sym_deselect($(this).parent());}
else{sym_select($(this).parent());}});$(element).on('mouseover touchstart',function(){$(this).find('.tickbox').css({'border-top-color':'#009CFE','border-right-color':'#0089DF','border-bottom-color':'#0076C1','border-left-color':'#0089DF'});});$(element).on('mousedown touchstart',function(){$(this).find('.tickbox').attr('style',$(this).find('.tickbox').attr('style')
+'background:-moz-linear-gradient(top, #e1f3fe 0%, #9cd8fd 100%);'
+'background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#e1f3fe), color-stop(100%,#9cd8fd));'
+'background:-webkit-linear-gradient(top, #e1f3fe 0%,#9cd8fd 100%);'
+'background:-o-linear-gradient(top, #e1f3fe 0%,#9cd8fd 100%);'
+'background:-ms-linear-gradient(top, #e1f3fe 0%,#9cd8fd 100%);'
+'background:linear-gradient(to bottom, #e1f3fe 0%,#9cd8fd 100%);');if(sym_ie()==9)$(this).find('.tickbox').css({'background':'url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2UxZjNmZSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM5Y2Q4ZmQiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+)'});});$(element).on('mouseout touchend',function(){$(this).find('.tickbox').css({'border-top-color':'#B5B8BA','border-right-color':'#898E91','border-bottom-color':'#5A6165','border-left-color':'#898E91'});});$(element).on('mouseout mouseup touchend',function(){$(this).find('.tickbox').attr('style',$(this).find('.tickbox').attr('style')
+'background:-moz-linear-gradient(top, #fdfdfd 0%, #ebebeb 100%);'
+'background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#fdfdfd), color-stop(100%,#ebebeb));'
+'background:-webkit-linear-gradient(top, #fdfdfd 0%,#ebebeb 100%);'
+'background:-o-linear-gradient(top, #fdfdfd 0%,#ebebeb 100%);'
+'background:-ms-linear-gradient(top, #fdfdfd 0%,#ebebeb 100%);'
+'background:linear-gradient(to bottom, #fdfdfd 0%,#ebebeb 100%);');if(sym_ie()==9)$(this).find('.tickbox').css({'background':'url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZkZmRmZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlYmViZWIiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+)'});});if($(element).hasClass('radio')){$(element).on('mouseover touchstart',function(){$(this).find('.tickbox div').css({'opacity':'0.8','border-top-color':'#009CFE','border-right-color':'#0089DF','border-bottom-color':'#0076C1','border-left-color':'#0089DF'});});$(element).on('mouseout touchend',function(){$(this).find('.tickbox div').css({'opacity':'','border-top-color':'#B5B8BA','border-right-color':'#898E91','border-bottom-color':'#5A6165','border-left-color':'#898E91'});});}}
else if($(element).hasClass('slider')){$(element).on('mouseover mouseup',function(){$(this).find('.handle').css({'background-position':'0% 50%'});});$(element).on('mousedown touchstart',function(){$(this).find('.handle').css({'background-position':'0% 100%'});$(this).addClass('active');});$(element).on('mouseout touchend',function(){$(this).find('.handle').css({'background-position':'0% 0%'});});}}
function sym_disable(element){$(element).addClass('disabled');$(element).css({'opacity':'0.4'});$('#'+$(element).attr('id')+'_mask').show();if(!$('#'+$(element).attr('id')+'_mask').length){$(element).after('<div id="'+$(element).attr('id')+'_mask"></div>');$('#'+$(element).attr('id')+'_mask').css({'background':'black','opacity':'0','position':$(element).css('position'),'width':$(element).css('width'),'height':$(element).css('height'),'left':$(element)[0].style.left,'top':$(element)[0].style.top,'right':$(element)[0].style.right,'bottom':$(element)[0].style.bottom});}}
function sym_select(element){$(element).addClass('selected');$(element).find('.tickbox div').show();if($(element).hasClass('radio')){$(element).data('selecting',true);var group=$(element).attr('class').match(/group_[^ ]+/)[0];$('#Stage .'+group).each(function(){if($(this).data('selecting'))$(this).data('selecting',false);else sym_deselect(this);});}}
function sym_deselect(element){$(element).removeClass('selected');$(element).find('.tickbox div').hide();}
function sym_val(element,val){var min=$(element).data('min');var max=$(element).data('max');var range=$(element).hasClass('vertical')?$(element).children().height():$(element).children().width();var pos=(val-min)/(max-min)*range;$(element).find('.handle').css($(element).hasClass('vertical')?'top':'left',pos+'px');$(element).data('val',val);}
function sym_step(step){$('#Stage').data('step',step);var sym=AdobeEdge.getComposition(compId).getSymbols('steps')[0];sym.stop(step+'');sym.$('step_buttons').children().children().css({'border-color':'#999999'});sym.$('step'+step).children().css({'border-color':'#1F7258'});sym.$('step_buttons').children().children().children().css({'color':'#999999'});sym.$('step'+step).children().children().css({'color':'#1F7258'});step_functions(step);}
function sym_ie(){var version=false;if(navigator.appVersion.indexOf("MSIE")!=-1)
version=parseFloat(navigator.appVersion.split("MSIE")[1]);return version;}
(function(symbolName){Symbol.bindElementAction(compId,symbolName,"document","compositionReady",function(sym,e){sym_features();sym.setVariable("nr",0);sym.setVariable("m",0);sym.setVariable("frame",0);var pointerArray=[[559,551,540,528,512],[537,520,501,478,454],[496,471,443,412,378],[439,404,368,327,285],[363,320,273,225,174]];var energyArray=[[5.8,14.7,26.4,40.7,57.6],[30.5,49.2,70.8,95.3,122],[74.9,103,135,169,207],[139,178,219,263,310],[223,271,323,377,434]];var averageArray=[[0,0.35,0.49,0.58,0.63],[0,0.21,0.33,0.41,0.47],[0,0.15,0.24,0.32,0.37],[0,0.11,0.20,0.26,0.31],[0,0.09,0.16,0.22,0.27]];var highlightXArray=[[612,458,612,612,612],[458,458,458,458,458],[612,612,612,612,612],[458,458,458,458,458],[612,612,612,458,612]];var highlightYArray=[[552,545,534,519,505],[529,512,494,472,447],[488,463,436,405,371],[429,396,361,319,278],[354,311,265,218,167]];var tickArray=[false,false,false,false];var score=0;var questionScore=[20,20,30,30];sym.getComposition().getStage().getSymbol('graphs').stop('03');$(document).on('mousedown mousemove touchstart touchmove',function(e){var slider=sym.$('slider');if(slider.hasClass('active')&&!slider.data('timeout')){slider.data('timeout',setTimeout(function(){slider.data('timeout',false);slider.data('timeout_val',slider.data('val'));sym.setNr(slider.data('val'));},20));}});$(document).on('mousedown mousemove touchstart touchmove',function(e){var slider=sym.$('slider2');if(slider.hasClass('active')&&!slider.data('timeout')){slider.data('timeout',setTimeout(function(){slider.data('timeout',false);slider.data('timeout_val',slider.data('val'));sym.setM(slider.data('val'));},20));}});sym.setNr=function(x){sym.setVariable("nr",x);var formula=sym.getSymbol("energyFormulae");formula.$('energyFormulaText1').text(energyArray[sym.getVariable("nr")][sym.getVariable('m')]);formula=sym.getSymbol("averageEnergyFormulae");formula.$('energyFormulaText1').text(averageArray[sym.getVariable('nr')][sym.getVariable('m')]);sym.$('nrMainControl').text("= "+sym.getVariable("nr"));sym.$('energyPointer').css('top',pointerArray[sym.getVariable("nr")][sym.getVariable("m")]);sym.$('energyHighlight').css('left',highlightXArray[sym.getVariable("nr")][sym.getVariable("m")]);sym.$('energyHighlight').css('top',highlightYArray[sym.getVariable("nr")][sym.getVariable("m")]);sym_val(sym.$('slider'),sym.getVariable("nr"));sym.getComposition().getStage().getSymbol('graphs').stop(""+sym.getVariable("nr")+sym.getVariable("m"));}
sym.setM=function(y){sym.setVariable("m",y);var formula=sym.getSymbol("energyFormulae");formula.$('energyFormulaText1').text(energyArray[sym.getVariable("nr")][sym.getVariable('m')]);formula=sym.getSymbol("averageEnergyFormulae");formula.$('energyFormulaText1').text(averageArray[sym.getVariable('nr')][sym.getVariable('m')]);sym.$('mMainControl').text("= "+sym.getVariable("m"));sym.$('energyPointer').css('top',pointerArray[sym.getVariable("nr")][sym.getVariable("m")]);sym_val(sym.$('slider2'),sym.getVariable("m"));sym.$('energyHighlight').css('left',highlightXArray[sym.getVariable("nr")][sym.getVariable("m")]);sym.$('energyHighlight').css('top',highlightYArray[sym.getVariable("nr")][sym.getVariable("m")]);sym.getComposition().getStage().getSymbol('graphs').stop(""+sym.getVariable("nr")+sym.getVariable("m"));}
sym.displayTicks=function(){for(var i=1;i<5;i++){if(tickArray[i-1]){sym.$('tick'+i).show();}}}
sym.resetChallenge=function(question){sym.getComposition().getStage().getSymbol("challenges").stop("q"+question);sym.getComposition().getStage().getSymbol("responses").stop("empty");sym_enable(sym.$('submitButton'));for(var i=0;i<6;i++){sym_enable(sym.$('nr'+i+'Radio'));sym_enable(sym.$('m'+i+'Radio'));}
sym.deselectRadios();sym.setVariable("questionNo",question);if(question!=3){var questionNr=Math.floor(Math.random()*5);var questionM=Math.floor(Math.random()*5);sym.setVariable("questionNr",questionNr);sym.setVariable("questionM",questionM);}else{sym.setVariable("questionNr",-1);sym.setVariable("questionM",-1);}
if(question!=3){sym.$('graphs').show();sym.$('axisLabels').show();sym.getComposition().getStage().getSymbol('graphs').stop(questionNr+''+questionM);}else{sym.$('graphs').hide();sym.$('axisLabels').hide();}
sym.$('mRadios').show();sym.$('nrRadios').show();if(question==1){sym.$('mRadios').hide();}else if(question==2){sym.$('nrRadios').hide();}}
sym.checkAnswer=function(){var question=sym.getVariable("questionNo")
var questionNr=sym.getVariable("questionNr");var questionM=sym.getVariable("questionM");var nrChosen=sym.getAnswer('nr');var mChosen=sym.getAnswer('m');var correct=false;if(question==1){correct=(nrChosen==questionNr);}else if(question==2){correct=(mChosen==questionM);}else if(question==3){correct=(mChosen==0&&nrChosen==4);}else{correct=(mChosen==questionM&&nrChosen!=questionNr);}
if(question>2&&nrChosen+mChosen>50){sym.getComposition().getStage().getSymbol('responses').stop('unselected');}else if(correct){sym_disable(sym.$('submitButton'));for(var i=0;i<5;i++){sym_disable(sym.$('nr'+i+'Radio'));sym_disable(sym.$('m'+i+'Radio'));}
var sendBalloons=true;if(!tickArray[question-1]){sym.$('tick'+question).show();tickArray[question-1]=true;startScoreAnimation(score,score+questionScore[question-1]);score+=questionScore[question-1];if(score==100){sym.$('fancyExcellent').show();sym.getSymbol('fancyExcellent').play();sendBalloons=false;}}
if(Math.random()<0.5&&sendBalloons){sym.getSymbol('sillyBalloons').play();}
responses=sym.getComposition().getStage().getSymbol('responses');responses.stop(question+'t');if(question==1){responses.$('challenge1tText1').text(questionNr);responses.$('challenge1tText2').text(questionNr);}else if(question==2){responses.$('challenge2tText1').text(questionM*2);responses.$('challenge2tText2').text(questionM*2);responses.$('challenge2tText3').text(questionM);}else if(question==3){sym.$('graphs').show();sym.$('axisLabels').show();sym.getComposition().getStage().getSymbol('graphs').stop('40');}else{responses.$('challenge4tText1').text(questionNr);responses.$('challenge4tText2').text(questionM);}}else{sym.getComposition().getStage().getSymbol('responses').stop(""+question+'f');}}
sym.getAnswer=function(n){if(sym.$(n+'0Radio').hasClass('selected')){return 0;}else if(sym.$(n+'1Radio').hasClass('selected')){return 1;}else if(sym.$(n+'2Radio').hasClass('selected')){return 2;}else if(sym.$(n+'3Radio').hasClass('selected')){return 3;}else if(sym.$(n+'4Radio').hasClass('selected')){return 4;}else if(sym.$(n+'5Radio').hasClass('selected')){return 5;}else{return 100;}}
sym.deselectRadios=function(){for(var i=0;i<6;i++){sym_deselect(sym.$('nr'+i+'Radio'));sym_deselect(sym.$('m'+i+'Radio'));}}});Symbol.bindElementAction(compId,symbolName,"${_energyCheckbox}","click",function(sym,e){if(sym.$('energyCheckbox').hasClass('selected')){sym.$("energyFormulae").show();}else{sym.$("energyFormulae").hide();}});Symbol.bindElementAction(compId,symbolName,"${_link_st_andrews}","click",function(sym,e){window.open('http://www.st-andrews.ac.uk','_blank');});Symbol.bindElementAction(compId,symbolName,"${_tab_simulation}","click",function(sym,e){if(sym.getVariable("frame")==1){sym.stop('controls');sym.$('energyFormulae').hide();sym.$('averageEnergyFormulae').hide();if(sym.$('energyCheckbox').hasClass('selected')){sym.$('energyFormulae').show();}
if(sym.$('averageCheckbox').hasClass('selected')){sym.$('averageEnergyFormulae').show();}}else{sym.stop('intro');}
sym.$('graphs').show();sym.$('axisLabels').show();sym.getComposition().getStage().getSymbol('graphs').stop(sym.getVariable("nr")+''+sym.getVariable("m"));sym_features();$('#Stage').data('step',false);clearTimeout(AdobeEdge.step_animation);});Symbol.bindElementAction(compId,symbolName,"${_tab_explanation}","click",function(sym,e){sym.stop('challenges');sym.resetChallenge(1);sym.displayTicks();sym_features();sym_step(1);});Symbol.bindElementAction(compId,symbolName,"${_controlsRadio}","click",function(sym,e){if(sym.getVariable("frame")==0){sym.stop('controls');sym.setVariable("frame",1);sym.$('energyFormulae').hide();sym.$('averageEnergyFormulae').hide();if(sym.$('energyCheckbox').hasClass('selected')){sym.$('energyFormulae').show();}
if(sym.$('averageCheckbox').hasClass('selected')){sym.$('averageEnergyFormulae').show();}
sym.setNr(sym.getVariable("nr"));sym.setM(sym.getVariable("m"));sym.$('graphs').show();sym.$('axisLabels').show();sym.getComposition().getStage().getSymbol('graphs').stop(sym.getVariable("nr")+''+sym.getVariable("m"));}});Symbol.bindElementAction(compId,symbolName,"${_introRadio}","click",function(sym,e){if(sym.getVariable("frame")==1){sym.stop('intro');sym.setVariable("frame",0);}
sym.$('graphs').show();sym.$('axisLabels').show();sym.getComposition().getStage().getSymbol('graphs').stop(sym.getVariable("nr")+''+sym.getVariable("m"));});Symbol.bindElementAction(compId,symbolName,"${_energyButton11}","click",function(sym,e){sym.setNr(1);sym.setM(1);});Symbol.bindElementAction(compId,symbolName,"${_energyButton03}","click",function(sym,e){sym.setNr(0);sym.setM(3);});Symbol.bindElementAction(compId,symbolName,"${_energyButton10}","click",function(sym,e){sym.setNr(1);sym.setM(0);});Symbol.bindElementAction(compId,symbolName,"${_energyButton02}","click",function(sym,e){sym.setNr(0);sym.setM(2);});Symbol.bindElementAction(compId,symbolName,"${_energyButton01}","click",function(sym,e){sym.setNr(0);sym.setM(1);});Symbol.bindElementAction(compId,symbolName,"${_energyButton00}","click",function(sym,e){sym.setNr(0);sym.setM(0);});Symbol.bindElementAction(compId,symbolName,"${_submitButton}","click",function(sym,e){sym.checkAnswer();});Symbol.bindElementAction(compId,symbolName,"${_energyButton04}","click",function(sym,e){sym.setNr(0);sym.setM(4);});Symbol.bindElementAction(compId,symbolName,"${_energyButton12}","click",function(sym,e){sym.setNr(1);sym.setM(2);});Symbol.bindElementAction(compId,symbolName,"${_energyButton20}","click",function(sym,e){sym.setNr(2);sym.setM(0);});Symbol.bindElementAction(compId,symbolName,"${_energyButton13}","click",function(sym,e){sym.setNr(1);sym.setM(3);});Symbol.bindElementAction(compId,symbolName,"${_energyButton21}","click",function(sym,e){sym.setNr(2);sym.setM(1);});Symbol.bindElementAction(compId,symbolName,"${_energyButton14}","click",function(sym,e){sym.setNr(1);sym.setM(4);});Symbol.bindElementAction(compId,symbolName,"${_energyButton22}","click",function(sym,e){sym.setNr(2);sym.setM(2);});Symbol.bindElementAction(compId,symbolName,"${_energyButton30}","click",function(sym,e){sym.setNr(3);sym.setM(0);});Symbol.bindElementAction(compId,symbolName,"${_energyButton23}","click",function(sym,e){sym.setNr(2);sym.setM(3);});Symbol.bindElementAction(compId,symbolName,"${_energyButton31}","click",function(sym,e){sym.setNr(3);sym.setM(1);});Symbol.bindElementAction(compId,symbolName,"${_energyButton24}","click",function(sym,e){sym.setNr(2);sym.setM(4);});Symbol.bindElementAction(compId,symbolName,"${_energyButton32}","click",function(sym,e){sym.setNr(3);sym.setM(2);});Symbol.bindElementAction(compId,symbolName,"${_energyButton40}","click",function(sym,e){sym.setNr(4);sym.setM(0);});Symbol.bindElementAction(compId,symbolName,"${_energyButton33}","click",function(sym,e){sym.setNr(3);sym.setM(3);});Symbol.bindElementAction(compId,symbolName,"${_energyButton41}","click",function(sym,e){sym.setNr(4);sym.setM(1);});Symbol.bindElementAction(compId,symbolName,"${_energyButton34}","click",function(sym,e){sym.setNr(3);sym.setM(4);});Symbol.bindElementAction(compId,symbolName,"${_energyButton42}","click",function(sym,e){sym.setNr(4);sym.setM(2);});Symbol.bindElementAction(compId,symbolName,"${_energyButton43}","click",function(sym,e){sym.setNr(4);sym.setM(3);});Symbol.bindElementAction(compId,symbolName,"${_energyButton44}","click",function(sym,e){sym.setNr(4);sym.setM(4);});Symbol.bindElementAction(compId,symbolName,"${_averageCheckbox}","click",function(sym,e){if(sym.$('averageCheckbox').hasClass('selected')){sym.$("averageEnergyFormulae").show();}else{sym.$("averageEnergyFormulae").hide();}});})("stage");(function(symbolName){})("checkbox_tickbox");(function(symbolName){})("radio_tickbox");(function(symbolName){Symbol.bindElementAction(compId,symbolName,"${_step2}","click",function(sym,e){sym.getComposition().getStage().resetChallenge(2);});Symbol.bindElementAction(compId,symbolName,"${_step3}","click",function(sym,e){sym.getComposition().getStage().resetChallenge(3);});Symbol.bindElementAction(compId,symbolName,"${_step4}","click",function(sym,e){sym.getComposition().getStage().resetChallenge(4);});Symbol.bindElementAction(compId,symbolName,"${_step1}","click",function(sym,e){sym.getComposition().getStage().resetChallenge(1);});})("steps");(function(symbolName){Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.play(0);});})("highlight");(function(symbolName){})("energyFormulae");(function(symbolName){})("challenges");(function(symbolName){})("graphs");(function(symbolName){})("Responses");(function(symbolName){})("averageEnergyFormulae");(function(symbolName){Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.getComposition().getStage().$('fancyExcellent').hide();sym.stop(0);});})("fancyExcellent");(function(symbolName){Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.stop(0);});})("sillyBalloons");})(jQuery,AdobeEdge,"EDGE-19890435");