Multi-Tabbed Element within Themer Archive Page, Custom Layout Loop?

I am trying to create a multi-tabbed element in a Themer Archive Template using the Custom Layout HTML & CSS windows but can’t get it to work. I’m using a purely HTML and CSS tab design at the moment and have got the design replicating for each post but when I click a tab in any post all the post tab change. So I’m guessing that I would need to use Javascript to listen for a click event, then get the unique post id, then run a function passing in that Id.
Am I on the right track or is there better way?

Also I have tried various things using the built-in Archive Custom Layout area but can never get the Javascript to execute, where is the best place to put the JS script, I have tried putting the JS in the JS window in the tools menu with no luck.

Any help would be much appreciated.