// melon.js
// copyright e.tel. elettronica e telecomunicazioni 
// di ezio reisenhofer - trieste 
// tutti i diritti riservati
// il presente programma deve intendersi proprietà esclusiva
// dell'Autore che ne detiene tutti i diritti
// il codice del presente programma non può essere copiato, modificato, riprodotto ne utilizzato
// senza la preventiva autorizzazione scritta dell'Autore che ne fissa i limiti e le condizioni
// per l'utilizzo.
// La legge tutela il diritto esclusivo dell'Autore.
// Gennaio 2006
//


function displayDate(){
      var this_month = new Array(12);
      this_month[0]  = "Gennaio";
      this_month[1]  = "Febbraio";
      this_month[2]  = "Marzo";
      this_month[3]  = "Aprile";
      this_month[4]  = "Maggio";
      this_month[5]  = "Giugno";
      this_month[6]  = "Luglio";
      this_month[7]  = "Agosto";
      this_month[8]  = "Settembre";
      this_month[9]  = "Ottobre";
      this_month[10] = "Novembre";
      this_month[11] = "Dicembre";
      var today = new Date();
      var day   = today.getDate();
      var month = today.getMonth();
      var year  = today.getYear();
      if (year < 1900){
         year += 1900;
      }
      return(day+" "+this_month[month]+" " +year);
}

function per_informazioni(){
             locationstring = 'mai' + 'lto:' + 'in'+'fo' + '@' + 'e-' + 'me' + 'l' + 'on' + '.' + 'it';
             window.location.replace(locationstring);
}

function HoPremuto(cosa,larghezza,altezza) {



         if (document.all) {
             if (larghezza=="null")
             {
                larghezza="";
             }
             else
             {
                var l=parseInt(larghezza)+25
                larghezza=" width="+l.toString()+";"
             }
             if (altezza=="null")
             {
                altezza="";
             }
             else
             {
                var h=parseInt(altezza)+25
                altezza=" height="+h.toString()+";"
             }
    
             Attributi="location=no; status=no; help=no; resizable=no;"+larghezza+" "+altezza+" scrollbars=yes";
          }
          else
          {
             if (larghezza=="null")
             {
                larghezza="";
             }
             else
             {
                larghezza="width="+larghezza
             }
             if (altezza=="null")
             {
                altezza="";
             }
             else
             {
                altezza=",height="+altezza
             }

             Attributi="location=no,toolbar=no,menubar=no,personalbar=no,scrollbars=yes,resizable=no,"+larghezza+altezza;

          }


         var DlgUrl=cosa+".htm"
         var dlg = window.open(DlgUrl, "ha_dialog", Attributi);

}


/* gestione navbar */

/* definizione dell'oggetto 
               colore.sfondo.sopra
               colore.sfondo.fuori
               colore.testo.sopra
               colore.testo.fuori
*/

function sf(up, out){
     this.sopra=up;
     this.fuori=out;
}


function col(){
     this.sfondo=new sf();
     this.testo=new sf();
}

var colore=new col();

colore.sfondo.sopra='#507F50';
colore.sfondo.fuori='#FFFFFF';
colore.sfondo.klick='#F0F0F0';
colore.testo.sopra='#FFFFFF';
colore.testo.fuori='#8B8A8A';
colore.testo.klick='#ff0000';

var max_menu=6;

var ultima_cliccata=0;
var cella_cliccata=new Array(max_menu);

function inizializza(){

//metti tutti i menu in posizione non cliccato
for ( var i=1; i<=max_menu; i++){
    cella_cliccata[i]=false;
    topo('fuori',i);
}
//clicca il menu 1 (home)
if (ultima_cliccata > 0) {

   klick(ultima_cliccata);
}
else
{
cella_cliccata[1]=true;
var stile=document.getElementById('hdr1').style;
     stile.background=colore.sfondo.klick;
     stile.color=colore.testo.klick;
}
}

function topo(cosa,cella){
     //se la cella non è cliccata
     if (!cella_cliccata[cella]){
     //cambia lo sfondo ed il testo
     //a seconda dell'azione del mouse (over, out)
     var stile=document.getElementById('hdr'+cella).style;
     stile.background=colore.sfondo[cosa];
     stile.color=colore.testo[cosa];
     }
}



function klick(quale){
     if (!cella_cliccata[quale]){
     //metti tutti i menu in pos. non cliccato
     for (var i=1; i<=max_menu; i++){
        cella_cliccata[i]=false;
        topo('fuori',i);
     }
     //clicca il menu che è stato cliccato
     cella_cliccata[quale]=true;
     ultima_cliccata=quale;
     var stile=document.getElementById('hdr'+quale).style;
     stile.background=colore.sfondo.klick;
     stile.color=colore.testo.klick;
     //alert(parent.document.getElementById('if_c_center').src);
     }
}