function Timer(div,time){
  this._time = time;
  this._div = div;
  var obj = document.getElementById(div);
  obj.innerHTML = "as";
  obj.style.color = "#FFFFFF";
  obj.style.fontWeight ="bold";
  obj.style.fontFamily = "arial";
  this._obj = obj;
  var now = new Date();
  this._then = new Date();
  this._then.setTime(time);
}
Timer.prototype._div;
Timer.prototype._obj;
Timer.prototype._time;
Timer.prototype._then;
Timer.prototype.Start = function(){
  var self = this;
  setTimeout(function(){self.Start()},1000);
  var now = new Date();
  var diff = this._then.getTime() - now.getTime(); 
  if(diff < 0){
    var Text = "";
    Text += "0<span style=\"font-size: 12px;\"><sub>d</sub></span>";
    Text += "0<span style=\"font-size: 12px;\"><sub>h</sub></span>";
    Text += "0<span style=\"font-size: 12px;\"><sub>m</sub></span>";
    Text += "0<span style=\"font-size: 12px;\"><sub>s</sub></span>";
    this._obj.innerHTML = Text;
    return;  
  }
  var s = 1000;
  var m = s * 60;
  var h = m * 60;
  var d = h * 24;
  var days = Math.floor(diff / d);
  diff -= days * d;
  var hours = Math.floor(diff / h);
  diff -= hours * h;
  var mins = Math.floor(diff / m);
  diff -= mins* m;
  var secs = Math.floor(diff / s);
  var Text = "";
  Text += days + "<span style=\"font-size: 12px;\"><sub>d</sub></span>";
  Text += hours + "<span style=\"font-size: 12px;\"><sub>h</sub></span>";
  Text += mins + "<span style=\"font-size: 12px;\"><sub>m</sub></span>";
  Text += secs + "<span style=\"font-size: 12px;\"><sub>s</sub></span>";
  this._obj.innerHTML = Text;
}

