keeping alternating colors after sorting

keeping alternating colors after sorting

My table has alternating row coloring. It get's messed up after sorting (eg, instead of odd, even, odd I get something like even, even, odd, even, even...etc) I was trying to fix that with Zebra widget but gave up.

All I need to do is to call this simple function to http://www.sitepoint.com/article/backgr ... avascript/ , but I am not sure where. I tried putting into:
<body onload="....

It worked, however, only when document itself was reloaded, not after client-side sorting with tablesorter.

How to call this function from jQuery? Is it possible to add it to $(document).ready(function() call?