Some still ugly JS code for main page form