var wcmcTuner = new CustomTuner();

wcmcTuner.PlayerButton = function(w) {
    if (w == "btn1") {	// volume down
	var v = XPlayerGetVolume();
	if (v > 20)
	    v = v - 20;
	else
	    v = v - 10;
	if (v < 0) v = 0;
	    XPlayerSetVolume(v);
	    return true;
    } 

    if (w == "btn2") {	// volume up
	var v = XPlayerGetVolume();
	if (v < 20)
	    v = v + 10;
	else
	    v = v + 20;
	if (v > 100) v = 100;
	    XPlayerSetVolume(v);
	return true;
    }
    
    if (w == "btn3") {	// stop
	XPlayerStop();
	// TODO: should we clear things out?
    }

    if (w == "btn4") {	// play
	XPlayerPlay();
	refreshMetaInfo();
    }
}

wcmcTuner.PlayStateChanged = function(v) {
    var stop = document.getElementById("btn3");
    var play = document.getElementById("btn4");

    if (v) {
	stop.className = "";
	play.className = "playing";
    } else {
	stop.className = "paused";
	play.className = "";
    }
    return true;
}
