public static int userSwitchPokemon()
	{
		int temp=0;
		b1.cursorLock=false;

		System.out.println("User Initiated Pokemon Switch");
		b1.updateUserPoke(user);
		b1.menuSetting = BattleWindow.MenuSetting.SWITCH;
		for(int i=0; i<userNumOfPokemon; i++)
		{
			if(i!=userIndex)
				System.out.println(""+i+": "+user[i].toHPOnlyString());
		}

		do
		{
			System.out.print("Switch to:");
			while (!superDuperBoolean)
			{	try
				{
					Thread.sleep(15);
				}
				catch(Exception ignored)
				{

				}
			}
			superDuperBoolean = false;
			if (userCmd == -1&&Mechanics.isAlive(user[userIndex].health))
			{
				System.out.println("Cancelling switch...");
				switchCancel = true;
				userCmd=4;
				switchPkmn.play();
				temp = userCmd;
				return userIndex;
			}
			else if(userCmd==-1)
			{
				temp=userIndex;
			}
			else
			{
				switchPkmn.play();
				temp = userCmd;
			}
		}
		while(!Mechanics.isAlive(user[temp].health));

		//Restores Stages to Neutral
		user[userIndex].atkStage=0;
		user[userIndex].defStage=0;
		user[userIndex].speedStage=0;
		user[userIndex].spclStage=0;
		user[userIndex].evaStage=0;

		user[userIndex].substatus=Pokemon.Substatus.OK;
		Mechanics.hasSubstitute[0]=false;
		Mechanics.substituteHealth[0]=0;

		//Unlocks move for user
		userLockedMove=-1;
		Mechanics.charging[0]=false;
		Mechanics.awayFromBattle[0]=false;
		Mechanics.turnsDisabled[0]=0;
		Mechanics.moveDisabled[0]=-1;
		Mechanics.turnsMultiTurn[0]=0;

		Mechanics.turnsMultiTurn[1]=0;

		//Restores enemy move ONLY if the user has fainted
		if(userFainted)
		{
			Mechanics.charging[1]=false;
			if(enemy[enemyIndex].move[enemyCmd]!=Pokemon.Move.RAGE)
			enemyLockedMove=-1;
		}
		userCmd = 0;
		dudeCancel = true;

		nonPostingCase[0]=false;
		userFainted=false;

		Mechanics.participatedInBattle[temp]=true;
		b1.stopFlicker(0);
		b1.cursorLock=true;
		return temp;

	}