<!--
/*      Author:         Robert Hashemian (http://www.hashemian.com/)
        Modified by:    Munsifali Rashid (http://www.munit.co.uk/)
        Modified by:    Peter Strömberg (http://halowiki.net/wiki/User:PEZ) */

function countdown(obj) {
        this.obj                = obj;
        this.Name               = "clock";
        this.TargetDate         = "12/31/2020 5:00 AM UTC+0100";
        this.CountActive        = true; 
        this.Calcage            = cd_Calcage;
        this.CountBack          = cd_CountBack;
        this.Setup              = cd_Setup;
}
function cd_Calcage(secs, num1, num2) {
  s = ((Math.floor(secs/num1))%num2).toString();
  if (s.length < 2) s = "0" + s;
  return (s);
}
function cd_CountBack(secs) {
  try { document.getElementById(this.Name + "_D").innerHTML = this.Calcage(secs,86400,100000); } catch(e) {};
  try { document.getElementById(this.Name + "_H").innerHTML = this.Calcage(secs,3600,24); } catch(e) {};
  try { document.getElementById(this.Name + "_M").innerHTML = this.Calcage(secs,60,60); } catch(e) {};
  try { document.getElementById(this.Name + "_S").innerHTML = this.Calcage(secs,1,60); } catch(e) {};
  if (this.CountActive) setTimeout(this.obj +".CountBack(" + (secs-1) + ")", 990);
}
function cd_Setup() {
        var ddiff       = new Date((new Date(this.TargetDate)) - (new Date()));
        this.CountBack(Math.floor(ddiff.valueOf() / 1000));
}


//-->