I'm currently working on a timer. Currently i have it so that a script is stuck in the html to run it. I would like to separate the js into a separate file. Here is what i have so far.

**HTML**

```
 <body>
    <div id="countdown"></div>
    <div id="notifier"></div>
    <script type="text/javascript">
        function startTimer() {
            userInput = document.getElementById('userTime').value;
            if (userInput.length == 0) {
                alert("Please enter a value");
            } else {
                var numericExpression = /^[0-9]+$/;
                if (!userInput.match(numericExpression)) {
                    alert("Please enter a number")
                } else {

                    function display(notifier, str) {
                        document.getElementById(notifier).innerHTML = str;
                    }

                    function toMinuteAndSecond(x) {
                        return Math.floor(x / 60) + ":" + x % 60;
                    }

                    function setTimer(remain, actions) {
                        (function countdown() {
                            display("countdown", toMinuteAndSecond(remain));
                            actions[remain] && actions[remain]();
                            (remain -= 1) >= 0 && setTimeout(arguments.callee, 1000);
                        })();
                    }

                    setTimer(userInput, {
                        10: function() {
                            display("notifier", "Just 10 seconds to go");
                        },
                        5: function() {
                            display("notifier", "5 seconds left");
                        },
                        0: function() {
                            alert("Time is up. Please Sumbit Vote.");
                        }
                    });
                }
            }
        }
    </script>Set Time Limit:
    <input type="text" id="userTime" />
    <input type="button" value="Start" onclick="startTimer()" />
</body>

```

Here is a fiddle
<http://jsfiddle.net/grahamwalsh/0h9t65bs/>