Creating a "fake AI" chat program
<p>Hey everyone, I've been creating a little chat bot (for fun and practice).</p>

<p>I have the following function which isn't working correctly (<a href="http://jsfiddle.net/hNUej/" rel="nofollow">FULL CODE HERE</a>):</p>

<pre><code>function runAI() {
            if (i.val().length &gt; 0) { 
                if ($.inArray(i.val(), helloInputArray)) {
                    r = Math.floor(Math.random()*4);                        
                    o.html(o.html()+helloOutputArray[r]);
                    i.val('');
                    i.focus();
                } else if ($.inArray(i.val(), byeInputArray)) {
                    r = Math.floor(Math.random()*4);                        
                    o.html(o.html()+byeOutputArray[r]);
                    i.val('');
                    i.focus();
                } else {
                    o.html(o.html()+"I don't know what that means...&lt;br /&gt;");
                    i.val('');
                    i.focus();
                }
            }
        }
</code></pre>

<p>It always seems to return the <code>helloOutputArray</code>...</p>
