JavaScript function doesn't return correct value
<p>I'm developing a function in which I'd like to check which useragent is currently being used.<br>
The following code is just a prototype and it returns whatever value it reads first - in this case <code>IE</code>.</p>

<pre><code>detectDevice = function () {
    var userAgent = {
        detect: function () {
            return navigator.userAgent;
        },
        detectBrowser: function () {
            var browser = userAgent.detect();
            var currentBrowser;
            return currentBrowser = browser.indexOf('IE') ? "Internet Explore" : browser.indexOf('Mozilla') ? "FireFox" : "UserAgent not recognized!";
        },
        version: function (identifier) {
        }
    };

    alert(userAgent.detectBrowser());
}
</code></pre>

<p>I can't tell what's wrong. Maybe you guys can see it and tell me where I made a wrong turn.</p>
