var bmo_time = 0;
function bmo_countdown_start(now) {
 bmo_time = now;
 setInterval(bmo_countdown_interval, 1000);
}

function bmo_pad(number) {
 return number < 10 ? '0'+number : ''+number;
}

function bmo_countdown_interval(now) {
 bmo_time -= 1;
 var now  = bmo_time;
 
 if (bmo_time < 0) {
  return;
 }  

 var days  = Math.floor(now / (24 * 60 * 60));
 now %= (24 * 60 * 60);

 var hours = Math.floor(now /  (60 * 60));
 now %= (60 * 60);

 var minutes = bmo_pad(Math.floor(now /  60));
 var seconds = bmo_pad(now % 60);

 document.getElementById('countdown_days').innerHTML    = days;
 document.getElementById('countdown_hours').innerHTML   = hours;
 document.getElementById('countdown_minutes').innerHTML = minutes;
 document.getElementById('countdown_seconds').innerHTML = seconds;

}
