function countdown(obj)
{
	this.obj		= obj;
	this.Div		= "clock";
	this.BackColor		= "white";
	this.ForeColor		= "black";
	this.TargetDate		= "12/31/2020 5:00 AM";
	this.DisplayFormat	= "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
	this.CountActive	= true;
	
	this.DisplayStr;

	this.Calcage		= cd_Calcage;
	this.CountBack		= cd_CountBack;
	this.Setup		= cd_Setup;
}

function cd_Calcage(secs, num1, num2, b)
{
  s = ((Math.floor(secs/num1))%num2).toString();
  if (s.length < 2 && b) s = "0" + s;
  return (s);
}
function cd_CountBack(secs)
{
  if(this.Calcage(secs,86400,100000,false)>0) this.DisplayStr = this.DisplayFormat.replace(/%%D%%/g,	this.Calcage(secs,86400,100000,false));else this.DisplayStr = this.DisplayFormat.replace(/%%D%% nap, /g,	'');
  this.DisplayStr = this.DisplayStr.replace(/%%H%%/g,		this.Calcage(secs,3600,24,true));
  this.DisplayStr = this.DisplayStr.replace(/%%M%%/g,		this.Calcage(secs,60,60,true));
  this.DisplayStr = this.DisplayStr.replace(/%%S%%/g,		this.Calcage(secs,1,60,true));

  document.getElementById(this.Div).innerHTML = this.DisplayStr;
  if (this.CountActive) setTimeout(this.obj +".CountBack(" + (secs-1) + ")", 990);
}


