function loadcss(url) { var head = document.getElementsByTagName('head')[0], link = document.createElement('link'); link.type = 'text/css'; link.rel = 'stylesheet'; link.href = url; head.appendChild(link); return link; }
function pad(number, length) {
var str = '' + number;
while (str.length < length) { str = '0' + str; } return str; } $(document).ready(function(){ var day='0'; var hour='1'; var min='1'; var sec='1'; var redirect_url = ''; var evergreen_timer = 'true'; var cd_redirect = 'false'; $("#sec_1").html(pad(sec,2)); $("#min_1").html(pad(min,2)); $("#hour_1").html(pad(hour,2)); $("#day_1").html(pad(day,2)); var interval=setInterval(function(){ if(day <= 0 && hour <= 0 && min <= 0 && sec <= 0) { $("#sec_1").html('00'); $("#min_1").html('00'); $("#hour_1").html('00'); $("#day_1").html('00'); clearInterval(interval); if(cd_redirect=='true') { window.location = redirect_url; }else if(evergreen_timer=='true') { window.location.reload(); } } else { --sec; if(sec<0) { min=--min; sec=59; } if(min < 0) { hour=--hour; min=59; } if(hour < 0) { day=--day; if(day>0) { sec=59;
min=59;
hour=23;
}else { clearInterval(interval);
$("#timer_1").html("Ended");
}
}
$("#sec_1").html(pad(sec,2));
$("#min_1").html(pad(min,2));
$("#hour_1").html(pad(hour,2));
$("#day_1").html(pad(day,2));
}
},1000);
});