﻿/*   Funcion para habilitar scroll en divs*/


function banners() {
    if (document.getElementById('barra_banners') != null) {
        var banner = document.getElementById('barra_banners').innerHTML;
        banner = banner.replace("<embed", "<param name='wmode' value='transparent'/><embed width='648' height='96' wmode='transparent'");
        document.getElementById('barra_banners').innerHTML = banner;
    }
}

function tamanio() {
    var alto = document.documentElement.clientHeight;
    var ventana = window.location.pathname.toLowerCase();

    if (alto < 732) {
        alto = 747
    }

    document.getElementById('cuerponuevo').style.height = alto + 'px';
    document.getElementById('columna-derecha').style.height = alto + 'px';
    document.getElementById('contenido-principal').style.height = alto + 'px';
    document.getElementById('columna-izquierda').style.height = alto + 'px';
    document.getElementById('columna-izq-1').style.height = (alto - 30) + 'px';


    if (ventana == "/librerias/plantilla.aspx") {
        //LA PÁGINA PRINCIPAL
        alto = alto - 96 - 15 - 15;
        if (alto < 560) {
            alto = 560
        }
        document.getElementById('columna-1').style.height = alto + 'px';
        document.getElementById('columna-2').style.height = alto + 'px';
        document.getElementById('columna-3').style.height = alto + 'px';
    }

    if (ventana == "/librerias/" || ventana == "/librerias/default.aspx" || ventana == "/librerias/default2.aspx" || ventana == "/librerias/demo.aspx") {
        //LA PÁGINA PRINCIPAL
        alto = alto - 96 - 15 - 15;
        if (alto < 620) {
            alto = 620
        }
        document.getElementById('contenidoMaster').style.height = alto + 'px';
        document.getElementById('columna-1').style.height = alto + 'px';
        document.getElementById('columna-2').style.height = alto + 'px';
        document.getElementById('columna-3').style.height = alto + 'px';
        document.getElementById('imagenNueva').style.height = alto + 'px';
        document.getElementById('Contenido_ContentPlaceHolder2_Contenido_Columna_1_Accordion1').style.height = alto + 'px';
        document.getElementById('Contenido_ContentPlaceHolder2_Contenido_Columna_3_Accordion2').style.height = alto + 'px';
    }

    if (ventana == "/librerias/intencionescompra.aspx") {
        //INTENCIONES COMPRA
        document.getElementById('contenido-principal').style.height = alto + 'px';
        alto = alto - 96 - 15 - 15 - 15;
        document.getElementById('cont1').style.height = alto + 'px';
    }

    if (ventana == "/librerias/libroindependiente/default2.aspx") {
        //PARA FERIA DEL LIBRO INDEPENDIENTE
        alto = alto - 96 - 15 - 15;
        document.getElementById('columna-1').style.height = alto + 'px';
        document.getElementById('columna-2').style.height = alto + 'px';

        alto = alto - 15;
        document.getElementById('Contenido_Contenido_Columna_1_listViewVideo_Div1').style.height = alto + 'px';
        document.getElementById('Contenido_Contenido_Columna_2_ListView1_Div1').style.height = alto + 'px';
    }
    if (ventana == "/librerias/libroindependiente/" || ventana == "/librerias/libroindependiente/default.aspx") {
        //PARA FERIA DEL LIBRO INDEPENDIENTE
        alto = alto - 96 - 15 - 15;
        document.getElementById('columna-1').style.height = alto + 'px';
        document.getElementById('columna-2').style.height = alto + 'px';
        document.getElementById('columna-3').style.height = alto + 'px';

        alto = alto - 15;
        document.getElementById('Contenido_ContentPlaceHolder2_Contenido_Columna_2_listViewVideo_Div1').style.height = alto + 'px';
        document.getElementById('Contenido_ContentPlaceHolder2_Contenido_Columna_3_ListView1_Div1').style.height = alto + 'px';
    }
    if (ventana == "/librerias/moleskine/"  || ventana == "/librerias/moleskine/default.aspx") {
        //PARA MOLESKINE
        alto = alto - 96 - 15 - 15;
        document.getElementById('columna-1').style.height = alto + 'px';
        document.getElementById('columna-2').style.height = alto + 'px';
        document.getElementById('columna-3').style.height = alto + 'px';

        alto = alto - 15;
        document.getElementById('Contenido_ContentPlaceHolder2_Contenido_Columna_2_lvAgendas_Div1').style.height = alto + 'px';
        document.getElementById('Contenido_ContentPlaceHolder2_Contenido_Columna_3_lvBolsillo_Div1').style.height = alto + 'px';
    }
    if (ventana == "/librerias/libroselectronicos/" || ventana == "/librerias/libroselectronicos/default.aspx" || ventana == "/librerias/libroselectronicos/default2.aspx") {
        //PARA LIBROS ELECTRONICOS
        alto = alto - 96 - 15 - 15;
        document.getElementById('columna-1').style.height = alto + 'px';
        document.getElementById('columna-2').style.height = alto + 'px';
        document.getElementById('columna-3').style.height = alto + 'px';
        document.getElementById('Contenido_ContentPlaceHolder2_contenidoColumnas_Contenido_Columna_3_Accordion1').style.height = alto + 'px';
    }
    if (ventana == "/librerias/libroselectronicos/novedades.aspx") {
        //PARA LIBROS ELECTRONICOS NOVEDADES
        alto = alto - 96 - 15 - 15 - 15;
        document.getElementById('listaLibros').style.height = alto + 'px';
        document.getElementById('como_comprar').style.backgroundColor = '#000000';
        document.getElementById('como_comprar_titulo').style.color = '#FFFFFF';
        document.getElementById('barra_social_abajo').style.backgroundColor = '#79A098';
    }
    if (ventana == "/librerias/otrosidiomas/" || ventana == "/librerias/otrosidiomas/default.aspx") {
        //PARA OTROS IDIOMAS
        alto = alto - 96 - 15 - 15;
        document.getElementById('columna-1').style.height = alto + 'px';
        document.getElementById('columna-2').style.height = alto + 'px';
        document.getElementById('columna-3').style.height = alto + 'px';
        alto = alto - 15;
        document.getElementById('Contenido_ContentPlaceHolder2_contenidoColumnas_Contenido_Columna_1_lvItaliano_Div1').style.height = alto + 'px';
        document.getElementById('Contenido_ContentPlaceHolder2_contenidoColumnas_Contenido_Columna_2_lvIngles_Div1').style.height = alto + 'px';
        document.getElementById('Contenido_ContentPlaceHolder2_contenidoColumnas_Contenido_Columna_3_lvFrances_Div1').style.height = alto + 'px';
    }
    if (ventana == "/librerias/musicayvideo/" || ventana == "/librerias/musicayvideo/default.aspx") {
        //PARA MUSICA Y VIDEO
        alto = alto - 96 - 15 - 15;
        document.getElementById('columna-1').style.height = alto + 'px';
        document.getElementById('columna-2').style.height = alto + 'px';
        document.getElementById('columna-3').style.height = alto + 'px';

        alto = alto - 15;
        document.getElementById('Contenido_ContentPlaceHolder2_Contenido_Columna_1_lvMusica_Div1').style.height = alto + 'px';
        document.getElementById('Contenido_ContentPlaceHolder2_Contenido_Columna_2_lvVideo_Div1').style.height = alto + 'px';
    }
    if (ventana == "/librerias/ninosyjovenes/default2.aspx" || ventana == "/librerias/ninosyjovenes/default3.aspx") {
        //PARA NIÑOS Y JOVENES
        //alto = alto - 96 - 15 - 15;
        document.getElementById('bannershomeNinos').style.height = alto + 'px';
        document.getElementById('bannershomeNinos').style.backgroundColor = '#FFFFFF';
    }
    if (ventana == "/librerias/ninosyjovenes/" || ventana == "/librerias/ninosyjovenes/default.aspx") {
        //PARA NIÑOS Y JOVENES
        alto = alto - 96 - 15 - 15;
        document.getElementById('columna-1').style.height = alto + 'px';
        document.getElementById('columna-2').style.height = alto + 'px';
        document.getElementById('columna-3').style.height = alto + 'px';
        alto = alto - 15
        
        document.getElementById('grandesLectores').style.height = alto + 'px';
        document.getElementById('jovenes').style.height = alto + 'px';
        alto = alto - 66 - 8;
        document.getElementById('empiezan').style.height = alto + 'px';

    }
    if (ventana == "/librerias/ninosyjovenes/default4.aspx") {
        //PARA NIÑOS Y JOVENES
        alto = alto - 96 - 15 - 15;
        //var imagenbarra = document.getElementById('Contenido_Contenido_Columna_1_adRotatorNinos').getElementsByTagName('img')[0].src.split('/')[6];
        //var fondo
        /*if (imagenbarra == "kevin216.jpg") { fondo = "#E8575A" }
        else if (imagenbarra == "actividades_ninos1.jpg") { fondo = "#F8B370" }
        else if (imagenbarra == "Segundo_acto2.jpg") { fondo = "#3899BA" }*/
        //document.getElementById('columna-1').style.backgroundColor = fondo;
        document.getElementById('columna-1').style.height = alto + 'px';
        document.getElementById('colBanner').style.height = (alto - 66) + 'px';
        document.getElementById('columna-2').style.height = alto + 'px';
        alto = alto - 15;
        document.getElementById('empiezan').style.height = alto + 'px';
        

    }
    if (ventana == "/librerias/detalle.aspx" || ventana == "/librerias/detalle3.aspx" || (ventana.indexOf("\/librerias\/libro/") != -1)) {
        //PARA DETALLE DEL LIBRO
        
        alto = alto - 443;
        document.getElementById('detalleParteBaja').style.height = alto + 'px';
        document.getElementById('detalles').style.height = alto + 'px';
        document.getElementById('col-der-detalle').style.height = alto + 'px';
        document.getElementById('Contenido_ContenidoBusqueda_Accordion2').style.height = alto + 'px';
    }
    if (ventana == "/librerias/detalle2.aspx") {
        //PARA DETALLE DEL LIBRO

        alto = alto - 435;
        document.getElementById('detalleParteBaja').style.height = alto + 'px';
        document.getElementById('Contenido_ContenidoBusqueda_detallesL').style.height = alto + 'px';
        document.getElementById('col-der-detalle').style.height = alto + 'px';
        document.getElementById('Contenido_ContenidoBusqueda_Accordion2').style.height = alto + 'px';
    }
    if (ventana == "/librerias/catalogo.aspx" || ventana == "/librerias/secciones.aspx" || ventana == "/librerias/saldos.aspx" || ventana == "/librerias/luto.aspx") {
        //PARA EL RESULTADO DE LAS BUSQUEDAS
        alto = alto - 96 - 15 - 15 - 15 -15 - 15 - 5;
        document.getElementById('listaLibros').style.height = alto + 'px';
    }
    if (ventana == "/librerias/lecturagratuita/" || ventana == "/librerias/lecturagratuita/default.aspx") {
        //LECTURA GRATUITA
        alto = alto - 96 - 15 - 15 - 20 - 15;
        document.getElementById('listaGratuita').style.height = alto + 'px';
    }
    if (ventana == "/librerias/lecturagratuita/registro.aspx" || ventana == "/librerias/lecturagratuita/librodescarga.aspx" || ventana == "/librerias/lecturagratuita/directo.aspx") {
        //LECTURA GRATUITA
        alto = alto - 96 - 15 - 15 - 15;
        document.getElementById('registroGratuito').style.height = alto + 'px';
    }
    if (ventana == "/librerias/eluniversal.aspx") {
        //PARA EL UNIVERSAL
        alto = alto - 96 - 15 - 15 - 15 - 8;
        document.getElementById('listaLibros').style.height = alto + 'px';
        document.getElementById('como_comprar').style.backgroundColor = '#000000';
        document.getElementById('como_comprar_titulo').style.color = '#FFFFFF';
        document.getElementById('barra_social_abajo').style.backgroundColor = '#79A098';
    }
    if (ventana == "/librerias/eluniversalrespaldo.aspx") {
        //PARA EL UNIVERSAL RESPALDO
        alto = alto - 96 - 15 - 15 - 15 - 8;
        document.getElementById('listaLibros').style.height = alto + 'px';
        document.getElementById('como_comprar').style.backgroundColor = '#000000';
        document.getElementById('como_comprar_titulo').style.color = '#FFFFFF';
        document.getElementById('barra_social_abajo').style.backgroundColor = '#79A098';
    }
    if (ventana == "/librerias/busqueda.aspx") {
        //PARA LA BUSQUEDA AVANZADA
        alto = alto - 96 - 15 - 15 - 15;
        document.getElementById('contenidoBuscar').style.height = alto + 'px';
    }
    if (ventana == "/librerias/cine.aspx") {
        //PARA LA BUSQUEDA AVANZADA
        alto = alto - 96 - 15 - 15 - 15;
        document.getElementById('contenidoImagen').style.height = alto + 'px';
    }
    if (ventana == "/librerias/libroselectronicos/activapapyre.aspx" || ventana == "/librerias/libroselectronicos/papyre.aspx") {
        //PAPYRE
        alto = alto - 96 - 15 - 15 - 15;
        document.getElementById('informacionCliente').style.height = alto + 'px';
        document.getElementById('cuadroCarga').style.height = alto + 'px';
    }
    if (ventana == "/librerias/libroselectronicos/registropapyre.aspx") {
        //PAPYRE
        alto = alto - 96 - 15 - 15 - 15;
        document.getElementById('informacionCliente').style.height = alto + 'px';
    }
    if (ventana == "/librerias/libroselectronicos/confirmapapyre.aspx") {
        //PAPYRE
        alto = alto - 96 - 15 - 15 - 15;
        document.getElementById('informacionCliente').style.height = alto + 'px';
        document.getElementById('cuadroCarga').style.height = alto + 'px';
    }
    if (ventana == "/librerias/seguimientoregistro.aspx") {
        //PEDIDOS ANTERIORES
        alto = alto - 96 - 15 - 15 - 15;
        document.getElementById('contenidoCompra').style.height = alto + 'px';
    }
    if (ventana == "/librerias/seguimientoconsulta.aspx") {
        //PEDIDOS ANTERIORES
        alto = alto - 96 - 15 - 15 - 15;
        document.getElementById('contenidoCompra').style.height = alto + 'px';
        alto = alto - 50 - 20 - 40;
        document.getElementById('contenidoSeguimiento').style.height = alto + 'px';
    }
    if (ventana == "/librerias/seguimientodetalle.aspx") {
        //PEDIDOS ANTERIORES
        alto = alto - 96 - 15 - 15 - 15;
        document.getElementById('contenidoCompra').style.height = alto + 'px';
        alto = alto - 50;
        document.getElementById('contenidoSeguimiento').style.height = alto + 'px';
    }
    if (ventana == "/librerias/resumencompra.aspx" || ventana == "/librerias/compras/resumencompra.aspx") {
        //CANASTA DE COMPRAS
        alto = alto - 96 - 15 - 15 - 15 - 10;
        document.getElementById('contenidoCompra').style.height = alto + 'px';
        alto = alto - 20 - 30 - 40 - 30;
        document.getElementById('listaLibros').style.height = alto + 'px';
    }
    if (ventana == "/librerias/registro.aspx" || ventana == "/librerias/compras/registro.aspx") {
        //CANASTA DE COMPRAS
        alto = alto - 96 - 15 - 15 - 15 - 10;
        document.getElementById('contenidoCompra').style.height = alto + 'px';
    }
    if (ventana == "/librerias/informacion.aspx" || ventana == "/librerias/compras/informacion.aspx") {
        //CANASTA DE COMPRAS+
        alto = alto - 96 - 15 - 15 - 15 - 10;
        document.getElementById('contenidoMaster').style.height = alto + 'px';
        document.getElementById('contenidoCompra').style.height = alto + 'px';
        alto = alto - 30;
        document.getElementById('informacionCliente').style.height = alto + 'px';
    }
    if (ventana == "/librerias/pago.aspx" || ventana == "/librerias/compras/pago.aspx") {
        //CANASTA DE COMPRAS
        alto = alto - 96 - 15 - 15 - 15 - 10;
        document.getElementById('contenidoMaster').style.height = alto + 'px';
        document.getElementById('contenidoCompra').style.height = alto + 'px';
        alto = alto - 30;
        document.getElementById('informacionCliente').style.height = alto + 'px';
    }
    if (ventana == "/librerias/confirmacion.aspx" || ventana == "/librerias/compras/confirmacion.aspx") {
        //CANASTA DE COMPRAS
        alto = alto - 96 - 15 - 15 - 15 - 10;
        document.getElementById('contenidoMaster').style.height = alto + 'px';
        document.getElementById('contenidoCompra').style.height = alto + 'px';
        alto = alto - 30 - 50 - 20 - 20;
        document.getElementById('informacionCliente').style.height = alto + 'px';
    }
    if (ventana == "/librerias/fin.aspx" || ventana == "/librerias/compras/fin.aspx") {
        //CANASTA DE COMPRAS
        alto = alto - 96 - 15 - 15 - 15;
        document.getElementById('contenidoMaster').style.height = alto + 'px';
        document.getElementById('contenidoCompra').style.height = alto + 'px';
    }
    if (ventana.substr(0, 16) == "/librerias/ayuda") {
        //CANASTA DE COMPRAS
        alto = alto - 96 - 15 - 15 - 15;
        document.getElementById('contenidoCompra').style.height = alto + 'px';
        alto = alto - 30;
        document.getElementById('col-izq').style.height = alto + 'px';
        document.getElementById('col-der').style.height = alto + 'px';
    }
    if (ventana.substr(0, 24) == "/librerias/fceentuemail/") {
        //FCE EN TU EMAIL
        alto = alto - 96 - 15 - 15 - 15 ;
        document.getElementById('contenidoFCEemail').style.height = alto + 'px';
    }
    if (ventana == "/librerias/reporteelectronicos.aspx") {
        //CANASTA DE COMPRAS
        alto = alto - 96 - 15 - 15 - 15;
        document.getElementById('contenidoBuscar').style.height = alto + 'px';
    }
    if (ventana == "/librerias/estadisticas/ventanocturna.aspx") {
        //CANASTA DE COMPRAS
        alto = alto - 96 - 15 - 15 - 15;
        document.getElementById('contenidoBuscar').style.height = alto + 'px';
    }
}

function bannersLibrerias() {
    var banner = document.getElementById('bannershomeNinos').innerHTML;
    banner = banner.replace("embed", "embed width='648' height='590'");
    document.getElementById('bannershomeNinos').innerHTML = banner;
}

function todas() {
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox1').checked = true;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox2').checked = true;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox3').checked = true;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox4').checked = true;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox5').checked = true;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox6').checked = true;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox7').checked = true;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox8').checked = true;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox9').checked = true;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox10').checked = true;
}
function quitar() {
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox1').checked = false;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox2').checked = false;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox3').checked = false;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox4').checked = false;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox5').checked = false;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox6').checked = false;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox7').checked = false;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox8').checked = false;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox9').checked = false;
    document.getElementById('Contenido_ContenidoBusqueda_CheckBox10').checked = false;
}

function cambiaPortada(ruta) {
    document.getElementById("portada").src = ruta;
}


var BrowserDetect = {
    init: function () {
        this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
        this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
        this.OS = this.searchString(this.dataOS) || "an unknown OS";
    },
    searchString: function (data) {
        for (var i = 0; i < data.length; i++) {
            var dataString = data[i].string;
            var dataProp = data[i].prop;
            this.versionSearchString = data[i].versionSearch || data[i].identity;
            if (dataString) {
                if (dataString.indexOf(data[i].subString) != -1)
                    return data[i].identity;
            }
            else if (dataProp)
                return data[i].identity;
        }
    },
    searchVersion: function (dataString) {
        var index = dataString.indexOf(this.versionSearchString);
        if (index == -1) return;
        return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
    },
    dataBrowser: [
		{
		    string: navigator.userAgent,
		    subString: "Chrome",
		    identity: "Chrome"
		},
		{ string: navigator.userAgent,
		    subString: "OmniWeb",
		    versionSearch: "OmniWeb/",
		    identity: "OmniWeb"
		},
		{
		    string: navigator.vendor,
		    subString: "Apple",
		    identity: "Safari",
		    versionSearch: "Version"
		},
		{
		    prop: window.opera,
		    identity: "Opera"
		},
		{
		    string: navigator.vendor,
		    subString: "iCab",
		    identity: "iCab"
		},
		{
		    string: navigator.vendor,
		    subString: "KDE",
		    identity: "Konqueror"
		},
		{
		    string: navigator.userAgent,
		    subString: "Firefox",
		    identity: "Firefox"
		},
		{
		    string: navigator.vendor,
		    subString: "Camino",
		    identity: "Camino"
		},
		{		// for newer Netscapes (6+)
		    string: navigator.userAgent,
		    subString: "Netscape",
		    identity: "Netscape"
		},
		{
		    string: navigator.userAgent,
		    subString: "MSIE",
		    identity: "Explorer",
		    versionSearch: "MSIE"
		},
		{
		    string: navigator.userAgent,
		    subString: "Gecko",
		    identity: "Mozilla",
		    versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
		    string: navigator.userAgent,
		    subString: "Mozilla",
		    identity: "Netscape",
		    versionSearch: "Mozilla"
		}
	],
    dataOS: [
		{
		    string: navigator.platform,
		    subString: "Win",
		    identity: "Windows"
		},
		{
		    string: navigator.platform,
		    subString: "Mac",
		    identity: "Mac"
		},
		{
		    string: navigator.userAgent,
		    subString: "iPhone",
		    identity: "iPhone/iPod"
		},
		{
		    string: navigator.platform,
		    subString: "Linux",
		    identity: "Linux"
		}
	]

};
BrowserDetect.init();


