$(function(){
    var navTimers = [];
    $('.entityContextMenu').each(function() {
        var menu = $(this);
        var children = menu.children();
        if(children.length>1) {
            menu.before('<span class="entityContextMenuContainer"></span>');
            var container = menu.prev();
            container.prepend(menu);
            menu.before('<span class="entityContextMenuSymbol"></span>');
            menu.hide();
            


            var id = Math.floor(Math.random()*1000000);
            container.hover(function() {
                clearTimeout(navTimers[id]);
                navTimers[id] = setTimeout(function() {
                    var menuPossition = container.position();
                    menu.css({'position': 'absolute', 'left': Math.round(menuPossition.left)-20, 'top': Math.round(menuPossition.top)-35, 'background': 'white', 'color': 'black', 'font-weight': '300', 'font-size': '0.9286em', 'border': '#D3D3D3 1px solid', 'cursor': 'Auto', 'z-index': '1'});
                    menu.fadeIn('slow');
                }, 1);
            }, function() {
                clearTimeout(navTimers[id]);
                navTimers[id] = setTimeout(function() {
                    menu.fadeOut('normal')
                }, 350);
            });
        }
    });
    $('.icoSizable').each(function() {
        var image = $(this).find(":nth-child(1)");
        image.attr('src', image.attr('src').replace('16.png', '24.png'));
        image.attr('height', '24');
        image.attr('width', '24');
    });
});

