Kod
<script language="javascript">
v=new Date(); function t(){
n=new Date(); ss='.$refresh.'; s=ss-Math.round((n.getTime()-v.getTime())/1000); m=0;h=0;
if(s <= 0){ document.location.href="buildings.php";}
else{
document.getElementById("bxx").innerHTML=pretty_time(s);
document.getElementById("dxx").style.width=100-Math.round(s/'.$time.'*100)+"%";}
window.setTimeout("t();",1000);}
window.onload=t;
</script>
v=new Date(); function t(){
n=new Date(); ss='.$refresh.'; s=ss-Math.round((n.getTime()-v.getTime())/1000); m=0;h=0;
if(s <= 0){ document.location.href="buildings.php";}
else{
document.getElementById("bxx").innerHTML=pretty_time(s);
document.getElementById("dxx").style.width=100-Math.round(s/'.$time.'*100)+"%";}
window.setTimeout("t();",1000);}
window.onload=t;
</script>
Z góry dzięki za pomoc