<!--
//	Real Control Script Created by cailiqiang
//	Created:2005-10-20
var g_lStatusInterval = 0;
var g_sForTb = true;
var g_sPostion = 0;
var isSeek = "";

function fnMonitorStatus()
{
	var g_Hpos=0 ;	
	g_Hpos=Math.round(objWMP.GetPosition()/1000)	
	if ((3 == objWMP.GetPlayState()) && (g_Hpos > 0))
	{	
		
		var j = 0;
		while ( j < gaDemo.length)
		{			
			if (j!=g_sPostion && g_sForTb == true)
			{				
				if ( g_Hpos > fnConvertToSeconds(gaDemo[j][0]) && g_Hpos < fnConvertToSeconds(gaDemo[j][1])  )
				{						
					doInlineDemo(gaDemo[j][2]);
					g_sPostion=j;		
					break;					
				}
			}
			j++;
		}
		
	}	
}

function fnConvertToSeconds(sTime) 
{
	var asTemp = sTime.split(":");
	var lTemp = 0;
	lTemp = parseInt((asTemp[0] * 3600), 10) + parseInt((asTemp[1] * 60), 10) + parseInt(asTemp[2], 10);
	return(lTemp);
}

//********************************************
//*** 讲义同步处理 **********************************
//********************************************
function toDocument()
{		
	var strPath = documentControl.src;
	var iWhack = strPath.lastIndexOf("rk_document2")	
	if (g_sForTb==false || parseInt(iWhack)>0)	
	{
		documentControl.src = "../images/rk_document1.gif";
		documentControl.alt = "全部讲义";
		documentControl.title = "全部讲义";
		g_sForTb = true;
		g_sPostion = -1;
		g_lStatusInterval=window.setInterval("fnMonitorStatus()", 1000);
		//gotopage();
	}
	else
	{ 
		documentControl.src = "../images/rk_document2.gif";
		documentControl.alt = "讲义同步";
		documentControl.title = "讲义同步";
		g_sForTb = false;
		g_sPostion = -1;
		window.clearInterval(g_lStatusInterval);
		window.open(g_sAllJy,"matter");
		//alert("Fal");
	}	
}
//</function>

//---------------------------------------------
//-----单次检测运行当前显示页面情况----------------
function gotopage()
{
	var g_Hpos=0 ;	
	g_Hpos=Math.round(objWMP.GetPosition()/1000)
		alert(g_Hpos);
	if (g_Hpos > 0)
	{	
		var j = 0;
		while ( j < gaDemo.length)
		{			
			if ( g_Hpos > fnConvertToSeconds(gaDemo[j][0]) && g_Hpos < fnConvertToSeconds(gaDemo[j][1])  )
			{						
				doInlineDemo(gaDemo[j][2]);
				g_sPostion=j;		
				break;					
			}			
			j++;
		}		
	}	
}

//<function>
// <summary>Launches the inline demos</summary>
function doInlineDemo(sLivePath)
{	
	return(window.open(sLivePath,"matter"));
	
}
//</function>


//********************************************
//*** SeekTime Demo *******************************
//********************************************

function seekTime(sTimeTarget)
{
	var sSeekTarget = fnConvertToSeconds(sTimeTarget);
	//objWMP.CurrentPosition = sSeekTarget;
	objWMP.SetPosition(sSeekTarget*1000);
	if (3 != objWMP.GetPlayState())
	{		
		objWMP.DoPlay();
	}	
}
//</function>


function PageChange(ExeType,MediaState)
{	
try
	{				
	g_lStatusInterval=window.setInterval("fnMonitorStatus()", 1000);
	objWMP.SetVolume(100);
	}
	catch(e)
	{}
objWMP.SetEnableContextMenu(false);
objWMP.SetWantErrors(true);
}
