Toggle between two functions (js)