Parameterize and factor out the JS.
Factor the td id generation. Get rid of the per-cell object.
Make use of sparse arrays. Minor JSLint cleanup.
JSLint-clean.