﻿// Añadimos los efectos de la barra
window.addEvent('domready', function(){
    // Obtenemos todos los elementos de la clase mac
    var els = $$("a.mac");
    els.each(function(el) {
        // Siempre partimos de una medida fija
        el.setStyle('font-size', 16);
        el.set('tween', { duration: 125 });
        el.addEvent("mouseover", function() {
            el.tween('font-size', [el.getStyle('font-size').toInt(), 24]);
            // Por css es imposible establecer el color
            el.setStyle('color', 'white');
        } .bind(this));
        el.addEvent("mouseout", function() {
            el.tween('font-size', [el.getStyle('font-size').toInt(), 16]);
        } .bind(this));
    }, this);
});

// Cuando se acaba la carga hacemos desaparecer el banner de Cargando
window.addEvent("load", function () {$("divCargandoPagina").setStyle("display", "none");});

// Move an element directly on top of another element (and optionally
// make it the same size)
function Cover(bottom, top, ignoreSize) {
    var location = Sys.UI.DomElement.getLocation(bottom);
    top.style.position = 'absolute';
    top.style.top = location.y + 'px';
    top.style.left = location.x + 'px';
    if (!ignoreSize) {
        top.style.height = bottom.offsetHeight + 'px';
        top.style.width = bottom.offsetWidth + 'px';
    }
}

// Posiciona el wireframe en el control por el que posamos el ratón
function InicializarDetalle() {
    $get('imDetalle').src = $get('ctl00_cphGen_imgArticulo').src;
    Cover($get('ctl00_cphGen_imgArticulo'), $get('flyout'));
}

// Muestra el div de detalle del artículo
function MostrarDetalle() {
    Cover($get('flyout'), $get('info'), true);
}
