$(function () {

    $( ".main_page table" ).each( function ( i, table ) {
    
        if ( $( table ).hasClass("no-js-style") )
            return;
    
        $( table ).addClass("highlight-table");
        $( table ).attr("border", "0");
        $( table ).attr("width", "100%");
        var headerRows = 1;
        $( "tr" , table ).each( function ( i, tr ) {
         
            if ( headerRows > 0 && $( "td[rowspan]", tr ).length != 0 )
            {
                var maxRows = -1;
                $( "td[rowspan]", tr ).each( function ( i, td ) {
                    if ( maxRows == -1 || maxRows < $( td ).attr("rowspan") )
                    {
                        maxRows = $( td ).attr("rowspan");
                    }
                });
                
                if ( headerRows < maxRows )
                {
                    headerRows = maxRows;
                }
            }
            
            if ( headerRows > 0  )
            {
                $( tr ).addClass("highlight-header");
            }
            else if ( headerRows % 2 != 0 )
            {
                $( tr ).addClass("highlight-even");
            }
            
            headerRows--;
        });
    });

});