I want a 30 minute countdown timer. I had insert this timer in 2 places(top & bottom of my website). Both timers have the same code. But only 1 timer works and the other doesn't shows. Why is it so? Is there something wrong with the code?

Can you show a different code that achieves the same results, without any errors.

```js
function countdown() {
    time = parseInt(localStorage.time);

    if (isNaN(time) || time > (30*60)) {
        //alert("An error occured: time left variable is corrupted, resetting timer");
        localStorage.time = 30 * 60;
        countdown();
        return null;
    }

    if (time <= 0) {
        //alert("Your Timer Has Run Out! We Still Got 2 Copies Left, You Could Still Try!");
        return null;
    }

    document.getElementById('timeleft').innerText = formatTime(time);
    time--;
    localStorage.time = time;
    setTimeout('countdown()', 1000);
}

function formatTime(time) {
    minutes = Math.floor(time / 60);
    seconds = time - minutes * 60;

    if (String(seconds).length == 1) {
        return String(minutes) + ":0" + String(seconds);
    }

    return String(minutes) + ":" + String(seconds);
}

countdown();
```

```html
<font size="+26"><div id="timeleft"></div></font>
```