function CountdownTimer(elm, tl, mes){
this.initialize.apply(this, arguments);
}
CountdownTimer.prototype={
initialize: function (elm, tl, mes){
this.elem=document.getElementById(elm);
this.tl=tl;
this.mes=mes;
},
countDown: function (){
var timer='';
var today=new Date();
var day=Math.floor((this.tl - today) / (24 * 60 * 60 * 1000));
var hour=Math.floor(((this.tl - today) % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000));
var min=Math.floor(((this.tl - today) % (24 * 60 * 60 * 1000)) / (60 * 1000)) % 60;
var sec=Math.floor(((this.tl - today) % (24 * 60 * 60 * 1000)) / 1000) % 60 % 60;
var milli=Math.floor(((this.tl - today) % (24 * 60 * 60 * 1000)) / 10) % 100;
var me=this;
if((this.tl - today) > 0){
if(day) timer +='<span class="cdt_num">' + day + '</span><small>日</small>';
if(hour) timer +='<span class="cdt_num">' + hour + '</span><small>時間</small>';
timer +='<span class="cdt_num">' + this.addZero(min) + '</span><small>分</small><span class="cdt_num">' + this.addZero(sec) + '</span><small>秒</small>';
this.elem.innerHTML=timer;
tid=setTimeout(function (){
me.countDown();
}, 10);
}else{
this.elem.innerHTML=this.mes;
return;
}},
addZero: function (num){
return ('0' + num).slice(-2);
}}
function CDT(){
var myD=Date.now();
var start=new Date('2024-04-17T09:00+09:00');
var myS=start.getTime();
var end=new Date('2024-04-17T09:00+09:00');
var myE=end.getTime();
if(myS <=myD&&myE >=myD){
var text='';
var tl=end;
}
else if(myS > myD){
var text='千葉店OPENまで';
var tl=start;
}else{
var text="4月17日（水）";
}
var timer=new CountdownTimer('cdt_date', tl, '千葉店OPENいたしました');
timer.countDown();
target=document.getElementById("cdt_txt");
target.innerHTML=text;
}
window.onload=function (){
CDT();
};