now_d = 25;
now_m = 07;
now_y = 08;
now_th = 06;
now_tm = 13;
now_ts = 46;
off_y = 08;
off_m = 07;
off_d = 25;
off_th = 23;
off_tm = 59;
off_ts = 59;
dateNow = new Date(parseInt(now_y) + 2000,parseInt(now_m) - 1,now_d,now_th,now_tm,now_ts);
dateFuture = new Date(parseInt(off_y) + 2000,parseInt(off_m) - 1,off_d,off_th,off_tm,off_ts);
amount = dateFuture - dateNow;
amount2 = amount;
function update_time() {
amount = amount2 - 1000;
amount2 = amount;
if(amount < 0) {
set_inner('countdown', 'Expired!');
window.location.reload();
} else {
hrs = 0;
mins = 0;
secs = 0;
amount = Math.floor(amount/1000);
hrs = parseInt(Math.floor(amount/3600));
amount = amount % 3600;
mins = parseInt(Math.floor(amount/60));
// if (hrs < 10) hrs = '0' + hrs;
hsuffix = '';
if (hrs != 1) { hsuffix = 's'; }
// if (mins < 10) mins = '0'+mins;
amount=amount % 60;
secs = parseInt(Math.floor(amount));
// if (secs < 10) secs = '0'+secs;
// set_inner('countdown', '' + hrs + 'h ' + mins + 'm ' + secs + 's');
set_inner('countdown', 'Only ' + hrs + ' hr' + hsuffix + ', ' + mins + ' min, ' + secs + ' sec left!');
}
setTimeout('update_time()', 1000);
}
function set_inner(name, value, add) {
var elem;
if (document.getElementById) elem = document.getElementById(name);
if (document.all) elem = document.all[name];
if (elem && add) elem.innerHTML += value;
if (elem && !add) elem.innerHTML = value;
}
update_time();