///////////////////////////////////////////////////////////
// "Live Clock" script - Version 2.6
// By Mark Plachetta (astroboy@zip.com.au)
//
// Get the latest version from:
// http://www.zip.com.au/~astroboy/liveclock/
//
// Based on the original script: "Upper Corner Live Clock"
// available at:
// - Dynamic Drive (http://www.dynamicdrive.com)
// - Website Abstraction (http://www.wsabstract.com)
// ========================================================
// CHANGES TO ORIGINAL SCRIPT:
// - Gave more flexibility in positioning of clock
// - Added date construct
// - User configurable
// ========================================================
// This script is available free of charge, see the website
// for more information. Please check the website before
// e-mailing for help.
// ========================================================
// Adattato e tradotto in italiano da Seatiger Team™
// A Sbafo! Tutto per il web gratis e in italiano....
// http://www.asbafo.net
// Liberamente utilizzabile, ma lascia intatte queste righe
///////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////
/////////////// CONFIGURATION /////////////////////////////

        // Qui sotto puoi impostare il tipo di carattere da usare per l'orologio:
        var LC_Font_Face = "Arial";

        // Qui sotto puoi impostare la dimensione del carattere in punti:
        var LC_Font_Size = "9";

        // Qui sotto puoi impostare il colore del carattere in formato esadecimale
        // preceduto dal simbolo della celletta #:
        var LC_Font_Color = "#6699FF";

        // Qui sotto puoi impostare il colore di sfondo dell'orologio in formato
        // esadecimale preceduto dal simbolo della celletta #:
        var LC_Back_Color = " ";

        // Qui sotto puoi impostare un breve messaggio che precederà l'orologio:
        var LC_OpenTags = "Sono le ";

        // Qui sotto puoi impostare un breve messaggio che seguirà l'orologio:
        var LC_CloseTags = "";

        // Qui sotto puoi impostare la larghezza del display in pixels:
        var LC_Width = 300;

        // Qui sotto puoi decidere se l'orologio debba mostrare le 24 o le 12 ore:
        // 0 = 24, 1 = 12
        var LC_12_Hour = 0;

        // Qui sotto puoi settare ogni quanto tempo l'orologio debba aggiornarsi:
        // 0 = Mai, 1 = Ogni secondo, 2 = Ogni minuto
        // Se scegli 0 o 2, non appariranno i secondi.
        var LC_Update = 1;

        // Qui sotto puoi decidere il formato del calendario:
        // 0 = Nessun calendario, 1 = gg/mm/aa, 2 = mm/gg/aa, 3 = GGGG MMMM,
        // 4 = GGGG MMMM AAAA
        var LC_DisplayDate = 4;

        // Qui sotto puoi decidere se il nome del giorno e del mese debbano essere abbreviati:
        // 0 = No, 1 = Si;
        var LC_Abbrev = 0;

        // Qui sotto puoi impostare come debba apparire l'ora
        // rispetto al meridiano di Greenwich.
        // Per far sì che venga visualizzata l'ora di chi guarda il sito
        // imposta il valore su " "
        var LC_GMT = "";
        // Per impostare l'ora di un meridiano diverso da quello di
        // Greenwich imposta un valore numerico che coincida con le
        // ore di differenza. Per il meridiano di Roma, ad esempio
        // imposta il valore numerico 1.

/////////////// DA QUI IN AVANTI NON TOCCARE PIU' NULLA /////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Globals:
        var LC_HTML; var LC_AMPM;

// The following arrays contain data which is used in the
// clock's date function.
        var LC_DaysOfWeek = new Array(7);
                LC_DaysOfWeek[0] = (LC_Abbrev) ? "Sun" : "domenica";
                LC_DaysOfWeek[1] = (LC_Abbrev) ? "Mon" : "lunedì";
                LC_DaysOfWeek[2] = (LC_Abbrev) ? "Tue" : "martedì";
                LC_DaysOfWeek[3] = (LC_Abbrev) ? "Wed" : "mercoledì";
                LC_DaysOfWeek[4] = (LC_Abbrev) ? "Thu" : "giovedì";
                LC_DaysOfWeek[5] = (LC_Abbrev) ? "Fri" : "venerdì";
                LC_DaysOfWeek[6] = (LC_Abbrev) ? "Sat" : "sabato";

        var LC_MonthsOfYear = new Array(12);
                LC_MonthsOfYear[0] = (LC_Abbrev) ? "Jan" : "Gennaio";
                LC_MonthsOfYear[1] = (LC_Abbrev) ? "Feb" : "Febbraio";
                LC_MonthsOfYear[2] = (LC_Abbrev) ? "Mar" : "Marzo";
                LC_MonthsOfYear[3] = (LC_Abbrev) ? "Apr" : "Aprile";
                LC_MonthsOfYear[4] = (LC_Abbrev) ? "May" : "Maggio";
                LC_MonthsOfYear[5] = (LC_Abbrev) ? "Jun" : "Giugno";
                LC_MonthsOfYear[6] = (LC_Abbrev) ? "Jul" : "Luglio";
                LC_MonthsOfYear[7] = (LC_Abbrev) ? "Aug" : "Agosto";
                LC_MonthsOfYear[8] = (LC_Abbrev) ? "Sep" : "Settembre";
                LC_MonthsOfYear[9] = (LC_Abbrev) ? "Oct" : "Ottobre";
                LC_MonthsOfYear[10] = (LC_Abbrev) ? "Nov" : "Novembre";
                LC_MonthsOfYear[11] = (LC_Abbrev) ? "Dec" : "Dicembre";

// This array controls how often the clock is updated,
// based on your selection in the configuration.
        var LC_ClockUpdate = new Array(3);
                LC_ClockUpdate[0] = 0;
                LC_ClockUpdate[1] = 1000;
                LC_ClockUpdate[2] = 60000;

// Basic browser detection:
        var LC_IE = (document.all) ? 1 : 0;
        var LC_NS = (document.layers) ? 1 : 0;
        var LC_N6 = (window.sidebar) ? 1 : 0;
        var LC_Old = (!LC_IE && !LC_NS && !LC_N6) ? 1 : 0;

// For Version 4+ browsers, write the appropriate HTML to the
// page for the clock, otherwise, attempt to write a static
// date to the page.
        var LC_StartTags = (LC_NS) ? '<table cellpadding="0" cellspacing="0" border="0" width="'+LC_Width+'"><tr><td>' : '';
        if (LC_IE || LC_N6) { LC_ClockTags = '<div id="LiveClockIE" style="width:'+LC_Width+'px; background-color:'+LC_Back_Color+'"></div>'; }
        else if (LC_NS) { LC_ClockTags = '<ilayer width="'+LC_Width+'" bgColor="'+LC_Back_Color+'" id="ClockPosNS"><layer id="LiveClockNS"></layer></ilayer>'; }
        var LC_EndTags = (LC_NS) ? '</td></tr></table>' : '';

        if (!LC_Old) { document.write(LC_StartTags+LC_ClockTags+LC_EndTags); }
        else { show_clock(); }

        onload = init;
        function init() {
                if (!LC_Old) { show_clock(); }
// If you have any other scripts which use the "onload" event,
// call them here:

        }

// The main part of the script:
        function show_clock() {

        // Get all our date variables:
                var time = new Date();
        if (LC_GMT) {
                var offset = time.getTimezoneOffset();
                        if (parseInt(navigator.appVersion) == 4 && LC_NS) { offset += 60; }
                        if (navigator.appVersion.indexOf('MSIE 3') != -1) { offset = offset * (-1); }
                        time.setTime(time.getTime() + offset*60000);
                        time.setTime(time.getTime() + LC_GMT*3600000);
        }
                var day = time.getDay();
                var mday = time.getDate();
                var month = time.getMonth();
                var hours = time.getHours();
                var minutes = time.getMinutes();
                var seconds = time.getSeconds();
                var year = time.getYear();

        // Fix the "year" variable for Y2K:
                if (year < 1900) { year += 1900; }


        // Set up the hours for either 24 or 12 hour display:
                if (LC_12_Hour) {
                        LC_AMPM = "AM";
                        if (hours >= 12) { LC_AMPM = "PM"; hours -= 12; }
                        if (hours == 0) { hours = 12; }
                }
                if (minutes <= 9) { minutes = "0"+minutes; }
                if (seconds <= 9) { seconds = "0"+seconds; }

        // This is the actual HTML of the clock. If you're going to play around
        // with this, be careful to keep all your quotations in tact.
                LC_HTML = '<font style="color:'+LC_Font_Color+'; font-family:'+LC_Font_Face+'; font-size:'+LC_Font_Size+'pt;">';
                LC_HTML += LC_OpenTags;
                LC_HTML += hours+':'+minutes;
                if (LC_Update == 1) { LC_HTML += ':'+seconds; }
                if (LC_12_Hour) { LC_HTML += ' '+LC_AMPM; }
                if (LC_DisplayDate == 1) { LC_HTML += ' di '+mday+'/'+(month+1)+'/'+year; }
                if (LC_DisplayDate == 2) { LC_HTML += ' of '+(month+1)+'/'+mday+'/'+year; }
                if (LC_DisplayDate >= 3) { LC_HTML += ' di '+LC_DaysOfWeek[day]+'  '+mday+' '+LC_MonthsOfYear[month]; }
                if (LC_DisplayDate >= 4) { LC_HTML += ' '+year; }
                LC_HTML += LC_CloseTags;
                LC_HTML += '</font>';

                if (LC_Old) {
                        document.write(LC_HTML);
                        return;
                }

        // Write the clock to the layer:
                if (LC_NS) {
                        clockpos = document.layers["ClockPosNS"];
                        liveclock = clockpos.document.layers["LiveClockNS"];
                        liveclock.document.write(LC_HTML);
                        liveclock.document.close();
                } else if (LC_IE) {
                        LiveClockIE.innerHTML = LC_HTML;
                } else if (LC_N6) {
                        document.getElementById("LiveClockIE").innerHTML = LC_HTML;
                }

        if (LC_Update != 0) { setTimeout("show_clock()",LC_ClockUpdate[LC_Update]); }
}