/*
 +-------------------------------------------------------------------------------------+
 |                                                                                     |
 | 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 left = 205;		//posicion de las pestañas con respecto al borde izquierdo
   //var width = 585;		//anchura
   var width = 371;		//anchura

   var tab_off = "#c0d0a8";	//color pestaña no seleccionada
   var tab_on = "#e5edd8";	//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:
   */
   rows[1][1] = "<img src='/wp-content/plugins/reservas_alx/template/ico_avion.png' border='0' />Vuelo";			// Requiere: <div id="T11" class="tab-body">  ... </div>
   rows[1][2] = "<img src='/wp-content/plugins/reservas_alx/template/hotel.png' border='0' />Hoteles";		// Requiere: <div id="T12" class="tab-body">  ... </div>
   rows[1][3] = "<img src='/wp-content/plugins/reservas_alx/template/turismo.png' border='0' />Tusrimo a Medida";	// Requires: <div id="T13" class="tab-body">  ... </div>


/* 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;

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.visibility="hidden";*/
        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.visibility="visible";*/
        flipOn.style.display="block";

        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 = 'block';
        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.visibility = 'none';
        // if (lastHeader) { lastHeader.bgColor = tab_off; }

        // Muestra este y cambia el color de la pestaña a color de seleccionada
        document.layers[target].visibility = 'block';
        // 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 = '';

    for ( var x = 1; x <= num_rows; x++ ) { 

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

        /*output += '<div id="tabstop" style="position:absolute; ';*/
	output += '<div id="tabstop" style=" ';
        output += 'left:' + left + 'px;';
        output += 'top:' + top + 'px; ';
        /*output += 'width:' + width + 'px; z-index:1;">\n';*/
	output += 'width:' + width + 'px; ">\n';
        output += '<table border="0" cellpadding="0" cellspacing="1">\n';                    
        //output += '<tr valign="top">\n';
        output += '<tr>\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 += '</tr>\n';
        output += '</table>\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"];};       
    changeCont("11", "tab11");
 
}

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