/* Author: Robert Hashemian, modified by Cosmin Cioranu [cauta pe FB(i)] http://www.hashemian.com/ You can use this code in any manner so long as the author's name, Web address and this disclaimer is kept intact. */ //TargetDate = "12/31/2020 5:00 AM"; var TargetDate255 = "3/23/2018 18:00"; var SourceDate255 = "02/19/2018 23:38:21"; //var BackColor255; //var ForeColor255; var DisplayFormat255; var FinishMessage255; var LeadingZero255; //if(!BackColor255) BackColor255 = "palegreen"; //if (BackColor) BackColor255=BackColor; //if(!ForeColor255) ForeColor255 = "navy"; //if (ForeColor) ForeColor255=ForeColor; CountActive255 = true; CountStepper255 = -1; LeadingZero255 = true; if(!DisplayFormat255) DisplayFormat255 = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds."; if (DisplayFormat) DisplayFormat255=DisplayFormat; if(!FinishMessage255) FinishMessage255 = "Closed!"; if (FinishMessage) FinishMessage255=FinishMessage; function calcage255(secs, num1, num2) { s = ((Math.floor(secs/num1))%num2).toString(); if (LeadingZero255 && s.length < 2) s = "0" + s; return "" + s + ""; } function CountBack255(secs) { if (secs < 0) { document.getElementById("cntdwn255").innerHTML = FinishMessage; return; } DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage255(secs,86400,100000)); DisplayStr = DisplayStr.replace(/%%H%%/g, calcage255(secs,3600,24)); DisplayStr = DisplayStr.replace(/%%M%%/g, calcage255(secs,60,60)); DisplayStr = DisplayStr.replace(/%%S%%/g, calcage255(secs,1,60)); document.getElementById("cntdwn255").innerHTML = DisplayStr; if (CountActive255) setTimeout("CountBack255(" + (secs+CountStepper255) + ")", SetTimeOutPeriod255); } function putspan255() { document.write(""); } //if (typeof(BackColor255)=="undefined") // BackColor255 = "white"; //if (typeof(ForeColor255)=="undefined") // ForeColor255= "black"; if (typeof(TargetDate255)=="undefined") TargetDate255 = "12/31/2020 5:00 AM"; if (typeof(DisplayFormat255)=="undefined") DisplayFormat255 = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds."; if (typeof(CountActive255)=="undefined") CountActive255 = true; if (typeof(FinishMessage255)=="undefined") FinishMessage255 = ""; if (typeof(CountStepper255)!="number") CountStepper255 = -1; if (typeof(LeadingZero255)=="undefined") LeadingZero255 = true; CountStepper255 = Math.ceil(CountStepper255); if (CountStepper255 == 0) CountActive255 = false; var SetTimeOutPeriod255 = (Math.abs(CountStepper255)-1)*1000 + 990; //putspan255(BackColor255, ForeColor255); putspan255(); var dthen255 = new Date(TargetDate255); var dnow255 = new Date(SourceDate255); if(CountStepper255>0) ddiff255 = new Date(dnow255-dthen255); else ddiff255 = new Date(dthen255-dnow255); gsecs255 = Math.floor(ddiff255.valueOf()/1000); CountBack255(gsecs255);