Could someone simplify the JavaScript in this page: http://neatoincognito.com/sheet-simple.html

The problem is when I expand this format, the JavaScript really gets out of hand, as you can see in this page: http://neatoincognito.com/sheet-complex.html

I am super bad at JavaScript so any help would be much appreciated!!