
<!--
m=4;
//movestep=10;movetime=5;movestop=true;movestart=false;curmenu=-1;leftshow=false;rightshow=false;bothstar=false;var moveobj;var nnnn;
//moveon=false;movelen=165;timesnum=100;rmstart=false;rm_tollen=0;timelen=0;volumlen=48;volon=false;ChangeSizeRate=1;balance=0
movestep=10;
movetime=5;
movestop=true;
movestart=false;
curmenu=-1;
leftshow=false;
rightshow=false;
bothstar=false;
var moveobj;
var nnnn;
moveon=false;
movelen=310;
timesnum=100;rmstart=false;rm_tollen=0;timelen=0;volumlen=42;volon=true;ChangeSizeRate=1;balance=0
document.onmouseup=Total_Up
document.ondragstart=doDragStart
function doDragStart() {event.returnValue=false}

var Living=true
var AutoPlay=true
var IsVidio
var HSFileName=''
var LSFileName=''
var Button_Num=0;
var Real 
Real='document.MPlayer1.controls.'
Real1='document.MPlayer1.settings.'
var CanPlay=true;
var CanStop=false;
var CanPause=false;
var Mute=false;
var CanSetPos=false;
var SetPosStart=false;
var GetLenStart=false
var CanSetVol=true;
var SetVolStart=false
var bigwin=false;
var PlayState=0;//0-无（停止）；1-connecting;2-buffuring;3-playing;4-pause 5,6 forward rewind
var CurrentEntry=1;

function GetBufferPercent()
{
	var rate=MPlayer1.network.bufferingprogress;
	var percent=rate+'%';
	return percent;
}
function ShowTime()
{
	var length;
	length = MPlayer1.currentMedia.durationString;
	var nowtime;
	nowtime = MPlayer1.Controls.currentPositionString;
	face.innerHTML = nowtime;
	ttime.innerHTML = "/"+length;
	if (nowtime=='00:00'){getlen();}
	var tempstatus;
	var current_status;
	tempstatus=MPlayer1.playState;
	switch(tempstatus)
	{
		case 3:
			CanPause=true;
			current_status="正在播放";
			break;
		case 1:
			current_status="停止";
			break;
		case 2:
			current_status="暂停中";
			break;
		case 4:
			current_status="快进";
			break;
		case 5:
			current_status="快退";
			break;
			
		case 8:
			current_status="播放结束";
			break;
		case 6:
			current_status="缓冲:"+GetBufferPercent();						
			break;
		default:
			current_status="正在连接视频服务器";
	}
	currentstatus.innerHTML = current_status;	
	timerID = setTimeout("ShowTime()", 1000);
}
function DoPlay()
{
	eval(Real1+'rate=1.0')
	eval(Real+'Play()');
	//eval(Real+'ShowControls=false')；
}
function DoStop()
{
	eval(Real+'Stop()');
	eval(Real+'CurrentPosition=0');
}
function DoPlayPause()
{
	eval(Real+'Pause()');
}
function SetPosition(Pos)
{
	eval(Real+'CurrentPosition='+Pos);
}
function SetVolume(Pos)
{
	eval(Real1+'Volume=Pos');
}
function SetMute(Status)
{
	if (Status)
		eval(Real1+'Mute=true')
	else
		eval(Real1+'Mute=false');
}
function GetLength()
{
	return MPlayer1.currentMedia.duration;
}
function GetPosition()
{
	tt=eval(Real+'CurrentPosition')
	return tt*1000;
}
function SetSource(srcname)
{
	MPlayer1.URL=srcname;
}
function SetWH(widthpx,heightpx)
{
	eval(Real+'width=widthpx')
	eval(Real+'height=heightpx')
}
function SetFullScreen()
{
	MPlayer1.fullScreen=true;
}
function vols()
{
	if(event.button!=2)
	{
	orix=event.x
	orileft=vblock.style.pixelLeft
	SetVolStart=true
	}
}

function volgo()
{
	if(SetVolStart)
	{
		newx=event.x
		disx=newx-orix
		newleft=orileft+disx
		if(newleft>-1&&newleft<volumlen) vblock.style.left=newleft
	}
}

function setvol()
{
	SetVolStart=false
	newleft=vblock.style.pixelLeft
	newvol=Math.round((newleft/volumlen)*100)
	SetVolume(newvol)
}


function moves()
{
	if(CanSetPos&&event.button!=2)
	{
		DoPlayPause()
		orix=event.x
		orileft=mblock.style.pixelLeft
		if(moveon) clearTimeout(mfollow)
		SetPosStart=true
	}
	else
	return false
}
function fastforward()
{  
	eval(Real+'fastforward()');
	PlayState=5;
}
function fastreverse()
{  
	eval(Real+'fastreverse()');
	PlayState=6;
}
function movego()
{
	if(SetPosStart)
	{
		newx=event.x
		disx=newx-orix
		newleft=orileft+disx
		if(newleft>-1&&newleft<movelen) mblock.style.left=newleft
	}
}

function setpos()
{
	SetPosStart=false
	newleft=mblock.style.pixelLeft
	rcp=Math.round((newleft/movelen)*rm_tollen/1000)
	SetPosition(rcp)
	setTimeout('moveshow()',8000)
	DoPlay()
}

function getlen()
{
	rm_tollen=GetLength()*1000
	//document.timeform.time_all.value=formattime(Math.floor(rm_tollen/1000));
	if(rm_tollen==0) {reget=setTimeout('getlen()',50);GetLenStart=true}
	else 
	{
		CanSetPos=true;
		if(GetLenStart) clearTimeout(reget)
		timelen=Math.floor(rm_tollen/timesnum)
		moveshow()
	}
}

function moveshow()
{
	rm_curpos=GetPosition()
	resttime=rm_tollen-rm_curpos
	if (eval('MPlayer1.'+'playState')==0) {clearTimeout(mfollow);ClickStop()}
	else if(rm_curpos<rm_tollen)
	{
		blockpos=Math.floor((movelen/rm_tollen)*rm_curpos)
		mblock.style.left=blockpos
		moveon=true
		mfollow=setTimeout('moveshow()',1000)
	}
}


function ClickPlay()
{
	if (CanPlay)
	{
		CanPlay=false;
		CanSetPos=true;
		if ((PlayState=5) && (PlayState=6))
		{
		   ClickPause();
		}
		PlayState=1;
		
		if (!CanStop)
		{
			CanStop=true;
		}
		//if(!Mute) SetMute(false)
		setvol();
		DoPlay();
		if(Living) {setTimeout('getlen()',100)}
	}
}
function ClickPause()
{
	if (CanPause)
	{
		CanPause=false;
		CanPlay=true;
		PlayState=4
		CanSetPos=false;
		if(moveon) clearTimeout(mfollow)
		DoPlayPause();
	}
}
function ClickStop()
{
	if (CanStop)
	{
		CanStop=false;
		CanPlay=true;
		CanPause = false;
		PlayState=0
		if (CanPause)
		{
			CanPause=false;
		}
		if(CanSetPos) {CanSetPos=false;}
		if(moveon) clearTimeout(mfollow)
		mblock.style.left=0
		DoStop();
		
	}
}
function ClickSound()
{
	if (Mute)
	{
		Mute=false;
		SetMute(Mute);
	}
	else
	{
		Mute=true;
		SetMute(Mute);
	}		
}
function Total_Up()
{
		if(SetPosStart)
		{
			setpos();
		}
		if(SetVolStart)
		{
			setvol();
		}
}
function formattime(second)
{
	var t_hour,t_minute,t_second,t_temp;
	t_temp=Math.floor(second/60);
	t_second=''+Math.floor(second-t_temp*60);
	if (t_second.length==1) {t_second='0'+t_second}
	t_minute=t_temp;
	t_temp=Math.floor(t_temp/60);
	t_minute=''+(t_minute-t_temp*60);
	if (t_minute.length==1) {t_minute='0'+t_minute}
	t_hour=t_temp;
	return t_hour+':'+t_minute+':'+t_second;
}
function ChangeBalance(newbalance)
{
	if (newbalance==0)
	{
		balance=0;
	}
	else if (newbalance==-100)
	{
		balance=newbalance;
	}
	else if (newbalance==100)
	{
		balance=newbalance;
	}
	eval(Real1+'Balance=balance');
}

function SetSrc(File)
{
	if (CanStop)
		ClickStop();

	SetSource(File);

	if (AutoPlay)	
		ClickPlay();
}
//-->
