Fix some bugs

When enter 0, replaced by number '1'
(emualation of vertical / horizontal scan mode)
These 2 modes might be added as other mode,
i.e., users select vertical, horizontal or 2D mode
Minor change; mouseover color is changed

Mouseover color changed RED, instead of blue
Separate javascript from haml template

javascripts must be put in public/javascripts
next TODO:table should be saved(cached)
save temporary in tmp/ directory?
minor change:delete debug line