var seconds =0;
var id = null;
$(document).ready(function(){         
        livetime(seconds,id);
});
/*****************Countdown************/
function livetime(seconds, id) {
  orig_seconds = seconds;
  if (seconds < 0) {
        $("#timmer_"+id+"_gio").html('00');
        $("#timmer_"+id+"_phut").html('00');
        $("#timmer_"+id+"_giay").html('00');
  }else{
      hours = 0;
      minutes = 0;
      interval = 1000;
      if (seconds >= 3600) {
        hours = Math.floor(seconds/3600);
        seconds = Math.floor(seconds-(3600*hours));
      }
      if (seconds >= 60) {
        minutes = Math.floor(seconds/60);
        seconds = Math.floor(seconds-(60*minutes));
      }

      el = $("#timmer_"+id);

      if(el){
        if (hours < 10) {
          hours = '0' + hours;
        }
        if (minutes < 10) {
          minutes = '0' + minutes;
        }
        if (seconds < 10) {
          seconds = '0' + seconds;
        }
        $("#timmer_"+id+"_gio").html(hours);
        $("#timmer_"+id+"_phut").html(minutes);
        $("#timmer_"+id+"_giay").html(seconds);
        orig_seconds -= 1;
        window.setTimeout("livetime(" + orig_seconds + ", \""+ id + "\")", interval);
      }
  }
}

