function playRadio(url) {
	playerCmd = "play";
	stopRadio();
	addPlayerEvent();
	switch (pluginType) {
	case "wmp":
		player.URL = url;
		player.controls.play();
		break;
	case "qt":
		alert(player);
		player.SetURL(url);
		player.Play();
		break;
	case "vlc":
		player.playlist.clear();
		player.playlist.add(url);
		player.playlist.play();
		break;
	}
}

function resumeRadio() {
	playerCmd = "play";
	addPlayerEvent();
	switch (pluginType) {
	case "wmp":
		player.controls.play();
		break;
	case "qt":
		player.Play();
		break;
	case "vlc":
		player.playlist.togglePause();
		break;
	}
}

function pauseRadio() {
	playerCmd = "pause";
	addPlayerEvent();
	switch (pluginType) {
	case "wmp":
		player.controls.pause();
		break;
	case "qt":
		player.Pause();
		break;
	case "vlc":
		player.playlist.pause();
		break;
	}
}

function stopRadio() {
	playerCmd = "stop";
	addPlayerEvent();
	switch (pluginType) {
	case "wmp":
		player.controls.stop();
		break;
	case "qt":
		player.Stop();
		break;
	case "vlc":
		player.playlist.stop();
		break;
	}
}

function muteVolume() {
	switch (pluginType) {
	case "wmp":
		player.settings.mute = !player.settings.mute;
		mute = player.settings.mute;
		break;
	case "qt":
		player.SetMute(!player.GetMute());
		mute = player.GetMute();
		break;
	case "vlc":
		player.audio.mute = !player.audio.mute;
		mute = player.audio.mute;
		break;
	}
	appSite.setVolume(mute, volume);
}

function upVolume() {
	if (volume <= 90) {
		mute = false;
		volume += 10;
		switch (pluginType) {
		case "wmp":
		case "wmpff":
			player.settings.mute = mute;
			player.settings.volume = volume
			break;
		case "qt":
			player.SetVolume(25 * volume / 10);
			break;
		case "vlc":
			player.audio.mute = mute;
			player.audio.volume = volume;
			break;
		}
		appSite.setVolume(mute, volume);
	}
}

function downVolume() {
	if (volume > 0) {
		mute = false;
		volume -= 10;
		switch (pluginType) {
		case "wmp":
		case "wmpff":
			player.settings.mute = mute;
			player.settings.volume = volume;
			break;
		case "qt":
			player.SetVolume(25 * volume / 10);
			break;
		case "vlc":
			player.audio.mute = mute;
			player.audio.volume = volume;
			break;
		}
		appSite.setVolume(mute, volume);
	}
}

var oldStatus = "";

function getPlayerStatus() {
	var aPlayerState = new Array('Stopped', 'Connecting', 'Buffering',
			'Playing', 'Paused', 'Waiting', 'Error', 'Error');
	switch (pluginType) {
	case "wmp":
		var aSwitchPlayerState = new Array(6, 0, 4, 3, 6, 6, 2, 1, 6, 1, 6, 6,
				6, 6); // ('', 'Stopped', 'Paused', 'Playing', '', '',
						// 'Buffering', 'Connecting', '', 'Connecting');
		playerState = aSwitchPlayerState[player.playState];
		if(playerState == 6 || playerState == 7)
			playerStatus = player.playState;
		else
			playerStatus = aPlayerState[playerState];
		if (playerState == 1 || playerState == 5)
			player.controls.play();
		break;
	case "qt":
		switch (player.GetPluginStatus()) {
		case 'Complete':
			playerState = 3;
			playerStatus = 'Playing';
			break;
		case 'Waiting':
			playerState = 0;
			playerStatus = 'Connecting';
			break;
		case 'Playable':
			playerState = 0;
			playerStatus = 'Buffering';
			break;
		case 'Loading':
			playerState = 0;
			playerStatus = 'Buffering';
			break;
		default :
			playerState = 6;
			playerStatus = player.GetPluginStatus();
			break;
		}
		if (playerCmd == 'pause') {
			playerStatus = 'Paused';
			playerState = 4;
		}
		/*
		 * alert(player.PlayState); var aSwitchPlayerState = new Array(0, 4, 3,
		 * 5); //http://msdn.microsoft.com/en-us/ms869714.aspx playerState =
		 * aSwitchPlayerState[player.PlayState]; playerStatus =
		 * aPlayerState[playerState];
		 */
		break;
	case "vlc":
		playerState = player.input.state;
		playerStatus = aPlayerState[playerState];
		break;
	}
	appSite.getCodePlayer(playerStatus, playerState, mute, volume);
	if ((playerState == 3 && playerCmd == 'play') || (playerState == 0 && playerCmd == 'stop') || (playerState == 4 && playerCmd == 'pause')
			|| playerState == 6 || playerState == 7) {
		removePlayerEvent();
	}
//	if(playerState == 6 || playerState == 7)
//	{
//		addPlugIn();
//	}
}

function addPlayerEvent() {
	idInterval = setInterval("getPlayerStatus()", 100);
}

function removePlayerEvent()
{
	clearInterval(idInterval);
}