$(document).ready( function() {
    $('#route-tabs > ul').tabs();

    /* Auto-hiding expired rate rows */
    var right_now = new Date().getTime();
    $('td.datecol').each(function(){
        var year = $(this).attr('rel');
        var td_index = $(this).prevAll().length; // Determine which column we're in

        // Get parent row, then all next rows
        $(this).parent().nextAll().each(function(){ 
            var curr_date = $(this).find('td').eq(td_index).text();
            curr_date = Date.parse(curr_date.replace(/\*/, '') + ' ' + year);
            if(curr_date < right_now) {
                $(this).hide();
            }
        });
    });
});

function toggleRoute( show_id )
{
	$('a#link' + show_id).addClass('active').siblings().removeClass('active');
    $('a#link' + show_id).parent().parent().find('div.routeblock').hide();
	$('#' + show_id).show();
}

/* Rates/dates table -- from client */
function mouse_event(obj, newClass) {
    obj.className = newClass;
}

