﻿// Archivo JScript de menu

function cambiarInFooter(objeto)
{
    document.getElementById(objeto).className="enlaceFooterSeleccionado";
}

function cambiarOutFooter(objeto)
{
    document.getElementById(objeto).className="enlaceFooter";
}

function cambiarIn(objeto)
{
    document.getElementById(objeto).className="botonOverMenuPrincipal";
}
function cambiarOut(objeto)
{
    document.getElementById(objeto).className="botonMenuPrincipal";
}
function cambiarSeleccionado(objeto)
{
    document.getElementById(objeto).className="botonSeleccionadoMenuPrincipal";
}

function ir(ruta)
{
    document.getElementById("iframeContenido").src = ruta;
}
/*
var i = 0;
var tot = 4;
var seguirRollon = false;
var rollonFinal = false;
var temporizacion = 8000;
var ancho = 270;

function iniciarRollon()
{
    var contador = 0;
    var continuar = true;
    while(document.getElementById('rollingNoticias'+contador) != null)
    {
        contador++;
    }
    tot = contador;
    seguirRollon = true;
    self.setTimeout('rollonNews(' + i + ',' + tot + ')', temporizacion);
}

function rollonNews(idActual, total)
{
    if(!seguirRollon)
    {
        return;
    }
    
    seguirRollon = false;
    
    var idAux = idActual;
    if (total <= 3) 
    {
        return;
    }
    
    for (var cont = 0; cont < 4; cont++)
    {
        var div = document.getElementById('rollingNoticias'+idAux);
        var ultimo = (cont == 2);
        div.style.top=((cont)*100)+"px";
        if (cont == 3)
        {
            div.style.left = (-ancho) + "px";
            div.style.top=((cont-1)*100)+"px";
        }
        else
        {
            rollonNoticia(idAux, 100, 10, ultimo);
        }
        //
        idAux = (idAux+1)%total;   
    }
    i++;
    i = i % total;
    self.setTimeout('rollonNews(' + i + ',' + tot + ')', temporizacion);
}

function rollonNoticia(idNoticia, restante, paso, ultimo)
{
    var div = document.getElementById('rollingNoticias'+idNoticia);
    var x=(document.defaultView && document.defaultView.getComputedStyle) ?
    document.defaultView.getComputedStyle(div,'').getPropertyValue("top") :
    div.currentStyle ? div.currentStyle.top : "";
    
    x= parseInt(x);
    
    if (restante > paso)
    {
        div.style.top=(x-paso)+"px";
        restante = restante - paso;
    }
    else
    {
        div.style.top=(x-restante)+"px";
        restante = 0;
    }
    
    if (restante > 0)
    {
        self.setTimeout('rollonNoticia(' + idNoticia + ',' + restante + ',' + paso + ',' + ultimo + ')', 25);
    }
    else
    { 
        if (ultimo)
        {
            rollonFinal = true;
            rollonNoticiaLateral((idNoticia + 1) % tot, ancho, 10) 
        }
    }
    
    
}

function rollonNoticiaLateral(idNoticia, restante, paso)
{
    var div = document.getElementById('rollingNoticias'+idNoticia);
    
    var x=(document.defaultView && document.defaultView.getComputedStyle) ?
    document.defaultView.getComputedStyle(div,'').getPropertyValue("left") :
    div.currentStyle ? div.currentStyle.left : "";
    
    x= parseInt(x);
    if (restante > paso)
    {
        div.style.left=(x+paso)+"px";
        restante = restante - paso;
    }
    else
    {
        div.style.left=(x + restante)+"px";
        restante = 0;
    }
    
    if (restante > 0)
    {
        self.setTimeout('rollonNoticiaLateral(' + idNoticia + ',' + restante + ',' + paso + ')', 25);
    }
    else
    { 
        seguirRollon = true;
    }
}
*/
