var cc = 18;
var ccb = 18;
var cc1 = 6;
var cc2 = 8;
var cc3 = 8;
var cc4 = 8;
var cc5 = 8;
var cc6 = 8;
var cc7 = 8;
var cc8 = 8;
var cc9 = 8;
var ccb1 = 6;
var ccb2 = 8;
var ccb3 = 8;
var ccb4 = 8;
var ccb5 = 8;
var ccb6 = 8;
var ccb7 = 8;
var ccb8 = 8;
var ccb9 = 8;
var tt = -9;
var tt1 = -3;
var tt2 = 0;
var tt3 = 18;
var tt4 = 36;
var tt5 = 54;
var tt6 = 72;
var tt7 = 90;
var tt8 = 108;
var tt9 = 126;
var ttG = 0;
var actual;
var actual2;
var vieja;
var vieja2;
var colorOld = 0;
var primera;
var donde = 0;
var RVA = new Array();
RVA[0] = ["74CE74", 42, 81, 41, "63A164", "fondo0.jpg", "3F6C40", "buho0.gif"];
RVA[1] = ["98B9E0", 0, 47, 95, "1A5DB0", "fondo1.jpg", "0D3C78", "buho1.gif"];
RVA[2] = ["58DCCD", 13, 88, 76, "60C7BB", "fondo2.jpg", "19665E", "buho2.gif"];
RVA[3] = ["009FEC", 0, 75, 120, "0987C4", "fondo3.jpg", "0D6997", "buho3.gif"];
RVA[4] = ["839FDF", 45, 54, 82, "8499CE", "fondo4.jpg", "404C6A", "buho4.gif"];
RVA[5] = ["BFACC5", 66, 55, 66, "A796AF", "fondo5.jpg", "5A4F5A", "buho5.gif"];
RVA[6] = ["D6EB68", 90, 120, 15, "BECC73", "fondo6.jpg", "7A8D17", "buho6.gif"];
RVA[7] = ["FFACB0", 128, 56, 62, "EEB0B3", "fondo7.jpg", "973E43", "buho7.gif"];
RVA[8] = ["FF9F5F", 123, 63, 31, "D18554", "fondo8.jpg", "95613A", "buho8.gif"];
RVA[9] = ["D1C66C", 83, 76, 37, "A29B5D", "fondo9.jpg", "6E673A", "buho9.gif"];
var cambios = new Array();
cambios[0] = ["#213D20", "#2A5129", "#3F6C40", "#74CE74", "images/menu_on1.jpg", "#2B512A", "images/bg_submenu_on0.jpg", "images/bg_sub_sub_0_off.gif", "images/bg_sub_sub_0.gif"];
cambios[1] = ["#082A5E", "#002F5F", "#0D3C78", "#98B9E0", "images/menu_on1.jpg", "#0d3c78", "images/bg_submenu_on1.jpg", "images/bg_sub_sub_1_off.gif", "images/bg_sub_sub_1.gif"];
cambios[2] = ["#0C3734", "#0D504C", "#19665E", "#58DCCD", "images/menu_on2.jpg", "#0E4E4D", "images/bg_submenu_on2.jpg", "images/bg_sub_sub_2_off.gif", "images/bg_sub_sub_2.gif"];
cambios[3] = ["#0B3A56", "#0B3A56", "#0D6997", "#009FEC", "images/menu_on3.jpg", "#014B7A", "images/bg_submenu_on3.jpg", "images/bg_sub_sub_3_off.gif", "images/bg_sub_sub_3.gif"];
cambios[4] = ["#202535", "#2D3652", "#404C6A", "#839FDF", "images/menu_on4.jpg", "#2F3653", "images/bg_submenu_on4.jpg", "images/bg_sub_sub_4_off.gif", "images/bg_sub_sub_4.gif"];
cambios[5] = ["#433943", "#423742", "#563E6C", "#BFACC5", "images/menu_on5.jpg", "#3F2854", "images/bg_submenu_on5.jpg", "images/bg_sub_sub_5_off.gif", "images/bg_sub_sub_5.gif"];
cambios[6] = ["#003300", "#336600", "#667A17", "#D6EB68", "images/menu_on0.jpg", "#5C7811", "images/bg_submenu_on6.jpg", "images/bg_sub_sub_6_off.gif", "images/bg_sub_sub_6.gif"];
cambios[7] = ["#471D21", "#80383E", "#973E43", "#FFACB0", "images/menu_on7.jpg", "#81393D", "images/bg_submenu_on7.jpg", "images/bg_sub_sub_7_off.gif", "images/bg_sub_sub_7.gif"];
cambios[8] = ["#402211", "#7B3F1F", "#95613A", "#FF9F5F", "images/menu_on8.jpg", "#7B3E1F", "images/bg_submenu_on8.jpg", "images/bg_sub_sub_8_off.gif", "images/bg_sub_sub_8.gif"];
cambios[9] = ["#272411", "#272411", "#6E673A", "#D1C66C", "images/menu_on9.jpg", "#544C25", "images/bg_submenu_on9.jpg", "images/bg_sub_sub_9_off.gif", "images/bg_sub_sub_9.gif"];

function abre(a) {
    vieja = actual;
    actual = a;
    primera = 1;
    var l = document.location.href.toString();
    var ls = l.lastIndexOf("/");
    var st = l.substring(ls + 1, l.length);
    if (st == "index.asp" || st == "") {
        if (document.all) {
            document.styleSheets[0].rules[1].style.color = cambios[actual][0];
            document.styleSheets[0].rules[2].style.color = cambios[actual][1];
            document.styleSheets[0].rules[3].style.color = cambios[actual][2];
            document.styleSheets[0].rules[4].style.color = cambios[actual][2];
            document.styleSheets[0].rules[5].style.color = cambios[actual][2];
            document.styleSheets[0].rules[6].style.background = cambios[actual][3];
            document.styleSheets[1].rules[0].style.background = cambios[actual][3];
            document.styleSheets[0].rules[7].style.background = cambios[actual][5] + " url(/" + cambios[actual][4] + ") no-repeat";
            document.styleSheets[0].rules[8].style.background = cambios[actual][2];
            document.styleSheets[0].rules[9].style.background = "url(/" + cambios[actual][6] + ") no-repeat";
            document.styleSheets[0].rules[10].style.background = "url(/" + cambios[actual][7] + ") bottom left no-repeat";
            document.styleSheets[0].rules[11].style.background = cambios[actual][3] + " url(/" + cambios[actual][8] + ")  bottom left  no-repeat";
            document.styleSheets[0].rules[13].style.color = cambios[actual][2];
            document.styleSheets[0].rules[14].style.color = cambios[actual][2];
            document.styleSheets[0].rules[15].style.color = cambios[actual][1];
        }
        else {
            document.styleSheets[0].cssRules[1].style.color = cambios[actual][0];
            document.styleSheets[0].cssRules[2].style.color = cambios[actual][1];
            document.styleSheets[0].cssRules[3].style.color = cambios[actual][2];
            document.styleSheets[0].cssRules[4].style.color = cambios[actual][2];
            document.styleSheets[0].cssRules[5].style.color = cambios[actual][2];
            document.styleSheets[0].cssRules[6].style.background = cambios[actual][3];
            document.styleSheets[1].cssRules[0].style.background = cambios[actual][3];
            document.styleSheets[0].cssRules[7].style.background = cambios[actual][5] + " url(/" + cambios[actual][4] + ") no-repeat";
            document.styleSheets[0].cssRules[8].style.background = cambios[actual][2];
            document.styleSheets[0].cssRules[9].style.background = "url(/" + cambios[actual][6] + ") no-repeat";
            document.styleSheets[0].cssRules[10].style.background = "url(/" + cambios[actual][7] + ") bottom left no-repeat";
            document.styleSheets[0].cssRules[11].style.background = cambios[actual][3] + " url(/" + cambios[actual][8] + ")  bottom left  no-repeat";
            document.styleSheets[0].cssRules[13].style.color = cambios[actual][2];
            document.styleSheets[0].cssRules[14].style.color = cambios[actual][2];
            document.styleSheets[0].cssRules[15].style.color = cambios[actual][1];
        }
    }
    else {
        if (donde == 0) {
            if (document.all) {
                document.styleSheets[0].rules[1].style.color = cambios[actual][0];
                document.styleSheets[0].rules[2].style.color = cambios[actual][1];
                document.styleSheets[0].rules[3].style.color = cambios[actual][2];
                document.styleSheets[0].rules[4].style.color = cambios[actual][2];
                document.styleSheets[0].rules[5].style.color = cambios[actual][2];
                document.styleSheets[0].rules[6].style.background = cambios[actual][3];
                document.styleSheets[1].rules[0].style.background = cambios[actual][3];
                document.styleSheets[0].rules[7].style.background = cambios[actual][5] + " url(/" + cambios[actual][4] + ") no-repeat";
                document.styleSheets[0].rules[8].style.background = cambios[actual][2];
                document.styleSheets[0].rules[9].style.background = "url(/" + cambios[actual][6] + ") no-repeat";
                document.styleSheets[0].rules[10].style.background = "url(/" + cambios[actual][7] + ") bottom left no-repeat";
                document.styleSheets[0].rules[11].style.background = cambios[actual][3] + " url(/" + cambios[actual][8] + ")  bottom left  no-repeat";
                document.styleSheets[0].rules[13].style.color = cambios[actual][2];
                document.styleSheets[0].rules[14].style.color = cambios[actual][2];
                document.styleSheets[0].rules[15].style.color = cambios[actual][1];
            }
            else {
                document.styleSheets[0].cssRules[1].style.color = cambios[actual][0];
                document.styleSheets[0].cssRules[2].style.color = cambios[actual][1];
                document.styleSheets[0].cssRules[3].style.color = cambios[actual][2];
                document.styleSheets[0].cssRules[4].style.color = cambios[actual][2];
                document.styleSheets[0].cssRules[5].style.color = cambios[actual][2];
                document.styleSheets[0].cssRules[6].style.background = cambios[actual][3];
                document.styleSheets[1].cssRules[0].style.background = cambios[actual][3];
                document.styleSheets[0].cssRules[7].style.background = cambios[actual][5] + " url(/" + cambios[actual][4] + ") no-repeat";
                document.styleSheets[0].cssRules[8].style.background = cambios[actual][2];
                document.styleSheets[0].cssRules[9].style.background = "url(/" + cambios[actual][6] + ") no-repeat";
                document.styleSheets[0].cssRules[10].style.background = "url(/" + cambios[actual][7] + ") bottom left no-repeat";
                document.styleSheets[0].cssRules[11].style.background = cambios[actual][3] + " url(/" + cambios[actual][8] + ")  bottom left  no-repeat";
                document.styleSheets[0].cssRules[13].style.color = cambios[actual][2];
                document.styleSheets[0].cssRules[14].style.color = cambios[actual][2];
                document.styleSheets[0].cssRules[15].style.color = cambios[actual][1];
            }
            donde = 1;
        }
    }
    if (vieja != undefined) {
        vuelve0();
    }
    else {
        mueve0();
    }
    colorfade();
}
function mueve0() {
    if (cc > 0) {
        tt += cc;
        document.getElementById("sm" + actual + "0").style.left = tt + "px";
        cc--;
        setTimeout("mueve0()", 5);
    }
    else {
        cc = 18;
        tt = -9;
        mueve1();
        return false;
    }
}
function mueve1() {
    if (cc1 > 0) {
        tt1 += cc1;
        document.getElementById("sm" + actual + "1").style.top = tt1 + "px";
        cc1--;
        setTimeout("mueve1()", 5);
    }
    else {
        cc1 = 6;
        tt1 = -3;
        mueve2();
        return false;
    }
}
function mueve2() {
    if (cc2 > 0) {
        tt2 += cc2;
        document.getElementById("sm" + actual + "2").style.top = tt2 + "px";
        cc2--;
        setTimeout("mueve2()", 5);
    }
    else {
        cc2 = 8;
        tt2 = 0;
        mueve3();
        return false;
    }
}
function mueve3() {
    if (cc3 > 0) {
        tt3 += cc3;
        document.getElementById("sm" + actual + "3").style.top = tt3 + "px";
        cc3--;
        setTimeout("mueve3()", 5);
    }
    else {
        cc3 = 8;
        tt3 = 18;
        mueve4();
        return false;
    }
}
function mueve4() {
    if (cc4 > 0) {
        tt4 += cc4;
        document.getElementById("sm" + actual + "4").style.top = tt4 + "px";
        cc4--;
        setTimeout("mueve4()", 5);
    }
    else {
        cc4 = 8;
        tt4 = 36;
        mueve5();
        return false;
    }
}
function mueve5() {
    if (cc5 > 0) {
        tt5 += cc5;
        document.getElementById("sm" + actual + "5").style.top = tt5 + "px";
        cc5--;
        setTimeout("mueve5()", 5);
    }
    else {
        cc5 = 8;
        tt5 = 54;
        mueve6();
        return false;
    }
}
function mueve6() {
    if (cc6 > 0) {
        tt6 += cc6;
        document.getElementById("sm" + actual + "6").style.top = tt6 + "px";
        cc6--;
        setTimeout("mueve6()", 5);
    }
    else {
        cc6 = 8;
        tt6 = 72;
        mueve7();
        return false;
    }
}
function mueve7() {
    if (cc7 > 0) {
        tt7 += cc7;
        document.getElementById("sm" + actual + "7").style.top = tt7 + "px";
        cc7--;
        setTimeout("mueve7()", 5);
    }
    else {
        cc7 = 8;
        tt7 = 90;
        mueve8();
        return false;
    }
}
function mueve8() {
    if (cc8 > 0) {
        tt8 += cc8;
        document.getElementById("sm" + actual + "8").style.top = tt8 + "px";
        cc8--;
        setTimeout("mueve8()", 5);
    }
    else {
        cc8 = 8;
        tt8 = 108;
        mueve9();
        return false;
    }
}
function mueve9() {
    if (cc9 > 0) {
        tt9 += cc9;
        document.getElementById("sm" + actual + "9").style.top = tt9 + "px";
        cc9--;
        setTimeout("mueve9()", 5);
    }
    else {
        cc9 = 8;
        tt9 = 126;
        return false;
    }
}
function vuelve0() {
    if (vieja != undefined) {
        document.getElementById("sm" + vieja + "0").style.left = "-330px";
        //document.getElementById("sm"+vieja+"0").style.background="#"+RVA[vieja][6];	
        //document.getElementById("sm"+vieja+"0").style.color="#fff";	
        for (var i = 1; i < 10; i++) {
            document.getElementById("sm" + vieja + i).style.top = "-18px";
            //document.getElementById("sm"+vieja+i).style.background="#"+RVA[vieja][6];	
            //document.getElementById("sm"+vieja+i).style.color="#fff";	
        }
        mueve0();
    }
    else {
        mueve0();
    }
}
function rebote() {
    if (vieja2 != undefined) {
        vuelve20();
    }
}
function marca(a, b) {
    abre(a);
    document.getElementById("sm" + a + b).style.background = cambios[a][3];
    document.getElementById("sm" + a + b).style.color = "#000";
}
function marcaSM(a) {
    document.getElementById("mi" + a).style.background = cambios[actual][5] + " url(/" + cambios[actual][4] + ") no-repeat";
    document.getElementById("mi" + a).style.padding = "2px 0 6px 10px";
    document.getElementById("mi" + a).style.width = "134px";
    document.getElementById("mi" + a).style.color = "#fff";
}
function color(a) {
    color = a;
    colorfade();
}
var ccC = 17;
var el = 0;
var b = 255;
var c = 255;
var d = 255;
function colorfade() {
    document.getElementById("cabecero").style.backgroundColor = cambios[actual][5];
    document.getElementById("cabecero").style.backgroundImage = "url(/images/" + RVA[actual][5] + ")";
    document.getElementById("logo").style.backgroundImage = "url(/images/" + RVA[actual][7] + ")";
    // Animates until cc >0. It's an animation in 20 steps. Note that cc was initialized with 20. 
    if (ccC > 0) {
        if (b > RVA[actual][1]) {
            b -= 15;
        } else { b = b; }
        if (c > RVA[actual][2]) {
            c -= 15;
        } else { c = c; }
        if (d > RVA[actual][3]) {
            d -= 15;
        } else { d = d; }
        // Sets the color value. 
        for (var i = 0; i < 10; i++) {
            if (i == actual) {
                document.getElementById("m" + i).style.background = "#" + RVA[actual][0] + " url(/images/flecha_negra.gif) 8px 3px no-repeat";
                document.getElementById("m" + i).style.color = "#000";
                document.getElementById("m" + i).style.borderColor = "#" + RVA[actual][4];
            }
            else {

                document.getElementById("m" + i).style.background = "url(/images/flecha_blanca.gif) 8px 3px no-repeat";
                document.getElementById("m" + i).style.borderColor = "#" + RVA[actual][4];
                document.getElementById("m" + i).style.backgroundColor = "rgb(" + b + "," + c + "," + d + ")";
                document.getElementById("m" + i).style.color = "#fff";
                document.getElementById("m" + i).style.borderColor = "#" + RVA[actual][4];
            }

        }

        // Decreases the animation counter. 
        ccC--;

        // Call colorfade again...
        setTimeout("colorfade()", 1);

    } else {
        // Reset all animation parameters except the el index. 
        ccC = 17;
        b = 255;
        c = 255;
        d = 255;

        // Call again the colorfade procedure increasing the el index until all 
        // elements (see HTML section bellow) are animated. The last element animated
        // is the sixth element. 
    }
}
function MM_preloadImages() { //v3.0
    var d = document; if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } 
    }
}
function display(a) {
    // funcion para desplegar submenus de la izquierda	
    for (var i = 0; i < 5000; i++) {
        if (document.getElementById("dp" + i)) {
            if (i == a) {
                document.getElementById("dp" + i).style.display = "block";
            }
            else {
                document.getElementById("dp" + i).style.display = "none";
            }
            //else{i=i}
        }
    }
}
function pintaMI(a) {
    // funcion para pintar el menu de la izquierda	
    for (var i = 0; i < 5000; i++) {
        if (document.getElementById("mi" + i)) {
            if (i == a) {
                document.getElementById("mi" + i).style.background = "#fff url(/" + cambios[actual][6] + ")  no-repeat";
                document.getElementById("mi" + i).style.padding = "4px 0 6px 13px";
            }
            else {
                document.getElementById("mi" + i).style.background = "#fff url(/images/bg_submenu.jpg) repeat-x";
                document.getElementById("mi" + i).style.padding = "4px 0 6px 5px";
            }
        }
        //else{i=i}
    }
}
function pintaSMI(a) {
    // funcion para pintar un desplegable de la izquierda
    document.getElementById("smi" + a).style.background = cambios[actual][3] + " url(/" + cambios[actual][8] + ")  bottom left  no-repeat";
    document.getElementById("smi" + a).style.color = "#fff";
}
function pintaMD(a) {
    document.getElementById("smd" + a).style.backgroundColor = "#BFBFBF";
}
function noticia(a) {
    
    if (a == 0) { //2005
        document.getElementById("not2").innerHTML = noti[0][2];
        document.getElementById("not0").innerHTML = noti[1][0];
        document.getElementById("not1").innerHTML = noti[2][1];

        document.getElementById("noticias_ahora").style.display = "none";
        document.getElementById("noticias_anterior").style.display = "none";
        document.getElementById("noticias_ant_ant").style.display = "block";
        

    }
    else if (a == 1) { //2006
        document.getElementById("not2").innerHTML = noti[1][2];
        document.getElementById("not0").innerHTML = noti[0][0];
        document.getElementById("not1").innerHTML = noti[2][1];

        document.getElementById("noticias_ahora").style.display = "none";
        document.getElementById("noticias_anterior").style.display = "block";
        document.getElementById("noticias_ant_ant").style.display = "none";

    }
    else if (a == 2) { //2007
        document.getElementById("not2").innerHTML = noti[2][2];
        document.getElementById("not0").innerHTML = noti[0][0];
        document.getElementById("not1").innerHTML = noti[1][1];

        document.getElementById("noticias_ahora").style.display = "block";
        document.getElementById("noticias_anterior").style.display = "none";
        document.getElementById("noticias_ant_ant").style.display = "none";

    }
}


function marcaRevista(a) {
    document.getElementById("smi" + a).style.background = "#009FEC url(/" + cambios[actual][8] + ")  bottom left  no-repeat";
    document.getElementById("smi" + a).style.color = "#fff";
}
function menuIzda(a) {
    for (var i = 0; i < sm; i++) {
        if (i == a) {
            document.getElementById("mi" + i).style.background = cambios[actual][5] + " url(/" + cambios[actual][4] + ") no-repeat";
            document.getElementById("mi" + i).style.padding = "2px 0 6px 10px";
            document.getElementById("mi" + i).style.width = "134px";
            document.getElementById("mi" + i).style.color = "#fff";
        }
        else {
            document.getElementById("mi" + i).style.background = "#fff url(/images/bg_submenu_celog.jpg) repeat-x";
            document.getElementById("mi" + i).style.padding = "2px 0 6px 10px";
            document.getElementById("mi" + i).style.width = "134px";
            document.getElementById("mi" + i).style.color = "#000";
        }
    }
}
function virtualTxt(a) {
    for (var i = 0; i < 3; i++) {
        if (a == i) {
            document.getElementById("txtVirt" + i).style.visibility = "visible";
        }
        else {
            document.getElementById("txtVirt" + i).style.visibility = "hidden";
        }
    }
}
var valor = 0.7;
function aumenta() {
    valor = valor + 0.2;
    document.body.style.fontSize = valor + "em";
}
function disminuye() {
    if (valor > 0.1) {
        valor = valor - 0.2;
        document.body.style.fontSize = valor + "em";
    }
    else { }
}
function aOriginal() {
    valor = 0.7;
    document.body.style.fontSize = valor + "em";
}
function abrir(a, b, c, d) {
    if (document.all) { var ventanaW = document.body.clientWidth; }
    else { var ventanaW = window.innerWidth }
    if (document.all) { var ventanaH = document.body.clientHeight + 150; }
    else { var ventanaH = window.innerHeight }
    var w = ventanaW / 2;
    w = w - (b / 2);
    var h = ventanaH / 2;
    h = h - (c / 2);
    window.open(a, 'mapa', 'width=' + b + ', height=' + c + ', top=' + h + ',left=' + w + ', scrollbars=' + d + ', location=0');
}


function mail(nombre, dominio) {
    var res1 = "";
    var res2 = "";
    var mail = "";

    for (var n = 0; n < nombre.length; n++)
        res1 += String.fromCharCode(nombre.charCodeAt(n));

    for (var n = 0; n < dominio.length; n++)
        res2 += String.fromCharCode(dominio.charCodeAt(n));

    if (res1.indexOf('@') < 0 && res2.indexOf('@') < 0)
        mail = res1 + '@' + res2;

    location = "mail" + "to:" + mail;
}
