function calcage(secs, num1, num2) { s = ((Math.floor(secs/num1))%num2).toString(); if (LeadingZero && s.length < 2) s = "0" + s; return "" + s + ""; } function CountBack(secs,TagId,CountActive,CountStepper,SetTimeOutPeriod,aukcio_id) { if (secs < 0) { document.getElementById(TagId).innerHTML = FinishMessage; return; } var DisplayStr = ""; var nap = Math.floor(secs/(24*60*60)); var maradek_mp = secs%(24*60*60); var ora = Math.floor(maradek_mp/(60*60)); if (nap != 0) { DisplayStr = nap+' nap
'; } if (ora != 0 && nap == 0) { DisplayStr = ora+' óra
'; } if (nap==0 && ora==0) { DisplayStr = DisplayFormat.replace(/%%D%%/g, calcage(secs,86400,100000)); DisplayStr = DisplayStr.replace(/%%H%%/g, calcage(secs,3600,24)); DisplayStr = DisplayStr.replace(/%%M%%/g, calcage(secs,60,60)); DisplayStr = DisplayStr.replace(/%%S%%/g, calcage(secs,1,60)); } try { document.getElementById(TagId).innerHTML = DisplayStr; } catch (err) { } if (CountActive) { var ret = setTimeout("CountBack(" + (secs+CountStepper) + ",'"+TagId+"',"+CountActive+","+CountStepper+","+SetTimeOutPeriod+","+aukcio_id+")", SetTimeOutPeriod); eval('window.counter_' + aukcio_id + ' = ' + ret); } } function showCountDown(TagId,TargetDate,NowDate,aukcio_id) { if (typeof(DisplayFormat)=="undefined") DisplayFormat = "%%M%%:%%S%% perc
"; if (typeof(CountActive)=="undefined") CountActive = true; if (typeof(FinishMessage)=="undefined") FinishMessage = "00:00 perc
"; if (typeof(CountStepper)!="number") CountStepper = -1; if (typeof(LeadingZero)=="undefined") LeadingZero = true; CountStepper = Math.ceil(CountStepper); if (CountStepper == 0) CountActive = false; var SetTimeOutPeriod = (Math.abs(CountStepper)-1)*1000 + 990; var dthen = new Date(TargetDate.substr(0,4),TargetDate.substr(5,2)-1,TargetDate.substr(8,2),TargetDate.substr(11,2),TargetDate.substr(14,2),TargetDate.substr(17,2),0); var dnow = new Date(NowDate.substr(0,4),NowDate.substr(5,2)-1,NowDate.substr(8,2),NowDate.substr(11,2),NowDate.substr(14,2),NowDate.substr(17,2),0); if(CountStepper>0) var ddiff = dnow.getTime()-dthen.getTime(); else var ddiff = dthen.getTime()-dnow.getTime(); var gsecs = Math.floor(ddiff/1000); CountBack(gsecs,TagId,CountActive,CountStepper,SetTimeOutPeriod,aukcio_id); }