function calcage_2(secs_2, num1_2, num2_2) {
  s_2 = ((Math.floor(secs_2/num1_2))%num2_2).toString();
  if (LeadingZero_2 && s_2.length < 2)
    s_2 = "0" + s_2;
  return "<b>" + s_2 + "</b>";
}
function CountBack_2(secs_2) {
  if (secs_2 < 0) {
    document.getElementById("cntdwn_2").innerHTML = FinishMessage_2;
    return;
  }
  DisplayStr_2 = DisplayFormat_2.replace(/%%D%%/g, calcage_2(secs_2,86400,100000));
  DisplayStr_2 = DisplayStr_2.replace(/%%H%%/g, calcage_2(secs_2,3600,24));
  DisplayStr_2 = DisplayStr_2.replace(/%%M%%/g, calcage_2(secs_2,60,60));
  DisplayStr_2 = DisplayStr_2.replace(/%%S%%/g, calcage_2(secs_2,1,60));

  document.getElementById("cntdwn_2").innerHTML = DisplayStr_2;
  if (CountActive_2)
    setTimeout("CountBack_2(" + (secs_2+CountStepper_2) + ")", SetTimeOutPeriod_2);
}

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

if (typeof(BackColor_2)=="undefined")
  BackColor_2 = "white";
if (typeof(ForeColor_2)=="undefined")
  ForeColor_2= "black";
if (typeof(TargetDate_2)=="undefined")
  TargetDate_2 = "12/31/2020 5:00 AM";
if (typeof(DisplayFormat_2)=="undefined")
  DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
if (typeof(CountActive_2)=="undefined")
  CountActive_2 = true;
if (typeof(FinishMessage_2)=="undefined")
  FinishMessage_2 = "";
if (typeof(CountStepper_2)!="number")
  CountStepper_2 = -1;
if (typeof(LeadingZero_2)=="undefined")
  LeadingZero_2 = true;
  
  CountStepper_2 = Math.ceil(CountStepper_2);
if (CountStepper_2 == 0)
  CountActive_2 = false;
var SetTimeOutPeriod_2 = (Math.abs(CountStepper_2)-1)*1000 + 990;
putspan(BackColor_2, ForeColor_2);
var dthen_2 = new Date(TargetDate_2);
var dnow_2 = new Date();
if(CountStepper_2>0)
  ddiff_2 = new Date(dnow_2-dthen_2);
else
  ddiff_2 = new Date(dthen_2-dnow_2);
gsecs_2 = Math.floor(ddiff_2.valueOf()/1000);
CountBack_2(gsecs_2);

