
function menu(){

}

menu.prototype.init = function(){
    $('.menu li').hover(
        function(e){
            var max = 111;
            $(this).children('ul').children('li').each(
                function(){
                    if(max < $(this).width()) max = $(this).width();
                }
            )
            $(this).children('ul').children('li').each(
                function(){
                    $(this).css({width:max+'px'});
                }
            )


            $(this).children('ul').css({visibility: 'visible'});
        },
        function(e){
            $(this).children('ul').css({visibility: 'hidden'});
        }
    )
    
    $('.menu > li > ul').each(
        function(){
            var elementOffs = $(this).parent('li').offset();
            var height      = $(this).parent('li').height();
            $(this).css({left: elementOffs.left+"px", top: elementOffs.top+height+"px"});
        }
    )
}    

$(function(){
    var mnu = new menu();
    mnu.init();
})

