Your whole code can be reduced to this.
/* secsToDHMS()
* Author Gary Green
* http://stackoverflow.com/users/63523/gary-green
*/
function secsToDHMS(s)
{
var x = [86400, 3600, 60, 1],z,i=-1;
while (z=x[++i])
x[i] = ("0" + parseInt(s / z,10)).slice(-2),
s %= z;
return x.join(':');
};
(function() {
var currentDate = new Date();
var endDate = new Date('March 2330, 2012 2218:4210:30'00');
var secsToGo = (new Date(endDate - currentDate)).getTime() / 1000;
var countdownElement = document.getElementById('countdown');
var timer = setInterval(function() {
if (--secsToGo < 0) {
clearInterval(timer);
return;
}
countdownElement.innerHTML = secsToDHMS(secsToGo);
}, 1000);
})();
Fiddle: http://jsfiddle.net/xg63V/3http://jsfiddle.net/xg63V/4
Compressed version 311 bytes
(function(){var d=(new Date(new Date("March 30, 2012 18:10:00")-new Date)).getTime()/1E3,
f=document.getElementById("countdown"),g=setInterval(function(){if(0>--d)clearInterval(g);
else{for(var a=d,b=[86400,3600,60,1],c,e=-1;c=b[++e];)b[e]=("0"+parseInt(a/c,10)).slice(-2),
a%=c;f.innerHTML=b.join(":")}},1E3)})();