var timer,timer1;
var Player="document.MediaPlayer";
var mpPlaying=2;
var CurrentChannel;

function SetStatus(text) {
	StatusBar1.innerHTML=text;
}

function SetChannel(i) {
	CurrentChannel=i;
	s=channels[CurrentChannel].ltitle;
	if (s!="")
	{
		fcontent.splice(0, fcontent.length);
		fcontent=s.split(";");
	}
	SetSource(channels[CurrentChannel].url);
}

function SetSource(srcname) {
	eval(Player).FileName = srcname;
}

function DoPlay() {
	if ((eval(Player).PlayState!=mpPlaying) && (eval(Player).FileName!=''))
		eval(Player).Play();
}

function DoStop() {
	if (eval(Player).PlayState==mpPlaying){
		eval(Player).CurrentPosition = 0;
		eval(Player).Stop();
	}
}

function DoPause() {
	if (eval(Player).PlayState==mpPlaying)
		eval(Player).Pause();
}

function SetVolume(Pos) {
	var l;
	l= eval(Player).Volume + Pos;
	if (l>0) l=0;
	if (l<-5000) l=-5000;
	eval(Player).Volume= l;
}

function VolumeInc() {
	var l;
	l= eval(Player).Volume;
	if (l>=-1000)
		SetVolume(100);
	else if (l>=-2000)
		SetVolume(500);
	else
		SetVolume(1000);
}

function VolumeDec() {
	var l;
	l= eval(Player).Volume;
	if (l>-1000)
		SetVolume(-100);
	else if (l>-2000)
		SetVolume(-500);
	else
		SetVolume(-1000);
}

function ShowBufferProgress()
{
	SetStatus("»º³å´¦Àí: Íê³É "+eval(Player).BufferingProgress+"%");
	if (eval(Player).BufferingProgress==100)
		TimerStop();
}

function ShowLinks()
{
	clearInterval(timer1);
	if (channels[CurrentChannel].ltitle!=""){
		if (fcontent.length>1){
			SetStatus("<div id='fscroller'></div>");
			changecontent();
//  		SetStatus("<marquee behavior=scroll scrollamount=2 scrolldelay=70 onmouseover='this.stop()' onmouseout='this.start()'>"+channels[CurrentChannel].ltitle+"</marquee>");
		}
		else
			SetStatus(fcontent[0]);
	}
//  	SetStatus("<a href='"+channels[CurrentChannel].lurl+"' target='_blank'>"+channels[CurrentChannel].ltitle+"</a>");
}

function TimerStart()
{
	timer= setInterval("ShowBufferProgress()", 500);
	clearInterval(timer1);
}

function TimerStop()
{
	clearInterval(timer);
}

function ShowChannels()
{
	window.open("selectchannel.htm", "", "top=120,left=320,width=300,height=300,scrollbars=yes,resizable=no");
}

