var state;

//初始化
function playerinit()
{	
	player.url="song.pls";
	player.settings.autoStart = false ;
	play();
}

//播放
function play()
{
if (player.controls.isavailable('play'))
{
　player.controls.play();
　state=setInterval("updatetime()",1000);
　playerinfo.innerHTML = "播放";
}
}

//暂停
function pause()
{
if (player.controls.isavailable('pause'))
{
　player.controls.pause();
　clearInterval(state);
　playerinfo.innerHTML = "暂停";
}
}

//停止
function stop()
{
if (player.controls.isavailable('stop'))
{
　player.controls.stop();
　clearInterval(state);
　playerinfo.innerHTML = "停止";
}
}

//前首
function previous()
{
if (player.controls.isavailable( 'previous' ))
{
　player.controls.previous();
　playerinfo.innerHTML = "前一首";
play();
}
}

//后首
function next()
{
if (player.controls.isavailable( 'next' ))
{
　player.controls.next();
　playerinfo.innerHTML = "下一首";
	play();
}
}

//？
function step()
{
if (player.controls.isavailable( 'step' ))
player.controls.step( 1 );
}

//音量-
function voldown()
{
if ( player.settings.volume < 5 )
{
　player.settings.volume = 0;
　playerinfo.innerHTML = "0";
}
else
{
　player.settings.volume -= 5;
　playerinfo.innerHTML = player.settings.volume;
}
}

//音量+
function volup()
{
if ( player.settings.volume > 95 )
{
　player.settings.volume = 100;
　playerinfo.innerHTML = "100";
}
else
{
　player.settings.volume += 5;
　playerinfo.innerHTML = player.settings.volume;
}
}

//静音
function mute()
{
player.settings.mute = !player.settings.mute;
}

//声道
function balance()
{
switch (player.settings.balance)
{
　case 0:
　 player.settings.balance = 100;
　 playerinfo.innerHTML = '左声道';
　 break;
　case 100:
　 player.settings.balance = -100;
　 playerinfo.innerHTML = '右声道';
　 break;
　case -100:
　 player.settings.balance = 0;
　 playerinfo.innerHTML = '全声道';
　 break;
　default :
　 player.settings.balance = 0;
　 playerinfo.innerHTML = '全声道';
　 break;
}
}

//更新时间
function updatetime()
{
playerinfo.innerHTML = player.controls.currentPositionString + " | " + player.currentMedia.durationString;
}