function AggOra() {
var mesi = new Array("Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre");
var nomeGiorno = new Array('Domenica','Lunedì','Martedì','Mercoledì','Giovedì','Venerdì','Sabato');
Data = new Date()
Giorno = Data.getDate()
Mese = Data.getMonth()
Anno = Data.getFullYear() 
Ore = Data.getHours()
Minuti = Data.getMinutes()
Secondi = Data.getSeconds()
if ((Ore >= 5) && (Ore <= 12)) Saluto = "Buon Giorno"
if ((Ore >= 13) && (Ore <= 18)) Saluto = "Buon Pomeriggio"
if ((Ore >= 19) && (Ore <= 22)) Saluto = "Buona Sera"
if (Ore >= 23) Saluto = "Buona Notte"
if (Ore <= 4) Saluto = "Buona Notte"
if (Minuti < 10) Minuti = "0" + Minuti
if (Secondi < 10) Secondi = "0" + Secondi
if (Giorno == 1) Giorno = Giorno + "°"
messaggio = Saluto + "! ore " + Ore + ":" + Minuti + "." + Secondi + " di " + nomeGiorno[Data.getDay()] + " " + Giorno + " " + mesi[Mese] + " " + Anno
if(!document.layers){
  aggsec = setTimeout("AggOra();",1000);}
if (document.getElementById){
    document.getElementById('clock').innerHTML=messaggio;}
else if (document.all){ 
    document.all.clock.innerHTML=messaggio;}
else if(document.layers){
    document.write(messaggio);}
}
AggOra();
