I haven't read through all the code but he appears to be using the
css display attribute with values of none and block to hide and show repsectively.
If you want to start with them all closed up, then make display: none; the default state for your boxes.