text: $(document).ready(function () { 
  var questionNumber=0;
  var questionBank=new Array();
  var stage="#game1";
  var stage2=new Object;
  var questionLock=false;
  var numberOfQuestions;
  var score=0;
  $.getJSON('activity3.json', function(data) {
      for(i=0; i<data.quizlist.length; i++){
        questionBank[i]=new Array;
        questionBank[i][0] = data.quizlist[i].question;
        questionBank[i][1] = data.quizlist[i].option1;
        questionBank[i][2] = data.quizlist[i].option2;
        questionBank[i][3] = data.quizlist[i].option3;
        }
        numberOfQuestions = questionBank.length;
        displayQuestion();
  })
  function displayQuestion(){
        var rnd=Math.random()*3; 
        rnd=Math.ceil(rnd);
        var q1;
        var q2;
        var q3;
       
  	  if(rnd==1){q1=questionBank[questionNumber][1]; q2=questionBank[questionNumber][2]; q3=questionBank[questionNumber][3];}1
        if(rnd==2){q2=questionBank[questionNumber][1]; q3=questionBank[questionNumber][2]; q1=questionBank[questionNumber][3];}
        if(rnd==3){q3=questionBank[questionNumber][1];q1=questionBank[questionNumber][2];q2=questionBank[questionNumber][3];}
      
      $(stage).append('<div class = "questionText">' + questionBank[questionNumber][0] + '</div><div id= "1" class="option">'+q1+'</div> <div id="2" class="option">'+q2+'</div> <div id="3" class="option">'+q3+'</div>');
      
      $('.option').click(function(){
        if(questionLock==false){questionLock=true; 
        if(this.id==rnd){
        $(stage).append('<div class="feedback1">CORRECT</div>');
        score++;
        }
        if(this.id!=rnd){
        $(stage).append('<div class="feedback2">WRONG</div>');
        }
        setTimeout(function(){changeQuestion()},1000);
        }})
        }
  	  function changeQuestion(){
  
  	questionNumber++;
  
  	if(stage=="#game1"){stage2="#game1";stage="#game2";}
  	else{stage2="#game2"; stage="#game1";}
  
  	if(questionNumber < numberOfQuestions){displayQuestion();}
  	else{displayFinalSlide();}
  
  	$(stage2).animate({"right": "+=800px"} , "slow" , function() { $(stage2).css('right' , '-800px'); $(stage2).empty(); });
  	$(stage).animate({"right": "+=800px"},"slow", function() {questionLock=false;});
  }
  function displayFinalSlide(){
  
  	$(stage).append(" <div class='questionText' >You have finished the quiz!<br><br>Total questions: "+numberOfQuestions+"<br>Correct answers: "+score+"</div>");
  	if(numberOfQuestions > score){
  		$(stage).append(" <div class='questionText' >You must get all answers correct in order to continue</div><br /><div> <a href=\"page3.html\"><div class='option'>Try Again</div></a> </div>");
  	}
  	else{
  		$(stage).append(" <div> <a href=\"page4.html\"><div class='option'>Next Page</div></a> </div>");
  	}
  	}
  	
      });