﻿// Archivo JScript

function cambiapestana_portada(id)
{
    if(id==1)
    {
        document.getElementById("divportadanoticias").style.display="";
        document.getElementById("divtitulomasnoticias").className="titulotabportada titulotabportadasel";
       }
    else
    {
        document.getElementById("divportadanoticias").style.display="none";
        document.getElementById("divtitulomasnoticias").className="titulotabportada";
        
    }
    if(id==2)
    {
        document.getElementById("divimprescindibles").style.display="";
        document.getElementById("divtituloimprescindibles").className="titulotabportada titulotabportadasel";
       }
    else
    {
        document.getElementById("divimprescindibles").style.display="none";
        document.getElementById("divtituloimprescindibles").className="titulotabportada";
       }
    if(id==3)
    {
        document.getElementById("divmuyconfidencial").style.display="";
        document.getElementById("divtituloconfidencial").className="titulotabportada titulotabportadasel";
     }
    else
    {
        document.getElementById("divmuyconfidencial").style.display="none";
        document.getElementById("divtituloconfidencial").className="titulotabportada";
    }
     
       
}


function compruebaPaginacionFicha()
{
    var paginacion;
    paginacion=0;
    longitud = document.getElementById("fichanoticia").style.marginTop.substring(0,document.getElementById("fichanoticia").style.marginTop.length-2);
    if (longitud<0)
    {
        document.getElementById("paginacionanteriorficha").style.display='';
        paginacion=1;
    }
    else
        document.getElementById("paginacionanteriorficha").style.display='none';
        
    if (document.getElementById("padreNoticia").scrollHeight>2060)
    {
        document.getElementById("paginacionsiguienteficha").style.display='';
        paginacion=1;
    }
    else
        document.getElementById("paginacionsiguienteficha").style.display='none';
                
	if(paginacion==1)
	{
	    document.getElementById("divpaginacion").style.display='block';
	 }
	 
}

function paginaSiguienteFicha()
{
    var longitud;
    longitud = document.getElementById("fichanoticia").style.marginTop.substring(0,document.getElementById("fichanoticia").style.marginTop.length-2);
    if(document.getElementById("padreNoticia").scrollHeight<2060)
        return;
    document.getElementById("fichanoticia").style.marginTop=(longitud - 2060) + "px";
    compruebaPaginacionFicha();
    location.hash = "top";
}

function paginaAnteriorFicha()
{
    var longitud;
    
    longitud = document.getElementById("fichanoticia").style.marginTop.substring(0,document.getElementById("fichanoticia").style.marginTop.length-2);
    if (longitud == 0)
        return ;
    document.getElementById("fichanoticia").style.marginTop=(parseInt(longitud) + 2060) + "px";
    compruebaPaginacionFicha();
    location.hash = "top";
}

function colocatextoficha(objeto)
{
    var longitud=0;
    if (document.getElementById("fichanoticia").offsetTop==0)
        longitud=objeto.offsetTop;
    else
        longitud=objeto.offsetTop-document.getElementById("fichanoticia").offsetTop;
    
    objeto.style.marginTop = 5 + parseInt(longitud % 19) +"px";

}

function ampliaimagen(ruta,ancho,alto,piefoto)
{

    var sfunction = 'cargaimagen(\'' + ruta + '\',' + ancho + ',' + alto + ',\'' + piefoto + '\')';
    tiempo=setTimeout(sfunction,80); 

}

function cargaimagen(ruta,ancho,alto,piefoto)
{
   document.getElementById("imagenampliada").src=ruta;
   document.getElementById("imagenampliada").style.display='none';
                 
   if(ancho>alto)
   {
       document.getElementById("imagenampliada").style.width='500px';
       document.getElementById("imagenampliada").style.height='';
   }
   else
   {
       document.getElementById("imagenampliada").style.width='';
       document.getElementById("imagenampliada").style.height='500px';
   }
   document.getElementById("piefoto").innerHTML = piefoto;        
   tiempo=setTimeout('recolocaimagen()',80);  
}

function recolocaimagen()
{
    document.getElementById("imagenampliada").style.display='';
    document.getElementById("imagenampliada").style.marginTop=((550-parseInt(document.getElementById("imagenampliada").clientHeight))/2) + "px";
}



function colocaagenda(dia,mes)
{
    document.getElementById("ctl00_ContentPlaceHolder1_Objdiasagenda1_col"+dia+"_"+mes).className ="diaseleccionadoagenda"
}

function seldia(dia,mes,ano,div)
{
    document.getElementById("ctl00_ContentPlaceHolder1_Objdiasagenda1_txtdiasel").value = dia+"/"+mes+"/"+ano;
    document.getElementById("ctl00_ContentPlaceHolder1_Objdiasagenda1_txtdivsel").value = div;
    document.getElementById("aspnetForm").submit();
}

function selvideo(id)
{
    document.getElementById("ctl00_ContentPlaceHolder1_Objvideoportada1_divvideo").innerHTML = listavideos[id];
    document.getElementById("ctl00_ContentPlaceHolder1_Objvideoportada1_lbltitulo").innerHTML = listapievideos[id];
}

function compruebaPaginacionCorporativa()
{
    var paginacion;
    paginacion=0;
    longitud = document.getElementById("fichanoticia").style.marginTop.substring(0,document.getElementById("fichanoticia").style.marginTop.length-2);
    if (longitud<0)
    {
        document.getElementById("paginacionanteriorficha").style.display='';
        paginacion=1;
    }
    else
        document.getElementById("paginacionanteriorficha").style.display='none';
        
    if (document.getElementById("padreNoticia").scrollHeight>1300)
    {
        document.getElementById("paginacionsiguienteficha").style.display='';
        paginacion=1;
    }
    else
        document.getElementById("paginacionsiguienteficha").style.display='none';
                
	if(paginacion==1)
	{
	    document.getElementById("divpaginacion").style.display='block';
	 }
	 
}

function paginaSiguienteCorporativa()
{
    var longitud;
    longitud = document.getElementById("fichanoticia").style.marginTop.substring(0,document.getElementById("fichanoticia").style.marginTop.length-2);
    if(document.getElementById("padreNoticia").scrollHeight<1300)
        return;
    document.getElementById("fichanoticia").style.marginTop=(longitud - 1300) + "px";
    compruebaPaginacionCorporativa();
    location.hash = "top";
}

function paginaAnteriorCorporativa()
{
    var longitud;
    
    longitud = document.getElementById("fichanoticia").style.marginTop.substring(0,document.getElementById("fichanoticia").style.marginTop.length-2);
    if (longitud == 0)
        return ;
    document.getElementById("fichanoticia").style.marginTop=(parseInt(longitud) + 1300) + "px";
    compruebaPaginacionCorporativa();
    location.hash = "top";
}
