Edit in JSFiddle

var log = $('log');
var log2 = $('log2');

var els = $$('li');
els.addEvent('click',function(){
    log.set('text', 'index of collection: ' + els.indexOf(this));
    log2.set('text', 'index of matched collection: ' + $$('li.other').indexOf(this));
});
<ul id="foo">
    <li class="other">Beef Jerky</li>
    <li>Smoked Salmon</li>
    <li class="other">Rocky Mountain Oysters</li>
    <li class="other">Beef Jerky</li>
    <li>Smoked Salmon</li>
    <li class="other">Rocky Mountain Oysters</li>
</ul>
<h1 id="log">index of collection: waiting ...</h1>
<h1 id="log2">index of matched collection: waiting ...</h1>