move javascript to its own file
refactor to use class toggle rather than display property
avoid creating functions within a loop