<!--
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
// (NNNNNN)(NNNNNN)                                                           //
//      NN)(NN       stiweb.it                                                //
//      NN)(NN       (c)2005 Stive Barison                                    //
//      NN)(NN       http://www.stiweb.it                                     //
//                                                                            //
//----------------------------------------------------------------------------//
//  FILE             : tab_row.js                                             //
//  VERSIONE         : 1.0                                                    //
//  CREATO           : 23.06.2005                                             //
//  ULTIMA MODIF.    : 10.03.2006                                             //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//  SOMMARIO   : costruzione delle row colorate al mouse over nelle tabelle   //
//                                                                            //
//  Esempio di style CSS da associare alla pagina contente la tabella         //
//
//          table {
//
//              table-layout: auto;
//              width: 100%;
//              border:1px solid #CDCAC0;
//              border-collapse:collapse;
//
//          }
//
//          th,td   {
//              border:1px solid #CDCAC0;
//              border-collapse:collapse;
//              vertical-align: top;
//          }
//
//          th  {
//             background-color: #C8DFC3;
//             padding: 2px 0px 2px 0px;
//          }
//
//          th.sx   {
//             background-color: #C8DFC3;
//             padding: 2px 0px 2px 0px;
//             text-align: left;
//          }
//
//          tr  {
//             background-color: white;
//          }
//
//          tr.row1 {
//             background-color: #00CCFF;
//          }
//
//          tr.row2 {
//             background-color: #0066FF;
//          }
//          
//          /**
//           * Riga neutra
//           */
//          tr.row_n	{
//             background-color: #FFFFFF;
//          }
//
//          tr.highlight{
//             background-color: #CDCBBF;
//             cursor: pointer;
//          }
////////////////////////////////////////////////////////////////////////////////-->

/******************************************************************************/
/* attivo le funzioni al caricamento della pagina                             */
/*****************************************************************************
if ( document.getElementById('rec').style.visibility == "visible")    {
//window.onload = function()  {
        alt_row("tab_1");
        row_link("tab_1");

      }*/


      /**********************************************************************/
      /* funzione di colorazione delle righe in modo alternato              */
      /* row1 e row2 sono due stili definiti in un file .css                */
      /**********************************************************************/
      function alt_row(id)  {

                  if(document.getElementsByTagName)   {
                      var table = document.getElementById(id);
                      var rows = table.getElementsByTagName("tr");

                      for(j = 0; j < rows.length; j++)    {

                          //modifico le righe
                          if(j % 2 == 0)  {
                              rows[j].className = "row1";
                          }   else    {
                              rows[j].className = "row2";
                          }
                      }
                  }
             row_link(id);     
       }


      /**********************************************************************/
      /* funzione di inserimento nella riga del link associato              */
      /**********************************************************************/
      function row_link(id) {

            var rows = document.getElementById(id).getElementsByTagName("tr");

            for(i=0; i<rows.length; i++)  {
                var link = rows[i].getElementsByTagName("a");

                if(link.length == 1)    {
                	//alert("ciao");
                    rows[i].onclick = new Function('document.location.href="' + link[0].href + '"');
                    rows[i].onmouseover = new Function("this.className='highlight'");

                /***********************************************************/
                /* riassocio il colore della riga quando il mouse esce     */
                /***********************************************************/
                if(rows[i].className == "row1") {
                    rows[i].onmouseout = new Function("this.className='row1'");
                    }  else  {
                       rows[i].onmouseout = new Function("this.className='row2'");
                       }
                }
            }

      }
      
      /**********************************************************************/
      /* funzione di inserimento nella riga del link associato senza righe  */
      /**********************************************************************/
      function row_link_2(id) {

            var rows = document.getElementById(id).getElementsByTagName("tr");

            for(i=0; i<rows.length; i++)  {
                var link = rows[i].getElementsByTagName("a");

                if(link.length == 1)    {
                	//alert("ciao");
                    rows[i].onclick = new Function('document.location.href="' + link[0].href + '"');
                    rows[i].onmouseover = new Function("this.className='highlight'");

                /***********************************************************/
                /* riassocio il colore della riga quando il mouse esce     */
                /***********************************************************/
                if(rows[i].className == "row1") {
                    rows[i].onmouseout = new Function("this.className='row_n'");
                    }  else  {
                       rows[i].onmouseout = new Function("this.className='row_n'");
                       }
                }
            }

      }



