var wmp;

function wmpInit(server)
{
	if (navigator.platform=="Win32"){
		try {
			!!server && (url += '&server=' + server);
			wmp = new MediaPlayer(url);
			wmp.stop();
		} catch (e) {}
		try {
			UpdateSong("PlayingSongContainer");
		} catch (e) {}
		try {
			wmp.bindPlayButton(document.getElementById('playbutton'));
			wmp.bindStopButton(document.getElementById('stopbutton'));
			wmp.bindVolumeSlider(document.getElementById('volumeslider'), 109, 1, 109);
			wmp.bindStatusBar(document.getElementById('volumetext'));
			wmp.bindVolumeBar(document.getElementById('volumelevel'));
		} catch (e) {}
		
		try {
			if (window.attachEvent) {
				window.attachEvent('onunload', wmpFinish);
			} else {
				document.body.onunload = wmpFinish;
			}
		} catch (e) {}
	}
}
function wmpFinish()
{
	try {
		wmp.stop();
	} catch (e) {}
}

function wmpStart()
{
	try {
		wmp.play();
	} catch (e) {}
}

function switchServer(selectElement)
{
	if ('0' === selectElement.value) {
		wmp.setUrl(url);
	} else {
		wmp.setUrl(url + '&server=' + selectElement.value);
	}
}


