﻿var ElIndice1 = -1;
var delayer = 800;


function MostrarUL(nomm) {
    OcultarOtras();
    $(nomm).addClass("menuHOn");
    var nn = nomm.replace("h2", "");
    if ($defined($(nn))) { $(nn).style.display = "block"; }
}

function OcultarOtras() {
    var nomm;
    for (var i = 1; i <= 4; i++) {
        var nomm = "ulHome" + i;
        if ($defined($(nomm))) { $(nomm).style.display = "none"; }
        $("h2ulHome" + i).removeClass("menuHOn");
    }
}

function PonerEventos() {
    var HH2 = $$("#elFlashHome h2");
    HH2.each(function(opcion, indice) {
        opcion.addEvent("mouseover", function() { MostrarUL(opcion.id) });
    });
}


function AutoImagenes() {
    var Opciones = $$('#divULCustomersHome li');

    var MiScroller = new Fx.Scroll('divULCustomersHome', {
        wait: false,
        duration: 400,
        transition: Fx.Transitions.Quad.easeInOut
    });

    ElIndice1 = ElIndice1 + 1;
    if (ElIndice1*2 >= Opciones.length) { ElIndice1 = 0; }

    var marginChange = new Fx.Style('divULCustomersHome', 'margin-top', { duration: delayer });
    marginChange.start(-148 * ElIndice1);
    
    
}

window.addEvent('domready', function() {
    if ($defined($("elFlashHome"))) {
        PonerEventos();
    }
    if ($defined($("divULCustomersHome"))) {
        myTimer = AutoImagenes.periodical(4000);
    }
    

});
