Separate condition blocks and fix indentation

- Indent after `window.onload=function(){`
- Separate `if` clause which is right after `for` clause on the same line