/*global jQuery, document, window */
(function($) {

    $(document).ready(function() {
         if ( !($.browser.msie) || parseInt($.browser.version, 10) > 7 ) { return; }

         $("div.layer.menu div.cell").each(function(index) {
            var cell_height = $(this).height();
            var cell_width = $(this).width();
            $(this).find(".title").each(function(index) {
                // Make the link title absolutely positioned, center it manually
                $(this).css('position','absolute')
                       .css('top','0px').css('left','0px')
                       .css('padding','0px')
                       .css('display','block')
                       ;
                // If text, force the width to be cell minus padding value, otherwise image and a mysterious fudge factor
                var item_width = $(this)[0].tagName == 'SPAN' ? (cell_width-20) : $(this).width()+6;
                if($(this)[0].tagName == 'SPAN') $(this).css('width',item_width+'px')

                $(this).css('top',((cell_height-$(this).height())/2)+'px')
                $(this).css('left',((cell_width-item_width)/2)+'px')
           });
        });
    });

}(jQuery));

