Styling multiple tables

Styling multiple tables

I have multiple tables with this similar structure:
  1.                    <table>
  2.                         <tr>
  3.                             <th>Transaction Date</th>
  4.                             <th>Description</th>
  5.                             <th>Points</th>
  6.                         </tr>
  7.                         <tr>
  8.                             <td>04/11/2011</td>
  9.                             <td>New account bonus</td>
  10.                             <td>100</td>
  11.                         </tr>
  12.                         <tr>
  13.                             <td>04/11/2011</td>
  14.                             <td>New account bonus</td>
  15.                             <td>100</td>
  16.                         </tr>
  17.                         <tr>
  18.                             <td>04/11/2011</td>
  19.                             <td>New account bonus</td>
  20.                             <td>100</td>
  21.                         </tr>
  22.                     </table>
I want to surround the central part of the table (not the th cells) with a border and have every other line starting with the first one below the table headers to be gray. Here are the styles I created
  1. .tabletop {
  2.     border-top:1px solid #818180;
  3. }
  4. .tablebottom {
  5.     border-bottom:1px solid #818180;
  6. }
  7. .tablemiddle {
  8.     border-right:1px solid #818180;
  9.     border-left:1px solid #818180;
  10. }
  11. .tablegray {
  12.     background-color:#dddddd;
  13. }
And this is the start of my jquery code

  1. $(document).ready(function() {
  2.     $("tr:has(td)").addClass("tablemiddle");
  3.     $("table tr:has(td):last").addClass("tablebottom");
  4.     $("table").each(function() {
  5.         $(this).children("tr:has(td):even").addClass("tablegray"); //this isn't working
  6.     });
  7. });
I'm trying to get it so that the top row under the header is gray. The above code isn't working and if I try this:
  1.                             $("tr:has(td):even").addClass("tablegray");
instead of the table.each it obviously grabs ALL of the rows on the page which means that sometimes the top row isn't gray.

Additionally, how do I select the first table row with td's in each table to apply tabletop?
And how to select the last row in each table? This doesn't work:
  1.                             $("table tr:has(td):last").addClass("tablebottom");
Thanks in advance for any help!