
function init_slide_menu(menu_id) {

    var items = 6;

    var szNormal = 64, szFull=125, szSmall  = (szNormal*15-szFull)/14;
    var hNormal = 64, hFull = 125, pFull=-62, pNormal=0;
     
    var menuitems = $$("#"+menu_id+" .item, #"+menu_id+" .item img");
    var fx = new Fx.Elements(menuitems, {wait: false, duration: 300, transition: Fx.Transitions.Back.easeOut});
    menuitems.each(function(menuitem, i) {
        menuitem.addEvent("mouseenter", function(event) {
            var o = {};
            if (menuitem.getTag() == 'a') {
                o[i] = {width: [menuitem.getStyle("width").toInt(), szFull], height: [menuitem.getStyle("height").toInt(), hFull], top: [menuitem.getStyle("top").toInt(), pFull]}
                menuitems.each(function(other, j) {
                    if(i != j && other.getParent() != menuitem) {
                        var w = other.getStyle("width").toInt();
                        if(w != szSmall) {
                            o[j] = {width: [w, szSmall], height: [other.getStyle("height").toInt(), hNormal], top: [other.getStyle("top").toInt(), pNormal]};
                            if (other.getElement('span.tagline')) {
                                other.getElement('span.tagline').style.display = "none";
                            }
                        }
                    } else if (other.getParent() == menuitem) {
                        o[j] = {width: [menuitem.getStyle("width").toInt(), szFull], height: [menuitem.getStyle("height").toInt(), hFull]}
                    } else {
                        if (other.getElement('span.tagline')) {
                            other.getElement('span.tagline').style.display = "inline";
                        }
                    }
                });
                fx.start(o);
            }
        });
    });
     
    $ES("#"+menu_id+" .item, #"+menu_id+" .item img").addEvent("mouseleave", function(event) {
        var o = {};
        menuitems.each(function(menuitem, i) {
            o[i] = {width: [menuitem.getStyle("width").toInt(), szNormal], height: [menuitem.getStyle("height").toInt(), hNormal], top: [menuitem.getStyle("top").toInt(), pNormal]}
            if (menuitem.getElement('span.tagline')) {
                menuitem.getElement('span.tagline').style.display = "none";
            }
        });
        fx.start(o);
    })

}

window.addEvent('domready',function() { init_slide_menu('inbox') });
