Tidied up hide/show elements JS into functions