How to show/hide the image on clicking the hyperlink?
Use the .css() jQuery manipulators, or better yet just call .show()/.hide() on the image once you've obtained a handle to it (e.g. $('#img' + id)).
$('#img' + id)
BTW, you should not write javascript handlers with the "javascript:" prefix.