Selecting an element thro ID dynamically, please help

Selecting an element thro ID dynamically, please help

Hi Guys
 
I am relatively new to JQuery but well versed with JavaScript. I dont know how silly I would sound by asking thi squestion but here is my case. I have an HTML as below
====
<body>
 <table>
  <tr id="menurow">
   <td id="menu1" class="menuitem_unselected" >Home</td>
   <td id="menu2" class="menuitem_unselected" >Records</td>
   <td id="menu3" class="menuitem_unselected" >Trading</td>
   <td id="menu4" class="menuitem_unselected" >Market Research</td> 
  </tr>
</table>








<div id="menudiv1" class="hidediv"></div>
<div id="menudiv2" class="hidediv"></div>
<div id="menudiv3" class="hidediv"></div>
<div id="menudiv4" class="hidediv"></div>
</body>
=====




Now what I want to do is when I click on a cell with id "menu1" I want to show "menudiv1" and so on..
 
I have written following JQuery code for that and it doesnt work.
=========
$(document).ready
(
    function()
    {
        $('table td')
        .click
        (
            function()
            {
                $(this).addClass('menuitem_selected');
                var objid = $(this).attr("id");
                var divid = "menudiv"+objid.substr(objid.length-1,1); alert(divid);
                $(divid).addClass('showdiv');            }
        )
    }
)















=========
Can somebody guide me the right way if I am wrong here.
 
Any help is appreciated