var item;
var lpos=-1;
var iSlide, iMsg;
var count=0;
function onInit()
{
	if (document.RAOCX==null||document.frm==null||document.frm.src==null||document.frm.src.value=="")
		return;

	document.RAOCX.SetSource(document.frm.src.value);
	document.RAOCX.DoPlay();

	if (window.navigator.userAgent.indexOf('MSIE')>0)
	{
		msg.innerText = "Loading";

		if (document.RAOCX.GetPlayState()<3)
			iMsg = window.setInterval("waitMsg()", 150, "JAVASCRIPT");
		else if (a.length>0)
			msg.innerText = "Click on a line to start/restart from that line\nClick anywhere else to Pause/Play";
		else
			msg.innerText = "Click anywhere to Pause/Play";
	}
//	var a = window.location.toString().split("?");
//	if (a.length>1)
//		a = a[1].split("="); 
//	alert(a[0]);
}

function onClose()
{
	if (document.RAOCX==null||document.RAOCX.WindowName==null)
		return;
	document.RAOCX.DoStop();
}

function lineBlur(obj)
{
	obj.style.color="#400080";
	obj.className="clsLyric";
}

function lineShine(obj)
{
	obj.style.color="red";
	obj.className="clsLyricHi";
}

function bodyClick()
{
	var id = window.event.srcElement.id;
	if (!id)
		document.RAOCX.DoPlayPause();
//	if (window.confirm(p=document.RAOCX.GetPosition()))
//		Root.innerText += ","+p;
}

if (window.navigator.userAgent.indexOf('MSIE')>0)
	document.onclick = bodyClick;

function msgSlide()
{  
	col = Math.random()*0xffffff;
	item.style.color = col;
	item.style.backgroundColor = col^0xffffff;
}

function lineClick()
{
	var id = window.event.srcElement.id;
	var i = id.substr(1);
	if (window.event.altKey)
	{
		if (window.confirm(p=document.RAOCX.GetPosition()))
		{
			Root.innerText += ","+p;
			Line.innerText += ","+i;
			return;
		}
	}
	if (document.all["RAOCX"].CanPlay())
		document.all["RAOCX"].DoPlay();

	for (j=lpos+1; j<l.length; j++)
		if (l[j]==i)
			break;
	if (j==l.length)
		for (j=0; j<lpos; j++)
			if (l[j]==i)
				break;
	document.RAOCX.SetPosition(a[j-1]);
}

function waitMsg()
{
	if (document.RAOCX.GetPlayState()<3)
	{
		count++;
		if (count==10)
		{
			count=0;
			msg.innerText = "Loading";
		}
		else
			msg.innerText += ".";
	}
	else
	{
		window.clearInterval(iMsg);
		if (a.length>0)
			msg.innerText = "Click on a line to start/restart from that line\nClick anywhere else to Pause/Play";
		else
			msg.innerText = "Click anywhere to Pause/Play";
	}
}



