Why is this particular element undefined?
<p>In the javascript code below, I wanted element el to point to a div with the ID "divNavyBox."  Here is the code for divNavyBox:</p>

<pre><code> &lt;div id="divNavyBox" class="box" onmouseover="animated.doAnimation()"&gt;&lt;/div&gt;
</code></pre>

<p>The code below is the javascript used.  Notice that an alert pops up with information about the type of el.</p>

<pre><code>var animated = {
 el : document.getElementById("divNavyBox"),
   doAnimation : function() {
    alert(typeof el);
    if (el.className=="box") {
                alert("2");
                el.className="boxAlt";
    }
    if (el.className=="boxAlt") {
            el.className="box";
    }
  }
};
</code></pre>

<p>Every time the alert pops up, it says that el is undefined.  Why is it undefined when I declare it in the beginning of the code and assign it an element?</p>
