title: JavaScript left and right click function
body: <p>This is for an HTML5 canvas game that I am making.  In the game, there is a character that has a gun, he can shoot it and reload it.  I would like the player to use the left mouse button for shooting and the right mouse button for reloading.</p>
  
  <p>What I need is that when ever I click the left mouse button, a variable in my player object(Player1.isLeftClick) becomes true, and when I let go of the button the same variable becomes false.  The same thing should also happen with the right mouse button, but with another variable(Player1.isRightClick).  I also want it to be capable with all the most popular browsers(Chrome, Firefox, Explorer, etc.).  <strong>I must also be in pure JavaScript with no libraries like jQuery!</strong>
  I already achieved this with keyboard events, but I need this with the mouse events.</p>
  
  <p>If it helps, I already have event handlers for keyboard up and down and mouse movement.  These are made in the init function that initializes the game when the images are loaded.</p>
  
  <pre><code>document.addEventListener('mousemove', mousePos, false);
  document.addEventListener('keydown', checkKeyDown, false);
  document.addEventListener('keyup', checkKeyUp, false); 
  </code></pre>
  
  <p>I also have variable called mie that is true if the used browser is Internet Explorer and false for other browsers.</p>