function calcage_3(secs_3, num1_3, num2_3) {
  s_3 = ((Math.floor(secs_3/num1_3))%num2_3).toString();
  if (LeadingZero_3 && s_3.length < 2)
    s_3 = "0" + s_3;
  return "<b>" + s_3 + "</b>";
}
function CountBack_3(secs_3) {
  if (secs_3 < 0) {
    document.getElementById("cntdwn_3").innerHTML = FinishMessage_3;
    return;
  }
  DisplayStr_3 = DisplayFormat_3.replace(/%%D%%/g, calcage_3(secs_3,86400,100000));
  DisplayStr_3 = DisplayStr_3.replace(/%%H%%/g, calcage_3(secs_3,3600,24));
  DisplayStr_3 = DisplayStr_3.replace(/%%M%%/g, calcage_3(secs_3,60,60));
  DisplayStr_3 = DisplayStr_3.replace(/%%S%%/g, calcage_3(secs_3,1,60));

  document.getElementById("cntdwn_3").innerHTML = DisplayStr_3;
  if (CountActive_3)
    setTimeout("CountBack_3(" + (secs_3+CountStepper_3) + ")", SetTimeOutPeriod_3);
}

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

if (typeof(BackColor_3)=="undefined")
  BackColor_3 = "white";
if (typeof(ForeColor_3)=="undefined")
  ForeColor_3= "black";
if (typeof(TargetDate_3)=="undefined")
  TargetDate_3 = "12/31/2020 5:00 AM";
if (typeof(DisplayFormat_3)=="undefined")
  DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
if (typeof(CountActive_3)=="undefined")
  CountActive_3 = true;
if (typeof(FinishMessage_3)=="undefined")
  FinishMessage_3 = "";
if (typeof(CountStepper_3)!="number")
  CountStepper_3 = -1;
if (typeof(LeadingZero_3)=="undefined")
  LeadingZero_3 = true;
  
  CountStepper_3 = Math.ceil(CountStepper_3);
if (CountStepper_3 == 0)
  CountActive_3 = false;
var SetTimeOutPeriod_3 = (Math.abs(CountStepper_3)-1)*1000 + 990;
putspan(BackColor_3, ForeColor_3);
var dthen_3 = new Date(TargetDate_3);
var dnow_3 = new Date();
if(CountStepper_3>0)
  ddiff_3 = new Date(dnow_3-dthen_3);
else
  ddiff_3 = new Date(dthen_3-dnow_3);
gsecs_3 = Math.floor(ddiff_3.valueOf()/1000);
CountBack_3(gsecs_3);

