var vItems = new Array();
var selectItem = 0;

function AddItem(id,title,image,content)
{
	//CREATE NEW FeedItem
	var x = new FeedItem();
	x.title = title;
	x.image = image;
	x.description = content;

	//ADD TO ITEM COLLECTION
	vItems[id] = x;
}

function FeedItem()
{
	this.title;
	this.description;
	this.image;
}

function LoadFV()
{

	//CREATE SOME ITEMS
	AddItem(0,"Total Shots","image1.jpg","Displays a graphical display of your total shots.");
	AddItem(1,"Basic Stats","image2.jpg","Records your birdies, pars, bogeys and worse. Calculates overall averages.");
	AddItem(2,"Advanced Stats","image3.jpg","Records G.I.R, F.I.R, Puts, all in  value/percentages.");
	AddItem(3,"Total Puts","image4.jpg","Line graph of your total puts from the last 10 rounds.");
	AddItem(4,"Bar Chart Example","image5.jpg","Bar chart representation of your avg puts per hole on a specific course.");
	AddItem(5,"G.I.R","image6.jpg","How good are you shots into the green?");
	AddItem(6,"F.I.R","image7.jpg","Are you a sound driver off the tee?");
	AddItem(7,"Stats By Course","image8.jpg","View stats on a course basis.");

    //CREATE THE BOX LINKS IN FOOTER
    var box = "";
    var i = 0;
    var o = 7;
    while(i!=vItems.length)
    {
        box+="<div id=\"l" + o + "\" class=\"boxes\" onmouseover=\"Javascript:Jump(" + o + ");\" onmouseleave=\"Javascript:JumpOut(" + o + ");\">" + o + "</div>";
        i++;
        o--;
    }
    //alert(box);
    document.getElementById("FVfooter").innerHTML = box;
	//OUTPUT DATA
	selectItem = 0;
	Round();
}

function DisplayNextImage(value)
{
	//OUTPUT DATA - FIRST SET THE ORIGINAL BOX LINK BG BACK TO WHITE
	if(selectItem!=0)
	{
		var c = selectItem - 1;
		//document.getElementById('l' + c).style.background = "white";
		document.getElementById('l' + c).style.color = "#565656";
	}
	else if(selectItem==0)
	{
		//document.getElementById('l7').style.background = "white";
		document.getElementById('l7').style.color = "#565656";
	}
	//CHANGE IMAGE + TEXT		
	document.getElementById('textHolder').innerHTML = "<b><u>" + vItems[selectItem].title + "</u></b><br/>" + vItems[selectItem].description;
	$("#imageHolder").fadeIn("slow");
	document.getElementById('imageHolder').innerHTML = "<img src=\"/images/" + vItems[selectItem].image + "\" />";
	//document.getElementById('l' + selectItem).style.background = "orange";
	document.getElementById('l' + selectItem).style.color = "#fe5815";
	selectItem++;
}

function Round()
{

	if(selectItem==8)
	{
		//RESET BACK TO 0
		selectItem = 0;
	}
	$("#imageHolder").fadeOut("fast");
	$("#imageHolder").css("display", "none");
	DisplayNextImage(selectItem);	
	//LOOP AGAIN
	t=setTimeout("Round()",5000)
}

function Jump(value)
{
	document.getElementById('textHolder').innerHTML = "<b><u>" + vItems[value].title + "</u></b><br/>" + vItems[value].description;
	document.getElementById('imageHolder').innerHTML = "<img src=\"/images/" + vItems[value].image + "\" />";
	//document.getElementById('l' + value).style.background = "orange";
	document.getElementById('l' + value).style.color = "#fe5815";
}
function JumpOut(value)
{
if(value!=selectItem)
{
	//document.getElementById('l' + value).style.background = "white";
	document.getElementById('l' + value).style.color = "#565656";
}
}
