isIE = ((/MSIE/i).test(navigator.appVersion));
function addEvent(el, event, fn) {if (isIE) el.attachEvent('on'+event,fn); else el.addEventListener(event,fn,false);}
addEvent (window, 'load', init);
// ============================
function init() {
	img_arr = Array();
	for (i=0; i<10; i++) {
		img_arr[i] = new Image();
		img_arr[i].src = 'counter/'+i+'.png';
	}	
	countdown();
}

function bpTime(number) {
	s1 = number.toString();
	if (s1.length == 1) s1 = '0' + s1;
	rslt = '';
	for (j=0; j<s1.length; j++) {
		rslt = rslt + '<img src="counter/' + s1.charAt(j) + '.png" alt="'+ s1.charAt(j) +'" />';
	}
	return rslt;
}

function countdown() {
	time_server.setSeconds(time_server.getSeconds()+1);
	time_wait = time_action - time_server;
	tx = document.getElementById('tablo');
	if (time_wait < 0) {
		tx.innerHTML = "HERE";
		return;
	}
	tmp1 = time_wait % 86400000;
	tmp2 = tmp1 % 3600000;
	var dday  = Math.floor(time_wait / 86400000);
	var dhour = Math.floor(tmp1 / 3600000);
	var dmin  = Math.floor(tmp2 / 60000);
	var dsec  = Math.floor((tmp2 % 60000) / 1000);
		tx.innerHTML =
		bpTime(dday) + ' : '+ 
		bpTime(dhour) + ' : '+ 
		bpTime(dmin) + ' : '+ 
		bpTime(dsec) + '';
	setTimeout('countdown()', 1000);
}