/*  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;function debug(value){$('#Stage_debug').text(value);}
var save={};save.values={};var row_count=0
var a_basis=['','','','','',''];var a_outcome=['','','','','',''];var b_basis=['','','','','',''];var b_outcome=['','','','','',''];var same_basis=['','','','','',''];var key=['','','','','',''];var e_basis=['','','','','',''];var e_outcome=['','','','','',''];var streaming=false;var a_keys=[];var b_keys=[];var numberOfErrors=0;var count_keys=0;var challenges=false;var multiple=false;var error=false;function show_boxes_event(e){var show_key=$('#Stage_show_key_checkbox').hasClass('selected');var show_errors=$('#Stage_show_errors_checkbox').hasClass('selected');var show_graph=$('#Stage_show_graph_checkbox').hasClass('selected');show_boxes(show_key,show_errors,show_graph);save.show_key=show_key;save.show_errors=show_errors;save.show_graph=show_graph;}
function show_boxes(show_key,show_errors,show_graph){show_key?sym_select($('#Stage_show_key_checkbox')):sym_deselect($('#Stage_show_key_checkbox'));show_errors?sym_select($('#Stage_show_errors_checkbox')):sym_deselect($('#Stage_show_errors_checkbox'));show_graph?sym_select($('#Stage_show_graph_checkbox')):sym_deselect($('#Stage_show_graph_checkbox'));show_key?$('#Stage_box_key').show():$('#Stage_box_key').hide();show_errors?$('#Stage_box_errors').show():$('#Stage_box_errors').hide();show_graph?$('#Stage_box_key_bits').show():$('#Stage_box_key_bits').hide();}
function send_single_particle(e){add_single_count();}
var k=0;function send_multiple_particles(e){for(k=1;k<=94;k++){add_single_count();}}
var continuous_count=false;function send_continuous_particles(e){if(continuous_count){clearInterval(continuous_count);continuous_count=false;sym_enable($('#Stage_send_single_button'))
$('#Stage_send_continuous_button_label').text("Teilchenstrom");return;}
sym_disable($('#Stage_send_single_button'));$('#Stage_send_continuous_button_label').text("Strom stoppen");add_single_count();continuous_count=setInterval(function(){add_single_count()},700);}
function add_single_count(){var prefix=AdobeEdge.getComposition(compId).getStage();if(multiple==false)frozen_flashes();if($('#Stage_sga_angle_rand_radio').hasClass('selected')){rotate_sgas(Math.floor(Math.random()*2)+1,Math.floor(Math.random()*2)+1);}
var n_tot=$('#Stage_n_tot').text()*1+1;var left_plus=Math.random()<0.5;var right_plus=false;var left_90=$('#Stage_sga_left_angle2_radio').hasClass('selected')?true:false;var right_90=$('#Stage_sga_right_angle2_radio').hasClass('selected')?true:false;var eavesdrop_plus=false;var eavesdrop_90=left_90;var stage=AdobeEdge.getComposition(compId).getStage();if($('#Stage_eavesdrop').css('display')=='block'){if(left_90!=right_90||$('#Stage_sga_angle_rand_radio').hasClass('selected')){var eavesdrop_random=Math.floor(Math.random()*2)+1;if(multiple==false)stage.getSymbol('sga_eavesdrop').stop(eavesdrop_random+'');eavesdrop_90=eavesdrop_random==2;}
if(left_90==eavesdrop_90){eavesdrop_plus=left_plus==true;}
else{eavesdrop_plus=Math.random()<0.5;}
if(eavesdrop_90==right_90){right_plus=eavesdrop_plus;}
else{right_plus=Math.random()<0.5;}
if(multiple==false){var eavesdrop_source=1;if(eavesdrop_plus){prefix.getSymbol('#Stage_sga_eavesdrop').getSymbol('flash_1').play(0);prefix.getSymbol('#Stage_sga_eavesdrop').getSymbol('flash_0').stop(0);eavesdrop_source=eavesdrop_90?3:1;}
else{prefix.getSymbol('#Stage_sga_eavesdrop').getSymbol('flash_0').play(0);prefix.getSymbol('#Stage_sga_eavesdrop').getSymbol('flash_1').stop(0);eavesdrop_source=eavesdrop_90?4:2;}
if(!challenges){$('#Stage_eavesdrop_source').attr('style',$('#Stage_eavesdrop_source').attr('style').replace(/eavesdrop_source000\d/,'eavesdrop_source000'+eavesdrop_source)).show();}
if(challenges){$('#Stage_eavesdrop_source').attr('style',$('#Stage_eavesdrop_source').attr('style').replace(/eavesdrop_source000\d/,'eavesdrop_source000'+5)).show();}}}
else{if(left_90==right_90){right_plus=left_plus==true;}
else{right_plus=Math.random()<0.5;}}
if(multiple==false){if(left_plus){}
else{}
if(right_plus){prefix.getSymbol('#Stage_sga_right').getSymbol('flash_1').play(0);prefix.getSymbol('#Stage_sga_right').getSymbol('flash_0').stop(0);}
else{prefix.getSymbol('#Stage_sga_right').getSymbol('flash_0').play(0);prefix.getSymbol('#Stage_sga_right').getSymbol('flash_1').stop(0);}}
var outcome={'left_plus':left_plus,'left_90':left_90,'eavesdrop_plus':eavesdrop_plus,'eavesdrop_90':eavesdrop_90,'right_plus':right_plus,'right_90':right_90};show_single_count(outcome);if(multiple==false){$('#Stage_alice_source').show();if(left_plus){if(left_90){prefix.getSymbol('#Stage_up_x').play(0);prefix.getSymbol('#Stage_up_z').stop(0);prefix.getSymbol('#Stage_down_z').stop(0);prefix.getSymbol('#Stage_down_x').stop(0);}
else{prefix.getSymbol('#Stage_up_x').stop(0);prefix.getSymbol('#Stage_up_z').play(0);prefix.getSymbol('#Stage_down_z').stop(0);prefix.getSymbol('#Stage_down_x').stop(0);}}
else{if(left_90){prefix.getSymbol('#Stage_up_x').stop(0);prefix.getSymbol('#Stage_up_z').stop(0);prefix.getSymbol('#Stage_down_z').stop(0);prefix.getSymbol('#Stage_down_x').play(0);}
else{prefix.getSymbol('#Stage_up_x').stop(0);prefix.getSymbol('#Stage_up_z').stop(0);prefix.getSymbol('#Stage_down_z').play(0);prefix.getSymbol('#Stage_down_x').stop(0);}}}}
function show_single_count(outcome){$('#Stage_orangeContainer').hide();var n_tot=parseInt($('#Stage_n_tot').text())+1;var n_key_old=parseInt($('#Stage_n_key').text());var n_key=n_key_old;var n_err_old=parseInt($('#Stage_n_err').text());var n_err=n_err_old;if(outcome.left_90==outcome.right_90){n_key++;if(outcome.left_plus!=outcome.right_plus){n_err++;}}
$('#Stage_n_tot').text(n_tot);$('#Stage_n_key').text(n_key);$('#Stage_n_err').text(n_err);var p_err=0;if(n_key>0){p_err=n_err/n_key;var p_err_old=parseInt($('#Stage_p_err').text());$('#Stage_p_err').text(p_err.toFixed(3));}
row_count++;if(multiple==false){if(row_count>1){if(row_count<6){for(i=row_count-1;i>0;i--){a_basis[i]=a_basis[i-1];a_outcome[i]=a_outcome[i-1];b_basis[i]=b_basis[i-1];b_outcome[i]=b_outcome[i-1];same_basis[i]=same_basis[i-1];key[i]=key[i-1];e_basis[i]=e_basis[i-1];e_outcome[i]=e_outcome[i-1];}}
else{for(i=6;i>0;i--){a_basis[i]=a_basis[i-1];a_outcome[i]=a_outcome[i-1];b_basis[i]=b_basis[i-1];b_outcome[i]=b_outcome[i-1];same_basis[i]=same_basis[i-1];key[i]=key[i-1];e_basis[i]=e_basis[i-1];e_outcome[i]=e_outcome[i-1];}}}}
a_basis[0]=(outcome.left_90?'X':'Z');a_outcome[0]=(outcome.left_plus?'1':'0');b_basis[0]=(outcome.right_90?'X':'Z');b_outcome[0]=(outcome.right_plus?'1':'0');same_basis[0]=(n_key>n_key_old?'JA':'NEIN');key[0]='';if(n_key>n_key_old)key[0]=(outcome.left_plus?'1':'0');if(n_err>n_err_old){key[0]=('FEHLER'.fontcolor('red'));error=true;}
else error=false;if($('#Stage_eavesdrop').css('display')=='block'){e_basis[0]=(outcome.eavesdrop_90?'X':'Z');e_outcome[0]=(outcome.eavesdrop_plus?'1':'0');}
else{e_basis[0]=('');e_outcome[0]=('');;}
if(multiple==false){$('#Stage_eve_wrong_basis').hide();for(var i=1;i<=6;i++){$('#Stage_a_basis'+i).html(a_basis[i-1]);$('#Stage_a_outcome'+i).html(a_outcome[i-1]);$('#Stage_b_basis'+i).html(b_basis[i-1]);$('#Stage_b_outcome'+i).html(b_outcome[i-1]);$('#Stage_e_basis'+i).html(e_basis[i-1]);$('#Stage_e_outcome'+i).html(e_outcome[i-1]);$('#Stage_same_basis'+i).html(same_basis[i-1]);$('#Stage_key'+i).html(key[i-1]);if(i>1){if((same_basis[i-1]=='JA')&&(a_basis[i-1]!=e_basis[i-1])&&(e_basis[i-1]!='')){$('#Stage_red'+i).show();$('#Stage_eve_wrong_basis').show();}
else $('#Stage_red'+i).hide();}}}
if(same_basis[0]=='JA'){if(a_keys.length>=40){a_keys.pop();b_keys.pop();}
a_keys.unshift(a_outcome[0]);b_keys.unshift(b_outcome[0]);}
var text_alice='';for(var i=0;i<a_keys.length;i++){text_alice=text_alice+' '+a_keys[i];}
$('#Stage_alice_keys').html(text_alice);var text_bob='';for(var i=0;i<b_keys.length;i++){text_bob=text_bob+' '+b_keys[i];}
$('#Stage_bob_keys').html(text_bob);count_keys=0;for(var i=0;i<b_keys.length;i++){if(b_keys[i]=='0'||b_keys[i]=='1')count_keys++;}
if(count_keys<30){sym_disable($('#Stage_check_for_errors_button'));$('#Stage_feedback_text').html('Mache mehr Messungen um zu testen!');}
else{sym_enable($('#Stage_check_for_errors_button'));$('#Stage_feedback_text').html('');}
if(multiple==false){prefix=AdobeEdge.getComposition(compId).getStage();if(a_outcome[0]=='1'){prefix.getSymbol('#Stage_greenFlashAlice').play(0);prefix.getSymbol('#Stage_blueFlashAlice').stop(0);}
if(a_outcome[0]=='0'){prefix.getSymbol('#Stage_blueFlashAlice').play(0);prefix.getSymbol('#Stage_greenFlashAlice').stop(0);}
if(b_outcome[0]=='1'){prefix.getSymbol('#Stage_greenFlashBob').play(0);prefix.getSymbol('#Stage_blueFlashBob').stop(0);}
if(b_outcome[0]=='0'){prefix.getSymbol('#Stage_blueFlashBob').play(0);prefix.getSymbol('#Stage_greenFlashBob').stop(0);}
if(e_outcome[0]=='1'){prefix.getSymbol('#Stage_greenFlashEve').play(0);prefix.getSymbol('#Stage_blueFlashEve').stop(0);}
if(e_outcome[0]=='0'){prefix.getSymbol('#Stage_blueFlashEve').play(0);prefix.getSymbol('#Stage_greenFlashEve').stop(0);}}}
function check_for_errors(){var random_keys=[];for(var i=1;i<=20;i++){a=Math.floor(Math.random()*(a_keys.length));if((a_keys[a]=='0'||a_keys[a]=='1')&&$.inArray(a,random_keys)==-1){random_keys.unshift(a);}
else i--;}
debug(random_keys.length);var text_a='';var text_b='';var twenty=0;for(var k=0;k<a_keys.length;k++){if($.inArray(k,random_keys)!=-1){text_a=text_a+' '+((a_keys[k]==b_keys[k])?a_keys[k].fontcolor('green'):a_keys[k].fontcolor('red'));bKeys=b_keys[k]
text_b=text_b+' '+((a_keys[k]==b_keys[k])?bKeys.fontcolor('green'):bKeys.fontcolor('red'));$('#Stage_o'+twenty).css({'left':188+18*(k%10)+'px','top':374+17*((k-k%10)/10)+'px','background-color':(a_keys[k]!=b_keys[k])?'rgb(255,169,112)':'rgb(152,204,108)'});$('#Stage_o'+twenty+'Copy').css({'left':187+182+18*(k%10)+'px','top':374+17*((k-k%10)/10)+'px','background-color':(a_keys[k]!=b_keys[k])?'rgb(255,169,112)':'rgb(152,204,108)'});twenty++;if(a_keys[k]!=b_keys[k])numberOfErrors++;}
else{text_a=text_a+' '+a_keys[k];text_b=text_b+' '+b_keys[k];}}
$('#Stage_alice_keys').html(text_a);$('#Stage_bob_keys').html(text_b);$('#Stage_orangeContainer').show();var space='2'.fontcolor('#ffe89a');if(numberOfErrors==0){if($('#Stage_sga_angle_rand_radio').hasClass('selected')){$('#Stage_feedback_text').html('Keine Fehler gefunden. Die geheimen Bits sind sicher!'.fontcolor('green'));for(var j=0;j<20;j++){a_keys.splice(random_keys[j],1,space);b_keys.splice(random_keys[j],1,space);}}
else{$('#Stage_feedback_text').html('Keine Fehler, aber feste Messrichtung. Nicht sicher!');a_keys=[];b_keys=[];}}
else{$('#Stage_feedback_text').html((numberOfErrors+' Fehler gefunden. Schlüssel nicht verwenden!').fontcolor('red'));a_keys=[];b_keys=[];}
numberOfErrors=0;if(continuous_count)send_continuous_particles();}
function clear_measurements_event(e){save.values={};clear_measurements();}
function clear_measurements(){close_to_prediction=0;$('#Stage_eavesdrop_source').hide();$('#Stage_orangeContainer').hide();var n_key_th=0.5;var n_err_th=0;var p_err_th=0;if($('#Stage_sga_angle_fixd_radio').hasClass('selected')){if($('#Stage_sga_left_angle1_radio').hasClass('selected')==$('#Stage_sga_right_angle1_radio').hasClass('selected')){n_key_th='';var left_angle=$('#Stage_sga_left_angle1_radio').hasClass('selected')?1:2;var stage=AdobeEdge.getComposition(compId).getStage();stage.getSymbol('sga_eavesdrop').stop(left_angle+'');}
else{n_key_th=0;n_err_th='';p_err_th='';}}
else if($('#Stage_eavesdrop').css('display')=='block'){n_err_th=0.25;p_err_th=0.25;}
$('#Stage_n_tot').text(0);$('#Stage_n_key').text(0);$('#Stage_n_err').text(0);$('#Stage_p_err').text('');$('#Stage_n_key_th').text(n_key_th);$('#Stage_n_err_th').text(n_err_th);$('#Stage_p_err_th').text(p_err_th);$('#Stage_n_tot_label2').hide();$('#Stage_n_key_label2').hide();n_key_th!==0?$('#Stage_n_tot_label2').show():$('#Stage_n_tot_label2').hide();n_err_th!==0&&n_key_th!==0?$('#Stage_n_key_label2').show():$('#Stage_key_label2').hide();$('#Stage_n_tot_label2').css('left',(n_key_th===''?190:200)+'px');$('#Stage_n_err_th').css('left',(n_err_th===0?163:160)+'px');row_count=0;a_basis=['','','','','',''];a_outcome=['','','','','',''];b_basis=['','','','','',''];b_outcome=['','','','','',''];same_basis=['','','','','',''];key=['','','','','',''];e_basis=['','','','','',''];e_outcome=['','','','','',''];for(var i=1;i<=6;i++){$('#Stage_a_basis'+i).html('');$('#Stage_a_outcome'+i).html('');$('#Stage_b_basis'+i).html('');$('#Stage_b_outcome'+i).html('');$('#Stage_e_basis'+i).html('');$('#Stage_e_outcome'+i).html('');$('#Stage_same_basis'+i).html('');$('#Stage_key'+i).html('');}
sym_disable($('#Stage_check_for_errors_button'));$('#Stage_feedback_text').html('Mache mehr Messungen um zu testen!');a_keys=[];b_keys=[];$('#Stage_alice_keys').text('');$('#Stage_bob_keys').text('');for(var i=2;i<=6;i++){$('#Stage_red'+i).hide();}
$('#Stage_eve_wrong_basis').hide();numberOfErrors=0;frozen_flashes();$('#Stage_alice_source').hide();}
function frozen_flashes(){prefix=AdobeEdge.getComposition(compId).getStage();prefix.getSymbol('#Stage_greenFlashAlice').stop(0);prefix.getSymbol('#Stage_blueFlashAlice').stop(0);prefix.getSymbol('#Stage_greenFlashBob').stop(0);prefix.getSymbol('#Stage_blueFlashBob').stop(0);prefix.getSymbol('#Stage_greenFlashEve').stop(0);prefix.getSymbol('#Stage_blueFlashEve').stop(0);prefix.getSymbol('#Stage_sga_right').getSymbol('flash_1').stop(0);prefix.getSymbol('#Stage_sga_right').getSymbol('flash_0').stop(0);prefix.getSymbol('#Stage_sga_eavesdrop').getSymbol('flash_1').stop(0);prefix.getSymbol('#Stage_sga_eavesdrop').getSymbol('flash_0').stop(0);$('#Stage_alice_source').hide();}
function rotate_sgas_event(e){var left_angle=$('#Stage_sga_left_angle1_radio').hasClass('selected')?1:2;var right_angle=$('#Stage_sga_right_angle1_radio').hasClass('selected')?1:2;if(multiple==false)rotate_sgas(left_angle,right_angle);save.left_angle=left_angle;save.right_angle=right_angle;clear_measurements();}
function rotate_sgas(left_angle,right_angle){if(left_angle=='random')return;sym_select($('#Stage_sga_left_angle'+left_angle+'_radio'));sym_select($('#Stage_sga_right_angle'+right_angle+'_radio'));if(multiple==false){var stage=AdobeEdge.getComposition(compId).getStage();stage.getSymbol('sga_right').stop(right_angle+'');}}
function rotate_sgas_random_event(e){var randomize_angles=$('#Stage_sga_angle_rand_radio').hasClass('selected');rotate_sgas_random(randomize_angles);save.randomize_angles=randomize_angles;if(randomize_angles){save.left_angle='random';save.right_angle='random';}
else{rotate_sgas_event(null);return;}
clear_measurements();}
function rotate_sgas_random(randomize_angles){if(randomize_angles){sym_select($('#Stage_sga_angle_rand_radio'));sym_disable($('#Stage_sga_left_angle1_radio'));sym_disable($('#Stage_sga_left_angle2_radio'));sym_disable($('#Stage_sga_right_angle1_radio'));sym_disable($('#Stage_sga_right_angle2_radio'));}else{sym_select($('#Stage_sga_angle_fixd_radio'));sym_enable($('#Stage_sga_left_angle1_radio'));sym_enable($('#Stage_sga_left_angle2_radio'));sym_enable($('#Stage_sga_right_angle1_radio'));sym_enable($('#Stage_sga_right_angle2_radio'));}}
function eavesdrop_enable_event(e){var eavesdrop=$('#Stage_eavesdrop_button_label').text()=="Starte Lauschangriff!";eavesdrop_enable(eavesdrop);save.eavesdrop=eavesdrop;clear_measurements();}
function eavesdrop_enable(eavesdrop){eavesdrop?$('#Stage_eavesdrop').show():$('#Stage_eavesdrop').hide();$('#Stage_eavesdrop_button_label').text(eavesdrop?"Beende Lauschangriff":"Starte Lauschangriff!");}
function fireworks(){var number=6;var spread=75;var delay_const=500;var speed_const=700;var speed_const_offset=500;var x0=138,y0=493;var totalDelay=0;$('#Stage .star').hide();$('#Stage .star').css({'left':x0+'px','top':y0+'px','opacity':1});$('#Stage .star').fadeIn(500);for(var i=0;i<number;i++){var left=Math.round(Math.random()*spread);if(Math.random()<0.5)
left='-='+left+'px';else
left='+='+left+'px';var delay1=Math.round((Math.random()+.25)*delay_const);totalDelay+=delay1;var speed=Math.round((Math.random()+.5)*speed_const)+speed_const_offset;$('#Stage_stars'+i).delay(delay1).animate({'left':left,'top':'-=500px','opacity':0},speed);}
$('#Stage .star').delay(1000).fadeOut();}
function startScoreAnimation(a,b){var startValue=a;var endValue=b;var delayScore=150;var delayScoreCountdown=delayScore;if(b>a)
{function recursiveFunction(){clearInterval(scoreIncrementer);startValue++;$('#Stage_textScore').text(+startValue+'/100');if(startValue==endValue)
return;delayScoreCountdown=delayScoreCountdown-8;scoreIncrementer=setInterval(function(){recursiveFunction()},delayScoreCountdown);}
var scoreIncrementer=setInterval(function(){recursiveFunction()},delayScoreCountdown);$('#Stage_textScore').fadeOut(500);$('#Stage_textScore').fadeIn(500);}}
var totalScore=0;var feedbackProb=1;function addedFeedback(score){if(totalScore<100){startScoreAnimation(score,totalScore);if(totalScore>score&&Math.random()<feedbackProb){fireworks();feedbackProb=0.25;}else
feedbackProb=2*feedbackProb;}else
$('#Stage_textScore').text('100/100');if(totalScore==100){AdobeEdge.getComposition(compId).getStage().getSymbol('steps').getSymbol('fancyExcellent').play();totalScore=101;}}
function setup_mode(l,r,random){stage=AdobeEdge.getComposition(compId).getStage();if(l=='z')sym_select($('#Stage_sga_left_angle1_radio'));else sym_select($('#Stage_sga_left_angle2_radio'));if(r=='z')sym_select($('#Stage_sga_right_angle1_radio'));else sym_select($('#Stage_sga_right_angle2_radio'));if(random)sym_select($('#Stage_sga_angle_rand_radio'));else sym_select($('#Stage_sga_angle_fixd_radio'));rotate_sgas_random_event(null);if(challenges){$('#Stage .radio').each(function(){sym_disable($(this));});$('#Stage .button').each(function(){sym_disable($(this));});$('#Stage .noChallenge').hide();}
else{$('#Stage .radio').each(function(){sym_enable($(this));});$('#Stage .button').each(function(){sym_enable($(this));})
sym_select($('#Stage_sga_angle_rand_radio'));$('#Stage .noChallenge').show();rotate_sgas_random_event(null);}
clear_measurements();sym_enable(stage.getSymbol('#Stage_steps').$('submitButton'));}
function random_array(n){var container=[];var myArray=[];for(var i=1;i<=n;i++){container.push(i)}
for(var i=1;i<=n;i++){k=Math.floor(Math.random()*(container.length));myArray.push(container[k]);container.splice(k,1);}
return myArray;}
var answer=[];correct=false;function submit(){var stage=AdobeEdge.getComposition(compId).getStage().getSymbol('#Stage_steps');var feedback_text='';var score=0;var currentScore=totalScore;switch(current_challenge){case 1:answer=[];for(var i=1;i<=4;i++){if(stage.$('answer1_'+i+'_checkbox').hasClass('selected'))answer.push(i);}
var countFalse=0;for(var i=0;i<answer.length;i++){if($.inArray(answer[i],correct_answers)==-1){countFalse++;}}
if(countFalse==0&&number_selected==2){feedback_text='Herzlichen Glückwunsch - das ist korrekt! Alice und Bob erhalten stets diesselben Werte wenn sie dieselbe Richtung (X oder Z) verwenden. Falls sie unterschiedliche Messrichtungen verwenden, sind die Ergebnisse nicht korreliert; hier kommen sämtliche Kombinationen (0,0), (0,1), (1,0) und (1,1) mit gleicher Wahrscheinlichkeit vor.';if(!$('#Stage_Tick1').hasClass('showing'))totalScore+=15;$('#Stage_Tick1').show();$('#Stage_Tick1').addClass('showing');}
else if(countFalse>0&&number_selected>countFalse&&number_selected<4){feedback_text='Dies ist teilweise richtig, aber noch nicht vollständig richtig. Bedenke, dass Alice und Bob stets korrelierte Ergebnisse erhalten, wenn sie dieselbe Richtung verwenden. In diesem Fall erhält Bob immer eine 0 wenn Alice eine 0 schickte, und eine 1 wenn Alice eine 1 schickte. ';}
else if(countFalse==0&&number_selected==1){feedback_text='Dies ist teilweise richtig, aber noch nicht vollständig richtig. Bedenke, dass Alice und Bob stets korrelierte Ergebnisse erhalten, wenn sie dieselbe Richtung verwenden. In diesem Fall erhält Bob immer eine 0 wenn Alice eine 0 schickte, und eine 1 wenn Alice eine 1 schickte. ';}
else{feedback_text='Dies ist noch nicht richtig. Bedenke, dass Alice und Bob stets korrelierte Ergebnisse erhalten, wenn sie dieselbe Richtung verwenden. In diesem Fall erhält Bob immer eine 0 wenn Alice eine 0 schickte, und eine 1 wenn Alice eine 1 schickte. ';}
if(countFalse>0||number_selected==1)correct=false;else correct=true;break;case 2:answer=[];for(var i=1;i<=6;i++){if(stage.$('answer2_'+i+'_radio').hasClass('selected'))answer.push(i);}
for(var i=0;i<answer.length;i++){if($.inArray(answer[i],correct_answers)==-1){correct=false;break;}
else correct=true;}
if(correct){if(count_keys>1)feedback_text='Herzlichen Glückwunsch - das ist korrekt! Alice und Bob haben '+count_keys+'-mal dieselbe Richtung gewählt. Somit sind '+count_keys+' Bits in ihrem gemeinsamen Schlüssel.';else feedback_text='Herzlichen Glückwunsch - das ist korrekt! Alice und Bob haben '+count_keys+'-mal dieselbe Richtung gewählt. Somit ist '+count_keys+' Bit in ihrem gemeinsamen Schlüssel.';if(!$('#Stage_Tick2').hasClass('showing'))totalScore+=15;$('#Stage_Tick2').show();$('#Stage_Tick2').addClass('showing');}
else{feedback_text='Dies ist noch nicht richtig. Bedenke, dass Alice und Bob nur solche Werte behalten, bei denen die Richtungen übereingestimmt haben. Diese Werte bilden den Schlüssel.';}
break;case 3:answer=[];for(var i=1;i<=4;i++){if(stage.$('answer3_'+i+'_radio').hasClass('selected'))answer.push(i);}
for(var i=0;i<answer.length;i++){if($.inArray(answer[i],correct_answers)==-1){correct=false;break;}
else correct=true;}
if(correct){feedback_text='Herzlichen Glückwunsch - das ist korrekt! Der Schlüssel besteht aus allen Werten, bei denen Alice und Bob dieselben Richtungen gewählt haben. Für diese Bits haben Alice und Bob stets dieselben Werte.';if(!$('#Stage_Tick3').hasClass('showing'))totalScore+=15;$('#Stage_Tick3').show();$('#Stage_Tick3').addClass('showing');}
else if(stage.$('radio_label3_'+(answer[0])).text().length==12){feedback_text='Dies ist noch nicht richtig. Bedenke, dass Alice und Bob nur solche Werte behalten, bei denen die Richtungen übereingestimmt haben. Diese Werte bilden den Schlüssel.';}
else{feedback_text='Dies ist noch nicht richtig. Bedenke, dass Alice und Bob stets korrelierte Ergebnisse (X oder Z) erhalten, wenn sie dieselbe Messrichtung verwenden. In diesem Fall erhält Bob immer eine 0 wenn Alice eine 0 schickte, und eine 1 wenn Alice eine 1 schickte. ';}
break;case 4:answer=[];for(var i=1;i<=3;i++){if(stage.$('answer4_'+i+'_radio').hasClass('selected'))answer.push(i);}
for(var i=0;i<answer.length;i++){if($.inArray(answer[i],correct_answers)==-1){correct=false;break;}
else correct=true;}
if(correct){feedback_text='Herzlichen Glückwunsch - das ist korrekt! Eve fängt die Teilchen ab, misst zufällig in X- oder Z-Richtung und schickt ihren gemessenen Zustand weiter. Falls Eve nicht dieselbe Richtung wie Alice und Bob verwendet, kann es zu Fehlern kommen. Ein Beispiel: wenn Alice |&#8593;&#x232A; sendet, misst z.B. Eve eine 1 in der X-Richtung and sendet den Zustand |+&#x232A; weiter an Bob. Bob wird dann mit 50% Wahrscheinlichkeit den Zustand |&#8595;&#x232A; messen.';if(!$('#Stage_Tick4').hasClass('showing'))totalScore+=15;$('#Stage_Tick4').show();$('#Stage_Tick4').addClass('showing');}
else if(!correct&&answer[0]==1||answer[0]==2){feedback_text='Dies ist noch nicht richtig. Eve fängt die von Alice geschickten Teilchen ab, misst zufällig in X- oder Z-Richtung und schickt ihren gemessenen Zustand weiter. Falls Eve dieselbe Richtung wie Alice verwendet, schickt sie den ursprünglichen Zustand unverändert weiter (z.B. wenn Alice |&#8593;&#x232A; sendet, misst Eve eine 1 in Z-Richtung, und sendet somit denselben Zustand |&#8593;&#x232A; an Bob). Somit entstehen keine Fehler in Bob’s Messungen wenn Eve dieselbe Richtung wie Alice wählt.';}
else{feedback_text='Dies ist noch nicht richtig. Eve fängt die von Alice geschickten Teilchen ab, misst zufällig in X- oder Z-Richtung und schickt ihren gemessenen Zustand weiter. Falls Eve dieselbe Richtung wie Alice verwendet, schickt sie den ursprünglichen Quantenzustand unverändert an Bob weiter (z.B. wenn Alice |&#8593;&#x232A; sendet (Z-Richtung), misst Eve eine 1 in Z-Richtung, und sendet somit denselben Zustand |&#8593;&#x232A; an Bob). Was passiert, wenn Eve die falsche Richtung wählt?'}
break;case 5:answer=[];for(var i=1;i<=3;i++){if(stage.$('answer4_'+i+'_radio').hasClass('selected'))answer.push(i);}
for(var i=0;i<answer.length;i++){if($.inArray(answer[i],correct_answers)==-1){correct=false;break;}
else correct=true;}
if(correct){feedback_text='Herzlichen Glückwunsch - das ist korrekt! Eve muss hier in der '+e_basis[0]+' Richtung gemessen haben. Eve sendet dann entweder den Zustand '+((e_basis[0]=='X')?'<span style="white-space: nowrap;">|+&#x232A; oder |&#8211;&#x232A;</span>':'<span style="white-space: nowrap;">|&#8593;&#x232A; oder |&#8595;&#x232A;</span>')+' an Bob, aber beide diese Zustände geben völlig zufällige Resultate in '+(e_basis[0]=='X'?'Z':'X')+' Richtung. Somit wenn Alice '+((e_basis[0]=='X')?'|&#8593;&#x232A; (Wert 1 in Z Richtung)':'|+&#x232A; (Wert 1 in X Richtung) ')+' schickt, kann es passieren, dass Bob 0 misst unabhängig davon, ob Eve '+((e_basis[0]=='X')?'<span style="white-space: nowrap;">|+&#x232A; or |&#8211;&#x232A;</span>':'<span style="white-space: nowrap;">|&#8593;&#x232A; or |&#8595;&#x232A;</span>')+' sendete. Somit können wir Eve’s Messwert nicht bestimmen.';if(!$('#Stage_Tick5').hasClass('showing'))totalScore+=20;$('#Stage_Tick5').show();$('#Stage_Tick5').addClass('showing');}
else{feedback_text='Dies ist noch nicht richtig. Eve muss hier in der '+e_basis[0]+' Richtung gemessen haben. Eve sendet dann entweder den Zustand '+((e_basis[0]=='X')?'<span style="white-space: nowrap;">|+&#x232A; oder |&#8211;&#x232A;</span>':'<span style="white-space: nowrap;">|&#8593;&#x232A; oder |&#8595;&#x232A;</span>')+' an Bob, aber beide diese Zustände geben völlig zufällige Resultate in '+(e_basis[0]=='X'?'Z':'X')+' Richtung. Somit wenn Alice '+((e_basis[0]=='X')?'|&#8593;&#x232A; (Wert 1 in Z Richtung)':'|+&#x232A; (Wert 1 in X Richtung) ')+' schickt, kann es passieren, dass Bob 0 misst unabhängig davon, ob Eve '+((e_basis[0]=='X')?'<span style="white-space: nowrap;">|+&#x232A; or |&#8211;&#x232A;</span>':'<span style="white-space: nowrap;">|&#8593;&#x232A; or |&#8595;&#x232A;</span>')+' sendete.';}
break;case 6:answer=[];for(var i=1;i<=3;i++){if(stage.$('answer4_'+i+'_radio').hasClass('selected'))answer.push(i);}
for(var i=0;i<answer.length;i++){if($.inArray(answer[i],correct_answers)==-1){correct=false;break;}
else correct=true;}
if(correct){feedback_text='Herzlichen Glückwunsch - das ist korrekt! Alice und Bob haben beide die '+a_basis[0]+'-Richtung gewählt. Wenn Eve ebenfalls die '+a_basis[0]+'-Richtung wählte, kommt es zu keinem Fehler. Wenn Eve hingegen die '+((a_basis[0]=='X')?'Z':'X')+'-Richtung wählte, sendet sie entweder den Zustand '+((a_basis[0]=='Z')?'<span style="white-space: nowrap;">|+&#x232A; oder |&#8211;&#x232A;</span>':'<span style="white-space: nowrap;">|&#8593;&#x232A; oder |&#8595;&#x232A;</span>')+'  an Bob. Diese beiden Zustände geben aber völlig zufällige Resultate in '+a_basis[0]+' Richtung. Somit wird Bob den richtigen Messwert in 50% der Fälle erhalten, bei denen Eve die falsche Richtung wählte. ';if(!$('#Stage_Tick6').hasClass('showing'))totalScore+=20;$('#Stage_Tick6').show();$('#Stage_Tick6').addClass('showing');}
else{feedback_text='Dies ist noch nicht richtig. Alice und Bob haben beide die '+a_basis[0]+'-Richtung gewählt. Wenn Eve ebenfalls die '+a_basis[0]+'-Richtung wählte, kommt es zu keinem Fehler. Wenn Eve hingegen die '+((a_basis[0]=='X')?'Z':'X')+'-Richtung wählte, sendet sie entweder den Zustand '+((a_basis[0]=='Z')?'<span style="white-space: nowrap;">|+&#x232A; oder |&#8211;&#x232A;</span>':'<span style="white-space: nowrap;">|&#8593;&#x232A; oder |&#8595;&#x232A;</span>')+'  an Bob. Diese beiden Zustände geben aber völlig zufällige Resultate in '+a_basis[0]+' Richtung. Somit wird Bob den richtigen Messwert in 50% der Fälle erhalten, bei denen Eve die falsche Richtung wählte. ';}
break;}
if(correct==false)
feedback_text='<div style="color:#960000">'+feedback_text+'</div>';else
feedback_text='<div style="color:#008f00">'+feedback_text+'</div>';if(stage.$('feedback').text()!=''){stage.$('feedback').fadeOut(250)};write=setTimeout(function(){stage.$('feedback').html(feedback_text)},250);stage.$('feedback').fadeIn(250);addedFeedback(currentScore);}
var number_selected=0;function submit_button_hide(){var stage=AdobeEdge.getComposition(compId).getStage().getSymbol('#Stage_steps');number_selected=0;switch(current_challenge){case 1:for(var i=1;i<=4;i++){if(stage.$('answer1_'+i+'_checkbox').hasClass('selected'))number_selected++;}
break;case 2:for(var i=1;i<=6;i++){if(stage.$('answer2_'+i+'_radio').hasClass('selected'))number_selected++;}
break;case 3:for(var i=1;i<=4;i++){if(stage.$('answer3_'+i+'_radio').hasClass('selected'))number_selected++;}
break;case 4:for(var i=1;i<=3;i++){if(stage.$('answer4_'+i+'_radio').hasClass('selected'))number_selected++;}
break;case 5:for(var i=1;i<=3;i++){if(stage.$('answer4_'+i+'_radio').hasClass('selected'))number_selected++;}
break;case 6:for(var i=1;i<=3;i++){if(stage.$('answer4_'+i+'_radio').hasClass('selected'))number_selected++;}
break;}
if(number_selected==0)sym_disable(stage.getSymbol('#Stage_steps').$('submitButton'));else sym_enable(stage.getSymbol('#Stage_steps').$('submitButton'));}
var correct_answers=[];var current_challenge;function step_functions(step){clearTimeout(AdobeEdge.step_animation);current_challenge=step;var stage=AdobeEdge.getComposition(compId).getStage().getSymbol('#Stage_steps');stage.$('feedback').html('');switch(step){case 1:eavesdrop_enable(false);setup_mode('z','z',true);sym_disable(stage.getSymbol('#Stage_steps').$('submitButton'));for(var i=1;i<=4;i++)sym_deselect(stage.$('answer1_'+i+'_checkbox'));for(var i=1;i<=6;i++)add_single_count();if(count_keys==0||count_keys==6)return step_functions(1);frozen_flashes();for(var i=1;i<=6;i++)$('#Stage_b_outcome'+i).html('?');answer1='';answer2='';answer3='';answer4='';count=0;correct_answers=[];for(var i=1;i<=6;i++){if(same_basis[i-1]=='JA'){answer1=answer1+a_outcome[i-1]+' ';answer2=answer2+a_outcome[i-1]+' ';answer3=answer3+((a_outcome[i-1]=='0')?'1':'0')+' ';answer4=answer4+((a_outcome[i-1]=='0')?'1':'0')+' ';}
else{count++;answer1=answer1+(count%2)+' ';answer2=answer2+((count+1)%2)+' ';answer3=answer3+((count+1)%2)+' ';answer4=answer4+(count%2)+' ';}}
random_four=random_array(4);for(var i=0;i<=3;i++){stage.$('answer1_'+(i+1)).html(window['answer'+(random_four[i])]);if(random_four[i]==1||random_four[i]==2)correct_answers.push(i+1);}
break;case 2:eavesdrop_enable(false);setup_mode('z','z',true);sym_enable(stage.getSymbol('#Stage_steps').$('.group_answer2'));sym_deselect(stage.getSymbol('#Stage_steps').$('.group_answer2'));sym_disable(stage.getSymbol('#Stage_steps').$('submitButton'));for(var i=1;i<=6;i++)add_single_count();if(count_keys==0)return step_functions(2);frozen_flashes();for(var i=1;i<=6;i++)$('#Stage_key'+i).html('?');correct_answers=[count_keys];break;case 3:eavesdrop_enable(false);setup_mode('z','z',true);sym_enable(stage.getSymbol('#Stage_steps').$('.group_answer3'));sym_deselect(stage.getSymbol('#Stage_steps').$('.group_answer3'));sym_disable(stage.getSymbol('#Stage_steps').$('submitButton'));for(var i=1;i<=6;i++)add_single_count();if(count_keys==0||count_keys==6)return step_functions(3);frozen_flashes();for(var i=1;i<=6;i++)$('#Stage_key'+i).html('?');answer1='';answer2='';answer3='';answer4='';correct_answers=[];for(var i=1;i<=6;i++){if(same_basis[i-1]=='JA'){answer1=answer1+a_outcome[i-1]+'&nbsp;';answer2=answer2+((a_outcome[i-1]=='0')?'1':'0')+'&nbsp;';}
answer3=answer3+(a_outcome[i-1])+'&nbsp;';answer4=answer4+((a_outcome[i-1]=='0')?'1':'0')+'&nbsp;';}
random_four=random_array(4);for(var i=0;i<=3;i++){stage.$('radio_label3_'+(i+1)).html(window['answer'+(random_four[i])]);if(random_four[i]==1)correct_answers.push(i+1);}
break;case 4:eavesdrop_enable(true);setup_mode('z','z',true);add_single_count();frozen_flashes();if(error==false)return step_functions(4);stage.$('answer4_radio1_label').html('X');stage.$('answer4_radio2_label').html('Z');AdobeEdge.getComposition(compId).getStage().getSymbol('sga_eavesdrop').stop('1');$('#Stage_e_basis'+1).html('?');$('#Stage_e_outcome'+1).html('?');sym_enable(stage.getSymbol('#Stage_steps').$('.group_answer4'));sym_deselect(stage.getSymbol('#Stage_steps').$('.group_answer4'));sym_disable(stage.getSymbol('#Stage_steps').$('submitButton'));correct_answers=[((e_basis[0]=='X')?1:2)];break;case 5:eavesdrop_enable(true);setup_mode('z','z',true);add_single_count();frozen_flashes();if(error==false||a_outcome[0]=='0')return step_functions(5);stage.$('answer4_radio1_label').html('0');stage.$('answer4_radio2_label').html('1');AdobeEdge.getComposition(compId).getStage().getSymbol('sga_eavesdrop').stop('1');$('#Stage_e_basis'+1).html('?');$('#Stage_e_outcome'+1).html('?');sym_enable(stage.getSymbol('#Stage_steps').$('.group_answer4'));sym_deselect(stage.getSymbol('#Stage_steps').$('.group_answer4'));sym_disable(stage.getSymbol('#Stage_steps').$('submitButton'));correct_answers=[3];break;case 6:eavesdrop_enable(true);setup_mode('z','z',true);add_single_count();frozen_flashes();if(error||same_basis[0]=='NEIN')return step_functions(6);stage.$('answer4_radio1_label').html('X');stage.$('answer4_radio2_label').html('Z');AdobeEdge.getComposition(compId).getStage().getSymbol('sga_eavesdrop').stop('1');$('#Stage_e_basis'+1).html('?');$('#Stage_e_outcome'+1).html('?');sym_enable(stage.getSymbol('#Stage_steps').$('.group_answer4'));sym_deselect(stage.getSymbol('#Stage_steps').$('.group_answer4'));sym_disable(stage.getSymbol('#Stage_steps').$('submitButton'));correct_answers=[3];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'});var is_chrome=navigator.userAgent.toLowerCase().indexOf('chrome')>-1;if(is_chrome){$('#Stage .slider').each(function(){var webkit_origin=$(this).find('.handle')[0].style.webkitTransformOrigin;$(this).find('.handle')[0].style.transformOrigin=webkit_origin;});}
$(function(){FastClick.attach(document.body);});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){step*=1;$('#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;}

//Edge symbol: 'stage'
(function(symbolName){Symbol.bindElementAction(compId,symbolName,"document","compositionReady",function(sym,e){sym_features();yepnope({load:"normalize.css"});show_boxes_event(e);rotate_sgas_event(e);rotate_sgas_random_event(e);eavesdrop_enable_event(e);clear_measurements_event(e);sym.$('Text2').html('Eve w&auml;hlte die falsche Basis!');sym.$('n_key_label').html('N<sub>key</sub>');sym.$('n_key_label2').html('N<sub>key</sub>');sym.$('n_key_label3').html('N<sub>key</sub>');sym.$('n_err_label').html('N<sub>err</sub>');sym.$('n_err_label2').html('N<sub>err</sub>');sym.$('n_tot_label').html('N<sub>tot</sub>');sym.$('n_tot_label2').html('N<sub>tot</sub>');formula='<span style="white-space: nowrap;">|&#936;&#x232A;<sub>ab</sub> = 1/&radic;<span style="text-decoration: overline">2</span>(|&#8593;<sub>a</sub>&#x232A;|&#8595;<sub>b</sub>&#x232A; - |&#8595;<sub>a</sub>&#x232A;|&#8593;<sub>b</sub>&#x232A;).</span>';sym.$('Text4').html('Alice und Bob möchten sich auf eine Folge von Zufallszahlen einigen, ohne dass sie sich dafür persönlich treffen müssen und ohne dass jemand anderes die Zahlen kennt. Wir nennen eine solche Zahlenfolge auch einen „sicheren Schlüssel“. Mit Mitteln der klassischen Physik ist dies jedoch nicht möglich, denn Alice und Bob können nie sicher sein, ob ihre Kommunikation vielleicht abgehört wurde. Erst die Quantenphysik macht die Verteilung eines sicheren Schlüssels möglich! <br><div style="line-height:50%;"><br></div>In this simulation, you can help Alice and Bob generate a secure key using individual spin ½ particles sent from Alice to Bob. Alice prepares each particle in a spin-state that is either spin-up (value 1) or spin-down (value 0) along one of two orthogonal axes, denoted X and Z. <br><div style="line-height:50%;"><br></div>She sends each particle to Bob, who is equipped with a Stern-Gerlach apparatus (SGA), which consists of a region of non-uniform magnetic field aligned along a given axis.  For spin ½ particles, the particles separate into two discrete streams, one deflected in the positive direction (outcome 1), one deflected in the negative direction (outcome 0).  You can orient each SGA along two orthogonal axes X and Z. In this simulation, the states |&#8593;&#x232A; and |&#8595;&#x232A; are spin states with outcomes of 1 and 0 respectively in the Z-direction,');sym.$('Text4').html('Alice und Bob möchten sich auf eine Folge von Zufallszahlen einigen, ohne dass sie sich dafür persönlich treffen müssen und ohne dass jemand anderes die Zahlen kennt. Wir nennen eine solche Zahlenfolge auch einen „sicheren Schlüssel“. Mit Mitteln der klassischen Physik ist dies jedoch nicht möglich, denn Alice und Bob können nie sicher sein, ob ihre Kommunikation vielleicht abgehört wurde. Erst die Quantenphysik macht die Verteilung eines sicheren Schlüssels möglich! <br><div style="line-height:50%;"><br></div>In dieser Simulation kannst Du Alice und Bob dabei helfen, einen sicheren Schlüssel zu erzeugen. Hierzu werden Quantenteilchen mit Spin-1/2 von Alice an Bob verschickt. Alice präpariert jedes Teilchen entweder als „Spin-hoch“ Zustand (Wert 1) oder „Spin-runter“ Zustand (Wert 0) in Z-Richtung (vertikal) oder in X-Richtung (horizontal). In der Simulation bezeichnen  |&#8593;&#x232A; und |&#8595;&#x232A; Zustände mit Werten 1 und 0 entlang der Z-Richtung, und |+&#x232A; und |&#8211;&#x232A; Zustände mit Werten 1 and 0 in der X-Richtung. <br><div style="line-height:50%;"><br></div>Zur Messung der von Alice geschickten Teilchen steht Bob ein Stern-Gerlach-Apparat (SGA) zur Verfügung, der ankommende Teilchen in einem inhomogenen Magnetfeld in eine von zwei');sym.$('Text7').html(' and |+&#x232A; and |&#8211;&#x232A; are spin states with outcomes of 1 and 0 respectively in the X-direction.<div style="line-height:50%;"><br></div> Alice and Bob note independent of one another the basis (X or Z) and value (0 or 1) for each particle sent from Alice to Bob. They know that their outcomes are perfectly correlated (if Alice sends 1, Bob measures 1; if Alice sends 0, Bob measures 0) when they both happened to choose the same basis.  After completing the measurements, they publicly share the bases used for each measurement (but not the values!), and keep only those values for which their bases were the same - this is the key.  Alice and Bob then exchange a small number of their values (which they then discard) to check for errors.<br><div style="line-height:50%;"><br></div><b>Your goal is to help Alice and Bob decide whether or not they have generated a secure key. How can they tell that an eavesdropper Eve has infiltrated their experiment? </b> <br>Press the Controls button to send particle pairs to Alice and Bob and to eavesdrop by intercepting and resending particles.');sym.$('Text7').html(' Richtungen ablenkt. Wird ein Teilchen in Richtung des roten Polschuhs abgelenkt bezeichnen wir das Resultat mit „1“, wird es in Richtung des grünen abgelenkt mit „0“. Der SGA kann entweder in Z-Richtung (vertikal) oder in X-Richtung (horizontal) orientiert werden.<br><div style="line-height:50%;"><br></div> Alice und Bob entscheiden sich für jedes Teilchen unabhängig voneinander und zufällig entweder für die X- oder die Z- Richtung. Alice und Bob erhalten stets korrelierte Ergebnisse, wenn sie dieselbe Richtung verwenden. In diesem Fall erhält Bob immer eine 0 wenn Alice eine 0 schickte, und eine 1 wenn Alice eine 1 schickte. Nachdem sie gemessen haben, veröffentlichen sie die Wahl ihrer Richtungen (aber nicht ihre Werte). Sie behalten nur solche Werte, bei denen die Richtungen übereingestimmt haben. Weiterhin veröffentlichen sie einen Teil der Werte um auf Fehler zu überprüfen.<br><div style="line-height:50%;"><br></div><b>Dein Ziel ist es zu entscheiden, ob Alice und Bob einen sicheren Schlüssel erzeugt haben. Wie kann man sehen, ob ein Lauscher (Eve) versucht, die Kommunikation abzuhören?</b> ');sym.getSymbol('#Stage_steps').$(".feedback").css({'position':'absolute','left':'50%','top':'50%','margin-left':-(sym.getSymbol('#Stage_steps').$(".feedback").outerWidth()/2),'margin-top':-(sym.getSymbol('#Stage_steps').$(".feedback").outerHeight()/2)});$('#Stage .star,.tick').hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_send_single_button}","click",function(sym,e){multiple=false;send_single_particle(e);});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_send_continuous_button}","click",function(sym,e){multiple=false;send_continuous_particles(e);});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_tab_simulation}","click",function(sym,e){sym.stop('simulation');sym_features();$('#Stage').data('step',false);clearTimeout(AdobeEdge.step_animation);challenges=false;setup_mode('z','z',true);show_boxes(save.show_key,save.show_errors,save.show_graph);rotate_sgas(save.left_angle,save.right_angle);rotate_sgas_random(save.randomize_angles);eavesdrop_enable(save.eavesdrop);clear_measurements();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_tab_challenges}","click",function(sym,e){if(continuous_count)send_continuous_particles(null);challenges=true;sym.stop('challenges');sym_features();sym_step(1);});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_send_multiple_button}","click",function(sym,e){multiple=true;send_multiple_particles(e);multiple=false;for(k=1;k<=6;k++){add_single_count();}});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_show_introduction_button}","click",function(sym,e){sym.stop('introduction');sym_features();if(continuous_count)send_continuous_particles(null);});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_show_controls_button}","click",function(sym,e){sym.stop('simulation');sym_features();show_boxes(save.show_key,save.show_errors,save.show_graph);});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_show_key_checkbox}","click",function(sym,e){show_boxes_event(null);});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_show_errors_checkbox}","click",function(sym,e){show_boxes_event(null);});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_show_graph_checkbox}","click",function(sym,e){show_boxes_event(null);});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_sga_right_angle1_radio}","click",function(sym,e){rotate_sgas_event(null);});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_sga_right_angle2_radio}","click",function(sym,e){rotate_sgas_event(null);});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_sga_angle_fixd_radio}","click",function(sym,e){rotate_sgas_random_event(null);});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_sga_angle_rand_radio}","click",function(sym,e){rotate_sgas_random_event(null);});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_eavesdrop_button}","click",function(sym,e){eavesdrop_enable_event(null);});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_clear_measurements_button}","click",function(sym,e){clear_measurements_event(e);});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_check_for_errors_button}","click",function(sym,e){check_for_errors();sym_disable($('#Stage_check_for_errors_button'));});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_link_st_andrews}","click",function(sym,e){window.open('http://www.st-andrews.ac.uk/physics/quvis','_blank');});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_sga_left_angle1_radio}","click",function(sym,e){rotate_sgas_event(null);});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_sga_left_angle2_radio}","click",function(sym,e){rotate_sgas_event(null);});
//Edge binding end
})("stage");
//Edge symbol end:'stage'

//=========================================================

//Edge symbol: 'checkbox_tickbox'
(function(symbolName){})("checkbox_tickbox");
//Edge symbol end:'checkbox_tickbox'

//=========================================================

//Edge symbol: 'radio_tickbox'
(function(symbolName){})("radio_tickbox");
//Edge symbol end:'radio_tickbox'

//=========================================================

//Edge symbol: 'highlight'
(function(symbolName){Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.play(0);});
//Edge binding end
})("highlight");
//Edge symbol end:'highlight'

//=========================================================

//Edge symbol: 'sga_left'
(function(symbolName){})("sga_left");
//Edge symbol end:'sga_left'

//=========================================================

//Edge symbol: 'sga_right'
(function(symbolName){})("sga_right");
//Edge symbol end:'sga_right'

//=========================================================

//Edge symbol: 'flash_detector_0'
(function(symbolName){})("flash_detector_0");
//Edge symbol end:'flash_detector_0'

//=========================================================

//Edge symbol: 'flash_detector_1'
(function(symbolName){})("flash_detector_1");
//Edge symbol end:'flash_detector_1'

//=========================================================

//Edge symbol: 'screen'
(function(symbolName){})("screen");
//Edge symbol end:'screen'

//=========================================================

//Edge symbol: 'key_row'
(function(symbolName){})("key_row");
//Edge symbol end:'key_row'

//=========================================================

//=========================================================

//Edge symbol: 'greenFlashGap'
(function(symbolName){Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.getComposition().getStage().continueStream();});
//Edge binding end
Symbol.bindTriggerAction(compId,symbolName,"Default Timeline",250,function(sym,e){if(!continuous_count){sym.stop();}});
//Edge binding end
})("greenFlashGap");
//Edge symbol end:'greenFlashGap'

//=========================================================

//Edge symbol: 'blueFlashGap'
(function(symbolName){Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.getComposition().getStage().continueStream();});
//Edge binding end
Symbol.bindTriggerAction(compId,symbolName,"Default Timeline",250,function(sym,e){if(!continuous_count){sym.stop();}});
//Edge binding end
})("blueFlashGap");
//Edge symbol end:'blueFlashGap'

//=========================================================

//Edge symbol: 'blueFlash'
(function(symbolName){Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.getComposition().getStage().continueStream();});
//Edge binding end
Symbol.bindTriggerAction(compId,symbolName,"Default Timeline",250,function(sym,e){if(!continuous_count){sym.stop();}});
//Edge binding end
})("blueFlash");
//Edge symbol end:'blueFlash'

//=========================================================

//Edge symbol: 'greenFlash'
(function(symbolName){Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.getComposition().getStage().continueStream();});
//Edge binding end
Symbol.bindTriggerAction(compId,symbolName,"Default Timeline",250,function(sym,e){if(!continuous_count){sym.stop();}});
//Edge binding end
})("greenFlash");
//Edge symbol end:'greenFlash'

//=========================================================

//=========================================================

//=========================================================

//Edge symbol: 'highlight'
(function(symbolName){Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.play(0);});
//Edge binding end
})("highlight_1");
//Edge symbol end:'highlight_1'

//=========================================================

//=========================================================

//=========================================================

//Edge symbol: 'highlight'
(function(symbolName){Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.play(0);});
//Edge binding end
})("highlight_1_1");
//Edge symbol end:'highlight_1_1'

//=========================================================

//=========================================================

//Edge symbol: 'highlight_rectangle'
(function(symbolName){Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.play(0);});
//Edge binding end
})("highlight_rectangle");
//Edge symbol end:'highlight_rectangle'

//=========================================================

//Edge symbol: 'up_z'
(function(symbolName){Symbol.bindTriggerAction(compId,symbolName,"Default Timeline",250,function(sym,e){if(!continuous_count){sym.stop();}});
//Edge binding end
Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.getComposition().getStage().continueStream();});
//Edge binding end
})("up_z");
//Edge symbol end:'up_z'

//=========================================================

//Edge symbol: 'up_z_2'
(function(symbolName){Symbol.bindTriggerAction(compId,symbolName,"Default Timeline",250,function(sym,e){if(!continuous_count){sym.stop();}});
//Edge binding end
})("down_z");
//Edge symbol end:'down_z'

//=========================================================

//Edge symbol: 'up_z_3'
(function(symbolName){Symbol.bindTriggerAction(compId,symbolName,"Default Timeline",250,function(sym,e){if(!continuous_count){sym.stop();}});
//Edge binding end
})("down_x");
//Edge symbol end:'down_x'

//=========================================================

//Edge symbol: 'up_z_1'
(function(symbolName){Symbol.bindTriggerAction(compId,symbolName,"Default Timeline",250,function(sym,e){if(!continuous_count){sym.stop();}});
//Edge binding end
})("up_x");
//Edge symbol end:'up_x'

//=========================================================

//Edge symbol: 'exploration'
(function(symbolName){Symbol.bindElementAction(compId,symbolName,"${_submitButton}","click",function(sym,e){submit();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer1_1_checkbox}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer1_2_checkbox}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer1_3_checkbox}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer1_4_checkbox}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer2_1_radio}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer2_2_radio}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer2_3_radio}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer2_4_radio}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer2_5_radio}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer2_6_radio}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer3_1_radio}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer3_2_radio}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer3_3_radio}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer3_4_radio}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer4_1_radio}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer4_2_radio}","click",function(sym,e){submit_button_hide();});
//Edge binding end
Symbol.bindElementAction(compId,symbolName,"${_answer4_3_radio}","click",function(sym,e){submit_button_hide();});
//Edge binding end
})("steps");
//Edge symbol end:'steps'

//=========================================================

//=========================================================

//=========================================================

//Edge symbol: 'highlight'
(function(symbolName){Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.play(0);});
//Edge binding end
})("highlight_1_2");
//Edge symbol end:'highlight_1_2'

//=========================================================

//=========================================================

//=========================================================

//Edge symbol: 'highlight'
(function(symbolName){Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.play(0);});
//Edge binding end
})("highlight_1_1_1");
//Edge symbol end:'highlight_1_1_1'

//=========================================================

//=========================================================

//Edge symbol: 'highlight_rectangle'
(function(symbolName){Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.play(0);});
//Edge binding end
})("highlight_rectangle_1");
//Edge symbol end:'highlight_rectangle_1'

//=========================================================

//Edge symbol: 'fancyExcellent'
(function(symbolName){Symbol.bindTimelineAction(compId,symbolName,"Default Timeline","complete",function(sym,e){sym.stop(0);});
//Edge binding end
})("fancyExcellent");
//Edge symbol end:'fancyExcellent'
})(jQuery,AdobeEdge,"EDGE-19890435");