var timers = new Array();

function startTimer(id, secsleft) {
	ed = new Date();
	ed.setTime(ed.getTime() + secsleft);
	timers[id] = ed;
	runTimer(id);
}

function runTimer(id) {
	d=new Date();
	days=0;
	hours=0;
	mins=0;
	secs=0;
	str='';
	endtime = timers[id];
	count=Math.floor(  (endtime.getTime()-d.getTime()) / 1000);
	if(count <= 0) {
		str = '<span class="time">AUKTION HAT BEENDET</span>';
	} else if (count > 0) {
		window.setTimeout('runTimer('+id+')',500);
		secs=count%60;
		count=Math.floor(count/60);
		mins=count%60;
		count=Math.floor(count/60);
		hours=count%24;
		count=Math.floor(count/24);
		days=count;
		str='<span class="time">' + days + '</span> Tage <span class="time">' + hours + '</span> Std. <span class="time">' + mins + '</span> Min. <span class="time">' + secs + '</span> Sec.';
	}
	elname = 'timer'+id;
	if(document.getElementById) {
		document.getElementById(elname).innerHTML = str;
	} else if (document.all) {
		document.all[elname].innerHTML = str;
	}
}