function calcage3(secs3, num1b, num2b) {
  s3 = ((Math.floor(secs3/num1b))%num2b).toString();
  if (LeadingZero3 && s3.length < 2)
    s3 = "0" + s3;
  return "<b>" + s3 + "</b>";
}

function CountBack3(secs3) {
  if (secs3 < 0) {
    document.getElementById("cntdwn3").innerHTML = FinishMessage3;
    return;
  }
  DisplayStr3 = DisplayFormat3.replace(/%%D%%/g, calcage3(secs3,86400,100000));
  DisplayStr3 = DisplayStr3.replace(/%%H%%/g, calcage3(secs3,3600,24));
  DisplayStr3 = DisplayStr3.replace(/%%M%%/g, calcage3(secs3,60,60));
  DisplayStr3 = DisplayStr3.replace(/%%S%%/g, calcage3(secs3,1,60));

  document.getElementById("cntdwn3").innerHTML = DisplayStr3;
  if (CountActive3)
    setTimeout("CountBack3(" + (secs3+CountStepper3) + ")", SetTimeOutPeriod3);
}

function putspan(backcolor, forecolor) {
 document.write("<span id='cntdwn3' style='background-color:" + backcolor + 
                "; color:" + forecolor + "'></span>");
}

if (typeof(BackColor3)=="undefined")
  BackColor3 = "white";
if (typeof(ForeColor3)=="undefined")
  ForeColor3= "black";
if (typeof(TargetDate3)=="undefined")
  TargetDate3 = "12/31/2020 5:00 AM";
if (typeof(DisplayFormat3)=="undefined")
  DisplayFormat3 = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
if (typeof(CountActive3)=="undefined")
  CountActive3 = true;
if (typeof(FinishMessage3)=="undefined")
  FinishMessage3 = "";
if (typeof(CountStepper3)!="number")
  CountStepper3 = -1;
if (typeof(LeadingZero3)=="undefined")
  LeadingZero3 = true;


CountStepper3 = Math.ceil(CountStepper3);
if (CountStepper3 == 0)
  CountActive3 = false;
var SetTimeOutPeriod3 = (Math.abs(CountStepper3)-1)*1000 + 990;
putspan(BackColor3, ForeColor3);
var dthen = new Date(TargetDate3);
var dnow = new Date();
if(CountStepper3>0)
  ddiff = new Date(dnow-dthen);
else
  ddiff = new Date(dthen-dnow);
gsecs = Math.floor(ddiff.valueOf()/1000);
CountBack3(gsecs);

