Cleaning code before new big feature

Cleaning code:
- removed extra commas
- declared missed variables
- formatted text
- prepared for minification
- closed scope
- fixed most bugs reported by JSLint, JSHint

It works minified by yuicompresor ( from https://github.com/tml/yuicompressor fork which can minify JavaScript 1.7 correctly)

Coming feature: extruding with transformation. Demo is available at http://tedbeer.net/demo3d/