// JavaScript Document
function CurrentTime() {
	time = new Date();
	return time.getTime();
}

function GetKBPS(ST)
{
	ET		= CurrentTime();
	DT = ((ET - ST)/1000);
	DataSize = 50; // 50kb

	kbps1    = (DataSize/DT);
	kbpsA    = ((kbps1*8)*10*1.02);
	kbps     = (Math.round(kbpsA)/10);

	if ( kbps < 150 )
	{
		band = "low";
	}
	else
	{
		band = "high";
	}

	SetBW(band,0);
}

function SetBW( bandw, doThePlay )
{
	band = bandw;

	if ( band == "low" )
	{
		document.getElementById("modemlink").style.fontWeight = "bold";
		document.getElementById("breitbandlink").style.fontWeight = "normal";
		document.getElementById("mediaplayer").FileName = proxiUrlLow;
		document.getElementById("mediaplayer").width = "191";
		document.getElementById("mediaplayer").height = "196";
		//ivturl = ivturlLow;
	}
	if ( band == "high" )
	{   
		document.getElementById("modemlink").style.fontWeight = "normal";
		document.getElementById("breitbandlink").style.fontWeight = "bold";
		document.getElementById("mediaplayer").FileName = proxiUrlHigh;
		document.getElementById("mediaplayer").width = "384";
		document.getElementById("mediaplayer").height = "341";
		//ivturl = ivturlHigh;
	}

	if ( doThePlay == 1 )
	{   
		document.getElementById("mediaplayer").AutoStart = "True";
	}
}

function anim()
{
	if ( document.getElementById('mediaplayer').playState == 2 )
	{
		document.getElementById('loadinganimation').style.top = "-1000px";
		document.getElementById('loadinganimation').style.left = "-1000px";
		document.getElementById('playanimation').style.top = "-1000px";
		document.getElementById('playanimation').style.left = "-1000px";
		
		if ( band == "low" )
		{
			document.getElementById('player').style.top = "141px";
			document.getElementById('player').style.left = "130px";
		}
		else
		{
			document.getElementById('player').style.top = "69px";
			document.getElementById('player').style.left = "34px";
		}
	}
	if ( document.getElementById('mediaplayer').playState == 3 )
	{
		document.getElementById('player').style.top = "-1000px";
		document.getElementById('player').style.left = "-1000px";
		document.getElementById('playanimation').style.top = "-1000px";
		document.getElementById('playanimation').style.left = "-1000px";
		document.getElementById('loadinganimation').style.top = "69px";
		document.getElementById('loadinganimation').style.left = "34px";
	}
	if ( document.getElementById('mediaplayer').playState == 0 )
	{
		document.getElementById('player').style.top = "-1000px";
		document.getElementById('player').style.left = "-1000px";
		document.getElementById('loadinganimation').style.top = "-1000px";
		document.getElementById('loadinganimation').style.left = "-1000px";
		document.getElementById('playanimation').style.top = "69px";
		document.getElementById('playanimation').style.left = "34px";
	}

setTimeout("anim()", 100);
}
