
    var scrtxt = " Centro di Formazione Professionale S. GIOVANNI APOSTOLO " +
                "- Catania - Tremestieri Etneo - Siracusa ";
   
    var lentxt = scrtxt.length;
    var width = 100;
    var pos = 1-width;
    var oggi = new Date();             // data odierna

    // testo scorrevole sulla barra di stato
    function scorrevole() {
        pos++;
        var scroller="";
        if (pos==lentxt) pos=1-width;
        if (pos<0) {
            for (var i=1; i<=Math.abs(pos); i++) scroller += " ";
            scroller += scrtxt.substring(0,width-i+1);
        }
        else 
            scroller += scrtxt.substring(pos,width+pos);

        window.status = scroller;
        setTimeout("scorrevole()",120);
    }

    // Restituisce la parte del giorno in base all'ora
    function setOra() {
        var Wl = "";
        if (oggi.getHours() >= 0 && oggi.getHours() < 6) Wl="Buona notte";
        else if (oggi.getHours() >= 6 && oggi.getHours() <= 12) Wl="Buongiorno";
        else if (oggi.getHours() > 12 && oggi.getHours() < 18 ) Wl="Buon pomeriggio";
        else if (oggi.getHours() >= 18 && oggi.getHours() <22 ) Wl="Buona sera";
        else if (oggi.getHours() >= 22) Wl="Buona notte";    
        return Wl;
    }

    // Mostra la data formattata (hh:mm:ss)
    function showOra() {
        var data = "";
        oggi = new Date();
        data += oggi.getHours()<10? "0"+oggi.getHours()+":" : oggi.getHours()+":";
        data += oggi.getMinutes()<10? "0"+oggi.getMinutes()+":" : oggi.getMinutes()+":";
        data += oggi.getSeconds()<10? "0"+oggi.getSeconds() : oggi.getSeconds();
        document.getElementById("orario").value = data;
        setTimeout("showOra()", 1000);
    }


   // avvia servizi Javascript (avviato da BODY di index.php)
    function init() {
        //scorrevole();
        showOra();
    }
    
