var x=-1; //Current index
var msg=new Array(); //Headline items

/*Declare new headline HTML here
 *Make sure to follow the msg[x] format
 *Quote all HTML code*/

msg[0]="<p class=\"bluep\">Welcome to The Nanashi Foundation!</p>";
msg[1]="<p class=\"greenp\">Our website is currently under construction, so several links may not work!  We apologize for the inconvienence!</p>";
msg[2]="<p class=\"yellowp\">The following areas work correctly:  NEWS, FORUMS</p>";
msg[3]="<p class=\"redp\">More areas will be available over time!  Please bear with us!</p>";

function run_headlines() //Main Function
{
	//Initializes headline ticker and automatically iterates through headline list
	
	x++;
	document.getElementById("headlines").innerHTML=msg[x]; //Instantiate the ticker
	//Determine next index
	if(x>=msg.length-1)
	{
		x=-1;
	}
	timeoutID=setTimeout("run_headlines()", 10000); //Delay next recursion
}

//Advance Function
function ticker_skip_forwards()
{
	//To be executed when the user clicks on the right button
	
	clearTimeout(timeoutID);//Clear remaining timer
	run_headlines();//Call main function
}

//Reverse Function
function ticker_skip_backwards()
{
	//To be executed when the user clicks on the left button
	
	clearTimeout(timeoutID);//Clear remaining timer
	//Determine previous index (main function increments, so x=n-2)
	if(x==-1)
	{
		x=msg.length-3;
	}
	else if(x==0)
	{
		x=msg.length-2;
	}
	else
	{
		x-=2;
	}
	run_headlines();//Call main function
}
window.onload=run_headlines;//Start recursion on load