var playButtonState = 'play';
function volumeChange(direction) {
	var currentVol = document.MediaPlayer.GetVolume();
	if(direction == 'up') {
		currentVol = (currentVol * 1) + 25;
		if(currentVol > 255) {
			currentVol = 255;
		}
	}
	if(direction == 'down') {
		currentVol = (currentVol * 1) - 25;
		if(currentVol < 0) {
			currentVol = 0;
		}
	}
	document.MediaPlayer.SetVolume(currentVol);
	document.getElementById('volMeter').style.backgroundPosition = Math.round(((currentVol/255)*45)-45)+'px -3px';
}
function playStop(action) {
	if(action == 'play') {
		document.MediaPlayer.Play();
	}
	if(action == 'stop') {
		document.MediaPlayer.Stop();
	}
}
function qtRewind() {
	document.MediaPlayer.Rewind();
}
function qtStep(amount) {
	document.MediaPlayer.Stop();
	var newTime = document.MediaPlayer.GetTime() + amount;
	document.MediaPlayer.SetTime(newTime);
}
function checkPlay() {
	var currentPlay = document.MediaPlayer.GetRate();
	if(currentPlay == 0 && playButtonState != 'play') {
		document.getElementById('playButton').style.display = 'inline';
		document.getElementById('stopButton').style.display = 'none';
		playButtonState = 'play';
	}
	if(currentPlay > 0 && playButtonState != 'stop') {
		document.getElementById('stopButton').style.display = 'inline';
		document.getElementById('playButton').style.display = 'none';
		playButtonState = 'stop';
	}
}
function startChecking() {
	setInterval(checkPlay, 500);
}