I believe it gets easier with KO 2.1: you can use $index in the foreach loop to refer to the current index.
https://github.com/downloads/SteveSanderson/knockout/knockout-2.1.0.js
documentation: http://knockoutjs.com/documentation/binding-context.html