Changing the order of Javascript elements