Extensive use of JavaScript - 1 single file capable of showing 3 different functionality