Switched javascript code around