This whole file would be easier to read and understand if jQuery was used for the interactions and stuff.