Why on earth won't my JS program run?
<p>I posted a similar question earlier, but it was deleted because I felt I did a poor job in describing what my problem is.</p>

<p>Please see my current program here:</p>

<p><a href="http://rich2233.comoj.com/" rel="nofollow">http://rich2233.comoj.com/</a></p>

<p>My jfiddle:
<a href="http://jsfiddle.net/rich2233/JGvAD/" rel="nofollow">http://jsfiddle.net/rich2233/JGvAD/</a></p>

<p>I'm trying to emulate this game: <a href="http://javascript.internet.com/games/concentration.html" rel="nofollow">http://javascript.internet.com/games/concentration.html</a></p>

<p>My version will not use images, it will instead use simple numbers.  It will alert the user how many tries it took them to match everything once the game has concluded.  It will also not keep track of time.</p>

<p>I think I have everything right with my code in terms of logic, however it doesn't run.  I'm new to JS and my debugging skills are limited, however I can't seem to find any syntax errors.  Could anyone help get this program working?  It would be greatly appreciated.</p>

<pre><code>var attempts = 0;
var firstClick;             
var secondClick;
var numFoundPairs = 0;         
var click = true;

function display(id)
{
  attempts++;
  if (click == false)
  return;
  var num = parseInt(id);
  if (firstClick == null)
  {
  firstClick = num; 
  document.getElementById(id).value = a[num];
  return;
  }
  if (secondClick == null)
  secondClick = num;

 if (firstClick == secondClick)
 {  
 secondClick = null;
 return;
 }

 document.getElementById(boxNum).value = a[num];
 if (document.getElementById(firstClick).value != 
 document.getElementById(secondClick).value )
  {
  click = false;
  setTimeout ('hide(' + secondClick + ')', 3000);
  setTimeout ('hide(' + firstClick  + ')', 3000);
 }
 else
 {
 /* Show the identical blocks */
 firstClick = null;
 secondClick = null;
 }
 /* If the player found the eight pairs (since 16/2 = 8) */
 if (numFoundPairs == 8)
 {
  /* Let them know how many attempts it took them */
   alert ("You took " + Math.floor(String(attempts)/2) + " attempts.");  
  }
}
/* Function to hide the particular id */
function hide (id)
{
document.getElementById(id).value = "     ";
click = true;
}

/* Create the array of number and distribute them randomly on the grid */
function create()
{
a = new Array (1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 
             6, 6, 7, 7, 8, 8);
for (var i = 0; i &lt; a.length; i++)
{
var idx = Math.floor (Math.random() * a.length);
var tmp = a[i];
a[i] = a[idx];
a[idx] = tmp;
}
}
</code></pre>
