$(function() {
    var men = $('#topMenu');

    $('#topMenu > li > a').each(function(i) {
                                $(this).addClass('a'+i);
                                });

    men.clone().attr('id', 'topMenuHack').insertAfter(men);
    men = $('#topMenuHack');
    men.css('z-index', 1000);

    $('#topMenuHack > li').each(function(i) {
                                $(this).hover(function(){
                                                            $('#topMenu > li > .a'+i).addClass('hover');
                                                            $('#topMenuHack > li > .a'+i).addClass('hover');
                                                            $('#header').css('z-index', 1);
                                                            return false;
                                                        },
                                                        function(){
                                                            $('#topMenu > li > .a'+i).removeClass('hover');
                                                            $('#topMenuHack > li > .a'+i).removeClass('hover');
                                                            $('#header').css('z-index', 0);
                                                            return false;
                                                        });
                                });
    $('#topMenu > li > a').each(function(){
                                $(this).css('width', $(this).width()).html('&nbsp;');
                                });
    $('#topMenuHack').superfish({
        delay:       100,
        speed:       'fast',
        autoArrows:  false,
        dropShadows: false
    });
    $('<div id="activeIcon">&nbsp;</div>').appendTo('#topMenu li.active');
});