Prova.

Codice PHP:
<!DOCTYPE html>
<
html>
<
head>

<
style>
.
chiuso {
    
width200px;
    
height200px;
    
background-colorred;
}

.
aperto {
    
width200px;
    
height200px;
    
background-colorgreen;
}

</
style>

<
script language="javascript" type="text/javascript">
<!--

rangeChiuso = new Array("0000-0559","1200-1359","1900-2359");

function 
isClosed(haRange) {

    
sLL aRange.substr(0,4);
    
sUL aRange.substr(5,4);
    
aLL parseInt(sLL);
    
aUL parseInt(sUL);
    
//alert(aLL + " " + aUL);
    
if (aLL <= && <= aUL) {
        return 
true;
    } else {
        return 
false;
    }
}

function 
pippo(){
    
    var 
data=new Date();
    var 
data.getHours() * 100 data.getMinutes();

    
max rangeChiuso.length 1;
    
chiuso false;
    for (
i=0;i<=max;i++) {
        
        if (
isClosed(h,rangeChiuso[i])) {
            
chiuso true;
            
max 10;
        }
    }

    if (
chiuso) {            
        
document.getElementById("centro").className "chiuso";
        
document.getElementById("centro").innerText 'chiuso';
    } else {
        
document.getElementById('centro').className 'aperto';
        
document.getElementById('centro').innerText 'aperto';
    }
}

//-->
</script>
</head>

<body>

<div id="centro" class="centro1" >ciao ti vedo</div>


<script language="javascript" type="text/javascript">
    setInterval("pippo()",1000);
    // pippo();
</script>

</body>
</html>