var buscadorTransparente = true; var elementosOpacables = []; var tiempoDesaparicion = 1500; // 1 segundo window.onload = function() { if ( document.getElementById ) { prepararBuscador(); prepararCinta( 'imagenes' ); if ( document.getElementById ) if ( document.getElementById( 'listado' ) ) initScrollLayers(); } } function prepararBuscador() { if ( document.getElementById( 'parametros_busqueda' ) ) { if ( !buscadorTransparente ) document.getElementById( 'parametros_busqueda' ).style.display = 'block'; else window.setTimeout( "document.getElementById( 'parametros_busqueda' ).style.display = 'block';", tiempoDesaparicion ); } generarOpacador( 'activador_entrada_buscador', 'calendario_entrada_buscador', mostrarCalendario, true ); generarOpacador( 'activador_salida_buscador', 'calendario_salida_buscador', mostrarCalendario, true ); generarOpacador( 'activador_entrada_calculadora', 'calculadora_entrada_calculadora', mostrarCalendario, true ); generarOpacador( 'activador_salida_calculadora', 'calculadora_salida_calculadora', mostrarCalendario, true ); generarOpacador( 'activador_buscador', 'parametros_busqueda', mostrarParametrosBusqueda, buscadorTransparente ); generarOpacador( 'activador_disponible', 'disponibilidad', mostrarDisponibilidad, true ); generarOpacador( 'activador_zoom', 'zoom', mostrarZoom, true ); } generarOpacador = function( activador, objetivo, accion, activacion ) { if ( document.getElementById( activador ) && document.getElementById( objetivo ) ) { elementosOpacables[activador] = []; elementosOpacables[activador]['elemento'] = new Fadomatic( document.getElementById( objetivo ), 5, 100 ); elementosOpacables[activador]['estado'] = 'opaco'; document.getElementById( activador ).onclick = accion; if ( activacion ) document.getElementById( activador ).onclick(); } }; getAbsolutePos = function( el ) { var SL = 0, ST = 0; var is_div = /^div$/i.test(el.tagName); if ( is_div && el.scrollLeft ) SL = el.scrollLeft; if ( is_div && el.scrollTop ) ST = el.scrollTop; var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST }; if ( el.offsetParent ) { var tmp = this.getAbsolutePos( el.offsetParent ); r.x += tmp.x; r.y += tmp.y; } return r; }; mostrarCalendario = function( el ) { if ( elementosOpacables[this.id]['estado'] == 'opaco' ) { elementosOpacables[this.id]['elemento'].fadeOut(); elementosOpacables[this.id]['estado'] = 'transparente'; } else { pos = getAbsolutePos( this ); calendario = elementosOpacables[this.id]['elemento']._element; calendario.style.left = pos.x + 'px'; calendario.style.top = ( pos.y + 30 ) + 'px'; elementosOpacables[this.id]['elemento'].fadeIn(); elementosOpacables[this.id]['estado'] = 'opaco'; } }; mostrarParametrosBusqueda = function( el ) { if ( elementosOpacables[this.id]['estado'] == 'opaco' ) { elementosOpacables[this.id]['elemento'].fadeOut(); elementosOpacables[this.id]['estado'] = 'transparente'; // Ocultar los calendarios if ( document.getElementById( 'parametros_busqueda' ) ) { var activadores = document.getElementById( 'parametros_busqueda' ).getElementsByTagName( 'input' ); for ( i = 0; i < activadores.length; i++ ) if ( activadores[i].id.indexOf( 'activador' ) > -1 ) if ( elementosOpacables[activadores[i].id]['estado'] != 'transparente' ) activadores[i].onclick(); } } else { elementosOpacables[this.id]['elemento'].fadeIn(); elementosOpacables[this.id]['estado'] = 'opaco'; } }; mostrarDisponibilidad = function() { if ( elementosOpacables[this.id]['estado'] == 'opaco' ) { elementosOpacables[this.id]['elemento'].fadeOut(); elementosOpacables[this.id]['estado'] = 'transparente'; } else { pos = getAbsolutePos( this ); calendarios = elementosOpacables[this.id]['elemento']._element; calendarios.style.left = ( pos.x - 300 ) + 'px'; calendarios.style.top = ( pos.y + 30 ) + 'px'; elementosOpacables[this.id]['elemento'].fadeIn(); elementosOpacables[this.id]['estado'] = 'opaco'; } }; mostrarZoom = function( img, el ) { if ( img ) { if ( document.getElementById ) { if ( img.length > 0 ) if ( document.getElementById( 'detalle' ) ) document.getElementById( 'detalle' ).src = img; if ( document.getElementById( 'zoom' ) ) document.getElementById( 'zoom' ).style.display = 'block'; } if ( elementosOpacables['activador_zoom']['estado'] != 'opaco' ) document.detalle.activador_zoom.onclick(); } else { if ( elementosOpacables[this.id]['estado'] == 'opaco' ) { elementosOpacables[this.id]['elemento'].fadeOut(); elementosOpacables[this.id]['estado'] = 'transparente'; window.setTimeout( "document.getElementById( 'zoom' ).style.display = 'none'", tiempoDesaparicion ); } else { elementosOpacables[this.id]['elemento'].fadeIn(); elementosOpacables[this.id]['estado'] = 'opaco'; } } }; function initScrollLayers() { // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, // if horizontal scrolling, id of element containing scrolling content (table?) var wndo1 = new dw_scrollObj( 'prefacio', 'listado', null ); // arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset // (x/y offsets of dragBar in track) wndo1.setUpScrollbar("dragBar1", "track1", "v", 1, 1); // Read instructions if your scrolling layers are inside tables // Scrollbars initially hidden in this example /**dw_showLayers("scrollbar1", "scrollbar2", "scrollbar3");**/ dw_showLayers("scrollbar1"); } function dw_showLayers() { if ( document.getElementById ) { var lyr, i; for (i=0; arguments[i]; i++) { lyr = document.getElementById( arguments[i] ); lyr.style.visibility = "visible"; } } }