

/* Site Focus text */
// Javascript by Robert Smith, Copyright (C) Robert Smith 2006

var news = new Array();
var newsO = new Array();
var txt = new Array();

var newsitems = 0;
var spacers = 120;  // size of each news item
var scrollin = 1;
var scrollincount = 0;
var scrollinMAX = 140;
var slowspeed = 40;
var pagebottom = 0;
var called = 0;


// When a news item is clicked
function navigateto(number)
{
	window.parent.location=txt[number][2];
}

// Adds a news item to the page
function addn(titlegif,linktext,linkto)
{
	// the border, so it can be moved
	document.write("<table width=131 height="+spacers+" ID=\"news"+newsitems+"\" style=\"position: relative; left: 600\" border=0 cellspacing=0 cellpadding=0><tr><td valign=top height=100%>");

	// has it got a title gif?
	if (titlegif!="") document.write("<p><img src=\"images-common/" + titlegif + "\" width=131 height=19</p>");

	// the actual news element
	document.write("<p>");
	document.write("<a href=\"#_top\" class=\"right-article\" onmouseover=\"return mouseoverfunc("+newsitems+")\" onmouseout=\"return mouseoutfunc()\" onclick=\"return navigateto("+newsitems+")\">");
	document.write(linktext);
	document.write("</a></p>");

	// End of table
	document.write("</td></tr></table>");

	// store values for later (at present txt[newsitems][0] is not used once added)
	txt[newsitems] = new Array(3)
	txt[newsitems][0] = titlegif;
	txt[newsitems][1] = linktext;
	txt[newsitems][2] = linkto;

	// set the verticle position
	news[newsitems] = spacers * newsitems;
	newsO[newsitems] = 0;
	newsitems++;
}

// when a news item has the mouse over it
function mouseoverfunc(number)
{
	window.status = "Site Focus: "+txt[number][1];
	return true;
}

// When the mouse moves off a news item
function mouseoutfunc()
{
	window.status = "Welcome to winOKE - Karaoke Software for Windows Made Easy!";
	return true;
}


// actually move them!
function movethem()
{	var delay = slowspeed;
	for (var a=0; a<newsitems; a++) //>
	{
		if (newsO[a]==news[a])  // at the top of the screen? Pause
			delay = 2000;
		if (newsO[a]>news[a]+spacers)  // off the top of the screen?
			newsO[a] = (-PageBottom) + news[a];
		newsO[a]+=2;
	}
	return delay;
}

function mainloop()
{
	var a=0;
	PageBottom = spacers * (newsitems-1);
	var delay = slowspeed; 
	var d=-1;
	var f;
	if (scrollin==1) scrollincount+=4;
	for (a=0; a<newsitems; a++) 
	{
		f = document.getElementById('news'+a);
		f.style.top=-newsO[a];
		if (scrollin==1)
			f.style.left=8+((scrollinMAX-scrollincount)*d);
		d=-d;
	}
	if (scrollin==1)
	{
		if (scrollincount==scrollinMAX) scrollin=0;
		if (scrollincount>scrollinMAX) scrollincount=scrollinMAX;
	} else delay=movethem();
	setTimeout("mainloop();",delay);
}


function onloadfunc()
{
	if (called==0)
	{
		mouseoutfunc();
		mainloop();
		window.parent.document.all.INFRAME.style.visibility = "visible";
		called = 1;
	}	
}


