dayName=new Array ("Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato")
monName=new Array ("Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre")
countDay=new Array ("31", "28", "31", "30", "31", "30", "31", "31", "30", "31", "30", "31")
var now= new Date
var year  = now.getYear();
if(year < 2000) {
    year = year + 1900;
}

/* Il seguente blocco di codice serve per far comparire dinamicamete i quadrati vuoti nel calendario
 * e quindi per far visualizzare correttamente i giorni del mese
 */
var int_mese=0;
var mese_tmp = now.getMonth()+1;
if (mese_tmp <10) {
    mese_tmp = "0"+mese_tmp;
}
var date="01/"+mese_tmp+"/"+year;
var mese_vuoto = new Date(date);

int_mese= 0;//mese_vuoto.getDay()+1;

if (mese_tmp ==12) {
    int_mese = 1;
}

if (mese_tmp ==01) {
    int_mese = 4;
}

/*
 * Fine blocco
 **/

/*Questa funzione visualizza la data corrente nel top delle pagine*/
function data_corrente(){

    /*
     * Per estrarre i dati della data:
     * var hour        = now.getHours();
     * var minute      = now.getMinutes();
     * var second      = now.getSeconds();
     * var monthnumber = now.getMonth();
     * var monthday    = now.getDate();
     * var year        = now.getYear();
     *
     */
    if (now.getHours()< 10)
        ore= "0"+now.getHours()
    if (now.getMinutes()<10)
        minuti= "0"+now.getMinutes()
    document.write("<span class='top_dinamico' >\n\
     Oggi è "+ dayName[now.getDay()] + " " +
        now.getDate() + " " +
        monName[now.getMonth()] + " "+ year)
}


/* Questa funzione crea un calendario con eventi*/
function calendario(){

    document.write("<div class='intestazione_blocco2'>"+monName[now.getMonth()] + " "+ year+"</div>");
    document.write("<div id='mese'>");
    document.write("<a href='#nogo' class='giorniRossi'>DO</a>");
    document.write("<a href='#nogo' class='giorni'>LU</a>");
    document.write("<a href='#nogo' class='giorni'>MA</a>");
    document.write("<a href='#nogo' class='giorni'>ME</a>");
    document.write("<a href='#nogo' class='giorni'>GI </a>");
    document.write("<a href='#nogo' class='giorni'>VE</a>");
    document.write("<a href='#nogo' class='giorni'>SA</a>");
   
    // codice per visualizzare gli spazi vuoti
    if (int_mese !=0) {
        for (i=0;i<=int_mese;i++){
            document.write("<a href='#nogo' class='vuoto'></a>");
        }
    }
    // end
    testo_p="Mandaci un tuo evento: un compleanno o una qualsiasi manifestazione";
    testoDayGiugno= new Array ("",
        testo_p, testo_p,
        testo_p, testo_p, testo_p, testo_p, testo_p, testo_p,
        testo_p,testo_p,testo_p,testo_p, testo_p,testo_p,testo_p,
        testo_p,testo_p,testo_p, testo_p,testo_p,
        testo_p,testo_p,testo_p, testo_p,
        testo_p, testo_p, testo_p, testo_p, testo_p, testo_p, testo_p);
    now= new Date;
    giorno =now.getDate();
    classe="";
    testo=testoDayGiugno[now.getDate()];
    for (i=1; i<=countDay[now.getMonth()]; i++){
       
        if (i== giorno)
            classe="testoVerde ";
        else
            classe="";

        if (mese_tmp ==11) {
            // giorni rossi per mese di novembre 2009
            if (i==1 || i==8 || i==15 || i==22  || i==29  ) {
                classe =" testoRosso ";
                if (i == giorno)
                    classe="giorno_festivo_corrente";
            }
        }

        if (mese_tmp ==12) {
            // giorni rossi per mese di dicembre 2009
            if (i==6 || i==13 || i==20  || i==27  ) {
                classe =" testoRosso ";
                if (i == giorno)
                    classe="giorno_festivo_corrente";
            }
        }

        document.write("<a href='#nogo' class="+classe+">"+i+"<span><em>"+i+" "+monName[now.getMonth()] +"</em>"+testoDayGiugno[i]+"</span></a>");
    }
    document.write("<div style='clear:both;'></div>");
    document.write("</div>");
    document.write("<div class='intestazione_blocco2'>Eventi</div>");
    document.write("<p>"+testo+"</p>");
}





function loadImages() {

    if (document.getElementById) {  // DOM3 = IE5, NS6
        document.getElementById('hidepage').style.display = 'none';
    }
    else {
        if (document.layers) {  // Netscape 4
            document.hidepage.display = 'none';
        }
        else {  // IE 4
            document.all.hidepage.style.display = 'none';
        }
    }
}
