Thanks Liorean that helps, but I still seem to be stuck
I also need to pass two arguments in the function call so I end up with something like this.
<td onclick="do_this('pic1',1)"> <img id="pic1" src""> </td>
<td onclick="do_this('pic2',2)"> <img id="pic2" src""> </td>
so the arguments are relative to the TD contents