title: javascript - declaration of local variable
body: <p>i am using the following javascript code.. i've declared local variables before the starting of all the functions but functions donot execute when called.. but when i replace all of the variables in the function with their content only then it works... what could i be doing wrong.. my code is as follows...</p>
  
  <pre><code>/* variables */
      var dmv = document.getElementById("dmv").style;
      var nomv = document.getElementById("nomv").style;
      var frsv = document.getElementById("frsv").style;
  /* end of variables */
  
  function messagesClick() {
      document.getElementById("notifications").style.visibility = 'visible';
      if (dmv.visibility == 'hidden') {
          dmv.visibility = 'visible';
          nomv.visibility = 'hidden';
          frsv.visibility = 'hidden';
      }else{
              dmv.visibility = 'hidden';
      }
  }
  
  function notificationsClick() {
      document.getElementById("notifications").style.visibility = 'visible';
      if (nomv.visibility == 'hidden') {
          nomv.visibility = 'visible';
          dmv.visibility = 'hidden';
          frsv.visibility = 'hidden';
      }else{
              nomv.visibility = 'hidden';
      }
  }
  
  function friendRequestClick() {
      document.getElementById("notifications").style.visibility = 'visible';
      if (frsv.visibility == 'hidden') {
          frsv.visibility = 'visible';
          dmv.visibility = 'hidden';
          nomv.visibility = 'hidden';
      }else{
              frsv.visibility = 'hidden';
      }
  }
  </code></pre>
  
  <p>any help would be appreciated.. thanks in advance.. :)</p>