Global variable in Javascript back to it's first value
<p>I'm trying to make a function that get two parameters and do different stuff according to which step it's on.</p>

<p>So it's like a short quest with four steps. </p>

<pre><code>var  stp=1;
var vocabulary= new Array();
vocabulary['greatings']= ['привет','здорово','здравствуй'];
vocabulary['grQuestions']= ['как дела','что нового','как здоровье','как поживаешь'];
vocabulary['qrAnswers']= ['нормально как сам','спасибо хорошо','потихоньку','отлично'];

function myMission(stp,str) {
  switch (stp) {
  case 1:
    {
      if (jQuery.inArray(str, vocabulary['greatings'])!==-1) {
        stp+=1;
        $('.stp').html(stp);
        $('.answer').html('Привет!');
      } else {
        $('.stp').html(stp);
        $('.answer').html('Не понимаю');
      }
    }
    break;
  case 2:
    alert("23");
    break;
  case 3:
    alert("24");
    break;
}
}
$(document).ready(function() {
  $('#checker').click(function() {
    var str = $('.yourVoice').val();
    myMission(stp,str);
  });
});
</code></pre>

<p>The problem is that <code>stp</code> always back to <code>1</code>
how can I fix it?</p>
