In-game. Click the green flag for appropiate layering, in case it is not appropiate.
If the Cooldown variable didn't exist, you would constantly switch between portals rapidly, however, this stops that. Feel free to use this in your game, but make sure to give credit! Portal images were made with Paint.NET