(function($) {
    $.fn.getClassNames = function() {
        if(name = $(this).attr('className')) {
            return name.split(" ");
        } else {
            return [];
        }
    }

}) (jQuery);

(function($) {
    $(function() {
        //  hovering
        $('#tabholder td span').mouseover(function() {
            if($.inArray('last', $(this).getClassNames()) == -1 && $.inArray('active', $(this).getClassNames()) == -1) {
                $(this).parent().next().children('span').addClass('next');
                $(this).addClass('highlight');
                $(this).removeClass('reset');   // else ie stays highlighted
            }
        });
        $('#tabholder td span').mouseout(function() {
            if($.inArray('last', $(this).getClassNames()) == -1 && $.inArray('active', $(this).getClassNames()) == -1) {
                $(this).parent().next().children('span').removeClass('next');
                $(this).removeClass('highlight');
                $(this).addClass('reset');   // else ie stays highlighted
            }
        });
        
        //  on load
        $('td span').each(function() {
            if($.inArray('last', $(this).getClassNames()) != -1 || $.inArray('active', $(this).getClassNames()) != -1) {
                $(this).parent().next().children('span').addClass('next');
            }
        });
    });
}) (jQuery);

