
/*
 +-------------------------------------------------------------------------------------+
 |                                                                                     |
 | DHTML Tabsets                                                                       |
 |                                                                                     |
 | Copyright and Legal Notices:                                                        |
 |                                                                                     |
 |   All source code, images, programs, files included in this distribution            |
 |   Copyright (c) 1996,1997,1998,1999,2000                                            |
 |                                                                                     |
 |          John C. Cokos  iWeb, Inc.                                                  |
 |          All Rights Reserved.                                                       |
 |                                                                                     |
 |                                                                                     |
 |   Web: http://www.iwebsoftware.com      Email: info@iwebsoftware.com                |
 |                                                                                     |
 +-------------------------------------------------------------------------------------+

    ** 
       Original Tabset Scripts were obtained from another source.  Cannot remember
       where I got them from.  I've manipulated the daylights out of it, to make it
       work in all browsers, and behave the way that I wanted it to.   If you are,
       or if you know the originater, please email me at the address noted above, and
       I will be happy to change the copyright notices herein to include you as
       the original source.
    **
       Traduccion y funcion IniciaTabs(): Iván Nieto Pérez
       El Código - http://www.elcodigo.com
    **    

*/


/*  
    Cambia las variables que aparecen a continuacion para adaptar el aspecto visual de las pestañas
*/

   var rows = new Array;
   var num_rows = 1;		//numero de filas
   var top = 240;		//posicion de las pestañas con respecto al borde superior
   				//OJO, si cambia, hay que cambiar tambien el atributo top de tab-body del CSS
   var left = 195;		//posicion de las pestañas con respecto al borde izquierdo
   var width = 585;		//anchura

   var tab_off = "#eeeeee";	//color pestaña no seleccionada
   var tab_on = "#f5f5f5";	//color pestaña seleccionada

   // ¡¡ no edites o cambies esta linea !!
   for ( var x = 1; x <= num_rows; x++ ) { rows[x] = new Array; }
 

   /*  
      Define tantas filas como quieras en el bloque a continuacion.
      Observa que cada fila debe corresponderse con una etiqueta "DIV"
      en el codigo HTML, y que esta etiqueta debe tener como identificador
      T seguido de los numeros que indican fila y columna

      Por ejemplo:  row[1][5] necesita un div con un id igual a "T15"

      Observar los ejemplos que se muestran en los comentarios:
   */
   



/* No cambies nada a partir de aqui */
            
var NS4 = (document.layers) ? 1 : 0;
var IE = (document.all) ? 1 : 0;
var DOM = 0; 
if (parseInt(navigator.appVersion) >=5) {DOM=1};

var lastHeader;
var currShow;
var nro_filas;

function changeCont(tgt,header) {

    target=('T' +tgt);
    
    if (DOM) {

        // Esconde el ultimo y cambia el color de la pestaña al valor original
        currShow.style.display ="none";
        if ( lastHeader ) { 
           lastHeader.style.background = tab_off; 
           lastHeader.style.fontWeight="normal"; 
        }
    
        // Muestra este y cambia el color de la pestaña a color de seleccionada
        var flipOn = document.getElementById(target);			
        flipOn.style.display="";

        var thisTab = document.getElementById(header);			
        thisTab.style.background = tab_on;
        thisTab.style.fontWeight = "bold";

        // Guarda para la proxima vez
        currShow=document.getElementById(target);
        lastHeader = document.getElementById(header);

        return false;
    }

    else if (IE) {

        // Esconde el ultimo y cambia el color de la pestaña al valor original
        currShow.style.display = 'none';
        if (lastHeader) { 
            lastHeader.style.background = tab_off; 
            lastHeader.style.fontWeight="normal";
        }

        // Muestra este y cambia el color de la pestaña a color de seleccionada
        document.all[target].style.display = '';
        document.all[header].style.background = tab_on;
        document.all[header].style.fontWeight = 'bold';

        // Guarda para la proxima vez
        currShow=document.all[target];
        lastHeader=document.all[header];

        return false;
    }
        
    else if (NS4) {

        // Esconde el ultimo y cambia el color de la pestaña al valor original
        currShow.display = 'none';
        // if (lastHeader) { lastHeader.bgColor = tab_off; }

        // Muestra este y cambia el color de la pestaña a color de seleccionada
        document.layers[target].display = '';
        // document.layers[header].bgColor  = tab_on;

        // Guarda para la proxima vez
        currShow=document.layers[target];
        // lastHeader=document.layers[header];

        return false;
    }
        
    // && (version >=4)
    else {
        window.location=('#A' +target);
        return true;
    }


}

function DrawTabs() {

    var output = '';
    nro_filas = rows[1].length-1;
    for ( var x = 1; x <= num_rows; x++ ) { 

        if( x > 1 ) { 
          top = top + 20;
          left = left - 15;
          width = width + 15;
        }

        output += '<div id="tabstop"';
        output += 'left:' + left + 'px;';
        output += 'top:' + top + 'px; ';
        output += 'width:' + width + 'px; z-index:1;">\n';
        output += '<div style="background:#eee; width:100%"><table border="0" cellpadding="0" cellspacing="0" style="margin:5px; margin-bottom:0px">\n';                    
        output += '<tr valign="top">\n';

           for ( var z = 1; z < rows[x].length; z++ ) {
            
              var tid = "tab" + x + z;
              var did = x + z;
              output += '<td id="' + tid +'" class="tab-button"><a href="#" onClick="changeCont(\'' + x + z + '\', \'' + tid + '\'); return false;" onFocus="if(this.blur)this.blur()">' + rows[x][z] + '</a></td>\n';
              output += '<td width=5 nowrap></td>';
           }

        output += '</tr>\n';
        output += '</table></div>\n';
        output += '</div>\n\n';

    }

    self.document.write(output);

}

       
function IniciaTabs() {
    
    if (DOM) { currShow=document.getElementById('T11');}
    else if (IE) { currShow=document.all['T11'];}
    else if (NS4) { currShow=document.layers["T11"];};  
    for(i=1;i<=nro_filas; i++){
        if (DOM) { currShow=document.getElementById('T1'+i);}
        else if (IE) { currShow=document.all['T1'+i];}
        else if (NS4) { currShow=document.layers['T1'+i];};
        currShow.style.display = 'none';     
    }
    changeCont("11", "tab11");
 
}

//window.onload = IniciaTabs;
//if (document.captureEvents) {			//N4 requiere invocar la funcion captureEvents
//	document.captureEvents(Event.LOAD)
//}
