var contents =
{  sections:
   {  inge:
      {  href: '/artemis/inge/index.html',
	 text: 'Ingegneria',
	 sections:
	 {  Corsi :
	    {  href: '/artemis/inge/corsi/index.html',
	       text: 'Corsi',
	       sections:
	       {  DisAss:
		  {  href: '/artemis/inge/corsi/disegno_assistito.html',
		     text: 'Disegno assistito da calcolatore'
		  },
		  ElnApp:
		  {  href: '/artemis/inge/corsi/elettronica_applicata.html',
		     text: 'Elettronica applicata'
		  },
		  StrMis:
		  {  href: '/artemis/inge/corsi/strumentazione_misure.html',
		     text: 'Strumentazione e misure per l\'automazione'
		  }
	       }
	    },
	    Risorse :
	    {  href: '/artemis/inge/risorse.html',
	       text: 'Risorse',
	       sections:
	       {  Software:
		  {  href: '/artemis/inge/software_utili.html',
		     text: 'Software utili'
		  },
		  Glossario:
		  {  href: '/artemis/inge/glossario.html',
		     text: 'Glossario'
		  },
		  iiui:
		  {  href: 'news:it.istruzione.universita.ingegneria',
		     text: 'it.istruzione.universita.ingegneria'
		  },
		  fiii:
		  {  href: 'news:free.it.ingegneria.informatica',
		     text: 'free.it.ingegneria.informatica'
		  }
	       }	       
	    },
	    FrasiCelebri :
	    {  href: '/artemis/inge/celeb/index.html',
	       text: 'Frasi celebri',
	       last: true,
	       sections:
	       {  Abbate:
		  {  href: '/artemis/inge/celeb/abbate.html',
		     text: 'Abbate'
		  },
		  Aiena:
		  {  href: '/artemis/inge/celeb/aiena.html',
		     text: 'Aiena'
		  },
		  Alcuri:
		  {  href: '/artemis/inge/celeb/alcuri.html',
		     text: 'Alcuri'
		  },
		  Ardizzone:
		  {  href: '/artemis/inge/celeb/ardizzone.html',
		     text: 'Ardizzone'
		  },
		  Brugarino:
		  {  href: '/artemis/inge/celeb/brugarino.html',
		     text: 'Brugarino'
		  },
		  Calandra:
		  {  href: '/artemis/inge/celeb/calandra.html',
		     text: 'Calandra'
		  },
		  Cossentino:
		  {  href: '/artemis/inge/celeb/cossentino.html',
		     text: 'Cossentino'
		  },
		  Gaglio:
		  {  href: '/artemis/inge/celeb/gaglio.html',
		     text: 'Gaglio'
		  },
		  Garbo:
		  {  href: '/artemis/inge/celeb/garbo.html',
		     text: 'Garbo'
		  },
		  Genco :
		  {  href: '/artemis/inge/celeb/genco.html',
		     text: 'Genco'
		  },
		  ALombardo:
		  {  href: '/artemis/inge/celeb/a_lombardo.html',
		     text: 'A. Lombardo'
		  },
		  LoRe:
		  {  href: '/artemis/inge/celeb/lo_re.html',
		     text: 'Lo Re'
		  },
		  IManiscalco:
		  {  href: '/artemis/inge/celeb/i_maniscalco.html',
		     text: 'I. Maniscalco'
		  },
		  Morales:
		  {  href: '/artemis/inge/celeb/morales.html',
		     text: 'Morales'
		  },
		  Mangione:
		  {  href: '/artemis/inge/celeb/mangione.html',
		     text: 'Mangione'
		  },
		  Orioli:
		  {  href: '/artemis/inge/celeb/orioli.html',
		     text: 'Orioli'
		  },
		  Pesenti:
		  {  href: '/artemis/inge/celeb/pesenti.html',
		     text: 'Pesenti'
		  },
		  TRaimondi:
		  {  href: '/artemis/inge/celeb/t_raimondi.html',
		     text: 'T. Raimondi'
		  },
		  FMRaimondi:
		  {  href: '/artemis/inge/celeb/fm_raimondi.html',
		     text: 'F.M. Raimondi'
		  },
		  Rando:
		  {  href: '/artemis/inge/celeb/rando.html',
		     text: 'Rando'
		  },
		  Rinaldi:
		  {  href: '/artemis/inge/celeb/rinaldi.html',
		     text: 'Rinaldi'
		  },
		  GRusso:
		  {  href: '/artemis/inge/celeb/g_russo.html',
		     text: 'G. Russo'
		  },
		  FSorbello:
		  {  href: '/artemis/inge/celeb/f_sorbello.html',
		     text: 'F. Sorbello'
		  },
		  RSorbello:
		  {  href: '/artemis/inge/celeb/r_sorbello.html',
		     text: 'R. Sorbello'
		  },
		  Zangara:
		  {  href: '/artemis/inge/celeb/zangara.html',
		     text: 'Zangara'
		  }
	       }
	    }
	 }
      },
      prog:
      {  href: '/artemis/prog/index.html',
	 text: 'Programmazione',
	 sections:
	 {  java :
	    {  href: '/artemis/prog/java/index.html',
	       text: 'Java',
	       notYet: true
	    },
	    c_cplusplus :
	    {  href: '/artemis/prog/c-c++/index.html',
	       text: 'C/C++',
	       notYet: true
	    },
	    js :
	    {  href: '/artemis/prog/js/index.html',
	       text: 'JavaScript',
	       notYet: true,
	       sections:
	       {  Graphs:
		  {  href: '/artemis/prog/js/graphs/index.html',
		     text: 'Grafici'
		  },
		  FAQ:
		  {  href: '/artemis/prog/js/FAQ.html',
		     text: 'FAQ',
		     last: true
		  }
	       }
	    },
	    php :
	    {  href: '/artemis/prog/php/index.html',
	       text: 'PHP',
	       notYet: true
	    },
	    html :
	    {  href: '/artemis/prog/html/index.html',
	       text: 'HTML',
	       sections:
	       {  FAQ:
		  {  href: '/artemis/prog/html/FAQ.html',
		     text: 'FAQ',
		     last: true
		  }
	       }
	    },
	    xml :
	    {  href: '/artemis/prog/xml/index.html',
	       text: 'XML',
	       notYet: true
	    },
	    helloworld :
	    {  href: '/artemis/prog/helloworld/index.html',
	       text: 'Hello World',
	       last: true,
	       sections:
	       {  java:
		  {  href: '/artemis/prog/helloworld/java.html',
		     text: 'Hello World in Java'
		  },
		  c:
		  {  href: '/artemis/prog/helloworld/c.html',
		     text: 'Hello World in C'
		  },
		  cplusplus:
		  {  href: '/artemis/prog/helloworld/c++.html',
		     text: 'Hello World in C++'
		  },
		  js:
		  {  href: '/artemis/prog/helloworld/js.html',
		     text: 'Hello World in JavaScript'
		  },
		  php:
		  {  href: '/artemis/prog/helloworld/php.html',
		     text: 'Hello World in PHP',
		     last: true,
		     notYet: true
		  }
	       }
	    }
	 }
      },
      linux:
      {  href: '/artemis/linux/index.html',
	 text: 'Linux',
	 notYet: true
      },
      news:
      {  href: '/artemis/news/index.html',
	 text: 'Newsgroups',
	 righttoleft: true,
	 notYet: true,
	 sections:
	 {  iclj :
	    {  href: 'news:it.comp.lang.javascript',
	       text: 'it.comp.lang.javascript'
	    },
	    icpw32 :
	    {  href: 'news:it.comp.programmare.win32',
	       text: 'it.comp.programmare.win32'
	    },
	    icoli :
	    {  href: 'news:it.comp.os.linux.iniziare',
	       text: 'it.comp.os.linux.iniziare'
	    },
	    iiui :
	    {  href: 'news:it.istruzione.universita.ingegneria',
	       text: 'it.istruzione.universita.ingegneria',
	       last: true
	    }
	 }
      },
      options:
      {  href: '/artemis/opzioni.html',
	 text: 'Opzioni',
	 last: true,
	 righttoleft: true
      }
   }
};

function Menu(contents, imgset, classname, color, bgcolor)
{
   if (navigator.userAgent.indexOf('MSIE') == -1)
   {
      document.write('<SPAN STYLE="color:' + color + '">');
      for (var i in contents.sections)
         document.write('<A CLASS="' + classname + '" HREF="' + contents.sections[i].href + '">' + contents.sections[i].text + '</A>' + ((contents.sections[i].last) ? '' : '&nbsp;|&nbsp;'));
      document.write('</SPAN>');
      return;
   }

   var tabID = 'dock' + Math.floor(5000 * Math.random());
   document.writeln('<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0><TR>');
   document.writeln('<TD ID="' + tabID + '"></TD>');
   var tabDock = getObj(tabID);

   var tabs = new Array(), tabs_len = 0;

   for (var i in contents.sections)
   {  var tabImg = document.createElement('span');
      tabImg.innerHTML = contents.sections[i].text;
      
       	 var tabAnchor = document.createElement('A');
	 tabAnchor.setAttribute('href', contents.sections[i].href);
	 tabAnchor.onclick = (contents.sections[i].notYet) ?
	    function() { alert('Non ancora attivo!'); return false; } : null;
	 tabAnchor.className = classname;
	 tabAnchor.appendChild(tabImg);
	 tabDock.appendChild(tabAnchor);
	 if (!contents.sections[i].last)
	 {  var separator = document.createElement('span');
	    separator.style.color = color;
	    separator.innerHTML = '&nbsp;|&nbsp;';
	    tabDock.appendChild(separator);
	 }


	 if (contents.sections[i].sections)
	 {  tabImg.onmouseover = (contents.sections[i].righttoleft) ?
	       function() { var off = getAbsoluteOffset(this); if (this.drop.timeout) clearTimeout(this.drop.timeout); with (this.drop.style) { display = ''; left = off.left + 6 + (off.width - this.drop.offsetWidth); top = off.top + off.height + 2; } for (var i in this.tabs) if (this.tabs[i] != this) { if (this.tabs[i].drop) this.tabs[i].drop.style.display = 'none'; } } :
	       function() { var off = getAbsoluteOffset(this); if (this.drop.timeout) clearTimeout(this.drop.timeout); with (this.drop.style) { display = ''; left = off.left - 6; top = off.top + off.height + 2; } for (var i in this.tabs) if (this.tabs[i] != this) { if (this.tabs[i].drop) this.tabs[i].drop.style.display = 'none'; } };
	    tabImg.onmouseout = function() { var dummy = Math.floor(5000 * Math.random()); eval('tab' + dummy + ' = this'); this.drop.timeout = setTimeout('tab' + dummy + '.drop.style.display = \'none\';', 1000);};

	    var tabDrop = document.createElement('DIV');
	    with (tabDrop.style)
	    {  position = 'absolute';
	       display = 'none';
	       zIndex = 1000;
	    }

	    tabImg.drop = tabDrop;
	    tabDrop.complete = false; 
	    tabDrop.tabImg = tabImg;
	    tabDock.appendChild(tabDrop);



	    var dropTable = document.createElement('TABLE'),
		dropTBody = document.createElement('TBODY'),
		dropTR,	dropTD, dTable, dTBody, dTR, dTD, dImg;
	    dropTable.setAttribute('width', 77);
	    dropTable.setAttribute('cellSpacing', 0);
	    dropTable.setAttribute('cellPadding', 0);
	    dropTable.setAttribute('border', 0);

	    dTable = document.createElement('TABLE');
	    dTable.setAttribute('width', '100%');
	    dTable.setAttribute('cellSpacing', 0);
	    dTable.setAttribute('cellPadding', 0);
	    dTable.setAttribute('border', 0);
	    dTable.setAttribute('bgColor', bgcolor);

	    dTBody = document.createElement('TBODY');

	    dTR = document.createElement('TR');
	    dTD = document.createElement('TD');
	    dTD.setAttribute('align', 'center');
	    dTD.setAttribute('bgColor', bgcolor);
	    var spacer = document.createElement('img');
	    spacer.src = imgset + '_spacer.gif';
	    dTD.appendChild(spacer);
	    dTR.appendChild(dTD);
	    dTBody.appendChild(dTR);

	    dropTR = document.createElement('TR');

	    dropTD = document.createElement('TD');
    	    dropTD.setAttribute('background', imgset + '_brd_w.gif');
    	    dropTD.setAttribute('bgColor', bgcolor);
    	    dropTD.setAttribute('width', 9);
	    spacer = document.createElement('img');
	    spacer.src = imgset + '_brd_w.gif';
	    dropTD.appendChild(spacer);
	    dropTR.appendChild(dropTD);

	    dropTD = document.createElement('TD');
    	    dropTD.setAttribute('width', '90%');

	    if (contents.sections[i].sections)
            {
	       for (var k in contents.sections[i].sections)
	       {  dTR = document.createElement('TR');
		  dTD = document.createElement('TD');

		  dAnchor = document.createElement('A');
		  with (dAnchor)
		  {  href = contents.sections[i].sections[k].href;
		     onclick = (contents.sections[i].sections[k].notYet) ?
			function() { alert('Non ancora attivo!'); return false; } : null;
		  }
	 	  dAnchor.className = classname;
		  dImg = document.createElement('span');
		  with (dImg.style)
		  {  whiteSpace = 'nowrap';
      		     padding = '2px 0px 1px 0px';
		  }
		  dImg.innerHTML = contents.sections[i].sections[k].text;

		  dAnchor.appendChild(dImg);
		  dTD.appendChild(dAnchor);

		  dTR.appendChild(dTD);
		  dTBody.appendChild(dTR);
	       }
	    }

	    dTR = document.createElement('TR');
	    dTD = document.createElement('TD');
	    dTD.setAttribute('align', 'center');
	    dTD.setAttribute('colSpan', 3);
	    dTD.setAttribute('bgColor', bgcolor);
	    spacer = document.createElement('img');
	    spacer.src = imgset + '_spacer.gif';
	    dTD.appendChild(spacer);
	    dTR.appendChild(dTD);
	    dTBody.appendChild(dTR);

	    dTable.appendChild(dTBody);

	    dropTD.appendChild(dTable);
	    dropTR.appendChild(dropTD);

	    dropTD = document.createElement('TD');
    	    dropTD.setAttribute('background', imgset + '_brd_e.gif');
    	    dropTD.setAttribute('bgColor', bgcolor);
    	    dropTD.setAttribute('width', 11);
	    spacer = document.createElement('img');
	    spacer.src = imgset + '_brd_e.gif';
	    dropTD.appendChild(spacer);
	    dropTR.appendChild(dropTD);

	    dropTBody.appendChild(dropTR);

	    dropTR = document.createElement('TR');
	    dropTD = document.createElement('TD');
	    dropTD.setAttribute('colSpan', 3);

	    dTable = document.createElement('TABLE');
	    dTable.setAttribute('width', '100%');
	    dTable.setAttribute('height', 14);
	    dTable.setAttribute('cellSpacing', 0);
	    dTable.setAttribute('cellPadding', 0);
	    dTable.setAttribute('border', 0);
	    dTBody = document.createElement('TBODY');

	    dTR = document.createElement('TR');
	    dTR.setAttribute('vAlign', 'bottom');

	    dTD = document.createElement('TD');
	    dTD.setAttribute('height', 14);
	    dImg = document.createElement('IMG');
	    dImg.src = imgset + '_crn_sw.gif';
   	    dTD.appendChild(dImg);
	    dTR.appendChild(dTD);

	    dTD = document.createElement('TD');
	    dTD.setAttribute('width', '90%');
	    dTD.setAttribute('height', 14);
   	    dTD.setAttribute('background', imgset + '_brd_s.gif');
    	    dTD.setAttribute('bgColor', bgcolor);
	    dTR.appendChild(dTD);

	    dTD = document.createElement('TD');
	    dTD.setAttribute('align', 'right');
	    dTD.setAttribute('height', 14);
	    dImg = document.createElement('IMG');
	    dImg.src = imgset + '_crn_se.gif';
   	    dTD.appendChild(dImg);
	    dTR.appendChild(dTD);

	    dTBody.appendChild(dTR);
	    dTable.appendChild(dTBody);
	    dropTD.appendChild(dTable);
	    dropTR.appendChild(dropTD);


	    dropTBody.appendChild(dropTR);

	    dropTable.appendChild(dropTBody);
	    tabDrop.appendChild(dropTable);



	    tabDrop.onmouseover = function() { if (this.timeout) clearTimeout(this.timeout); };
	    tabDrop.onmouseout = function() { var dummy = Math.floor(5000 * Math.random()); eval('tab' + dummy + ' = this'); this.timeout = setTimeout('tab' + dummy + '.style.display = \'none\';', 1000); };
	 }
	 else
	 {  tabImg.onmouseover = function() { for (var i in this.tabs) if (this.tabs[i] != this) { if (this.tabs[i].drop) this.tabs[i].drop.style.display = 'none'; } };
	 }

      tabs[tabs_len++] = tabImg;

      tabImg.tabs = tabs;

   }

   document.writeln('</TR></TABLE>');

   defStatus = (typeof defStatus == 'undefined') ? defaultStatus : defStatus;
   defaultStatus = 'Menu caricato con successo';
   setTimeout('defaultStatus = defStatus;', 3000);
   
}

function Menu_Inge()
{
   Menu(contents.sections.inge, '/artemis/img/menu_w', 'menu_w', '#6699FF', 'white');
}

function Menu_Prog()
{
   Menu(contents.sections.prog, '/artemis/img/menu_w', 'menu_w', '#6699FF', 'white');
}

function Menu_Nav()
{
   Menu(contents, '/artemis/img/menu_o', 'menu_o', 'white', '#FFBA41');
}

function Menu_Main()
{
   Menu(contents, '/artemis/img/menu', 'menu', 'white', '#FFA500');
}
