@Override
	public void onSwitch() {
		now = System.currentTimeMillis() + 150;

		// client.postReplay = game.getAppData().getHighScoreReplay(
		// game.level.world);
		// client.start();
		final Data data = new Data();
		data.id = Data.ID.POST;

		Replay replay = game.getAppData().getHighScoreReplay(game.level.world);

		data.replays = new Replay[] { replay };

		loading = true;
		loadingIndex = 0;

		if (updateThread != null) {
			updateThread.interrupt();
		}

		if (client != null) {
			client.addListener(null);
		}

		client = new Client(CaveRace.network);
		client.addListener(this);

		updateThread = new Thread(new Runnable() {
			@Override
			public void run() {
				loadingIndex = 1;
				while (true) {
					try {
						client.send(data);
						break;
					} catch (Exception e) {
						try {
							Thread.sleep(300);
						} catch (InterruptedException e1) {
						}
						e.printStackTrace();
					}
				}
				loadingIndex = 2;

				while (true) {
					try {
						client.getTop();
						break;
					} catch (Exception e) {
						try {
							Thread.sleep(300);
						} catch (InterruptedException e1) {
						}
						e.printStackTrace();
					}
				}

				loading = false;
			}
		});

		updateThread.start();
	}