//var count=(0.5 * 60)+1-1; // express in seconds and less than one hour
var count=25;
//
function countdown() {
  if(count>=0){
    var obj = document.getElementById("countdown");
    obj.replaceChild(document.createTextNode(count.toMinutesAndSeconds()), obj.firstChild);
    count--;
    window.setTimeout("countdown()",1000);
  } else {
    window.close();
  }
}
Number.prototype.toMinutesAndSeconds = function() {
// convert numeric seconds input to minutes and seconds string output
  var nn, curTime = new Date(this * 1000);
  return nn=curTime.getMinutes() + ":" +
      (((nn=curTime.getSeconds())<10)?"0"+nn:nn);
}


