Thanks for the guide. I thought I'll share something:
I had to find a way to collapse more than one element at the same time. Tried using the same ID for every element as you suggest but without luck - only the first one collapses. At the end I've added an empty collapse-triggering <A> tags for every additional element I need collapsed and chained their click events like this:
<a class="collapse" id="collapse_elem1" href="{vb:raw relpath}#top" onClick="document.getElementById('collapse_elem2') .click();"><img ...... /></a>
<a class="collapse" id="collapse_elem2" href="{vb:raw relpath}#top" onClick="document.getElementById('collapse_elem3') .click();"></a>
<a class="collapse" id="collapse_elem3" href="{vb:raw relpath}#top"></a>
Only the first <A> tag has the changing button image, the others are empty.
This way I was able to collapse the elements with IDs "elem1", "elem2" and "elem3" simultaneously.
Its not very elegant but does the trick