A lot of fix, now works
First version of javascript part of settings