function timer_revers( d, h, m, s ){
today = new Date();
finish = d*24*60*60*1000 + h*60*60*1000 + m*60*1000 + s*1000
endTS = today.getTime() + finish;
rev_intervalid = setInterval(function(){
now = new Date();
totalRemains = (endTS - now.getTime());
if (totalRemains>1){
RemainsSec=(parseInt(totalRemains/1000));
RemainsFullDays=(parseInt(RemainsSec/(24*60*60)));
secInLastDay=RemainsSec-RemainsFullDays*24*3600;
RemainsFullHours=(parseInt(secInLastDay/3600));
if (RemainsFullHours<10){RemainsFullHours="0"+RemainsFullHours};
secInLastHour=secInLastDay-RemainsFullHours*3600;
RemainsMinutes=(parseInt(secInLastHour/60));
if (RemainsMinutes<10){RemainsMinutes="0"+RemainsMinutes};
lastSec=secInLastHour-RemainsMinutes*60;
if (lastSec<10){lastSec="0"+lastSec};
$('#new_timer').html( (RemainsFullDays ? "<span>"+RemainsFullDays+"дн.</span> " :"")+RemainsFullHours+"ч. "+RemainsMinutes+"м. "+lastSec+"с.");
} else {
clearInterval(rev_intervalid);
}
},1000);
}
$(function(){
timer_revers(0,1,2,3);
})