jQuery(document).ready( function( $){
    
    //css support
    $( '.chart>tbody>tr>td:last-child').css( 'border-right', '#000000 solid 1px');
    $( '.chart>tbody>tr:last-child>td').css( 'border-bottom', '#000000 solid 1px');
    
    
    //chenge cell color to hover cell
    $( '.chart td').hover(
        function(){
            var crrntObj    = $( this);
            var crrntNum    = ( crrntObj.prevAll().length) +1;
            
            //col
            crrntObj.siblings( 'td').css( 'background', '#ffffcc');
            crrntObj.siblings( 'th').css( 'background', '#ddf2f2');
            
            //row
            $( '.chart tr td:nth-child('+ crrntNum +')').css( 'background', '#ffffcc');
            $( '.chart tr.column_name th:nth-child('+ crrntNum+')').css( 'background', '#ddf2f2');
            
            crrntObj.css( 'background', '#ffcc66');
        },
        function(){
            $( '.chart tr, .chart td').css( 'background', 'none');
            $( '.chart th').css( 'background', '#F0F9F9');
        }
    );
    
    
    //don't linebrake at table cell
    $( '.comparing .chart').addClass( 'table_nowrap');
    
    
    $( '.chart_link .colorbox').colorbox({
        maxWidth: '650px'
    });
    
});
