var DisplayFormat = "%%D%% %%H%% %%M%% %%S%%"; //// display format var CountStepper = -1; var CountActive = true; var SetTimeOutPeriod = (Math.abs(CountStepper)-1)*1000 + 990; function calcage(secs, num1, num2) { s = ((Math.floor(secs/num1))%num2).toString(); return s; } function CountBack(secs) { if (secs < 0) { window.location.href='http://www.dianasabrain.com/freecoaching/free.html'; CountActive = false; }; if (calcage(secs,86400,100000)>0) { DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000) + ' Days'); } else { DisplayStr = DisplayFormat.replace(/%%D%%/g, ''); }; if (calcage(secs,3600,24)>0) { DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24) + ' Hours'); } else { DisplayStr = DisplayStr.replace(/%%H%%/g, ''); }; if (calcage(secs,60,60)>0) { DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60) + ' Minutes'); } else { DisplayStr = DisplayStr.replace(/%%M%%/g, ''); }; DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60) + ' Seconds'); if (CountActive) { document.getElementById("cntdwn").innerHTML = "" + DisplayStr + ""; setTimeout("CountBack(" + (secs+CountStepper) + ")", SetTimeOutPeriod); } } CountBack(-333778584);