// JavaScript Document

	var theCharacterTimeout = 40;
	var theStoryTimeout     = 2000;
	var theWidgetOne        = "_";
	var theWidgetTwo        = "-";
	var theWidgetNone       = "";
	var theLeadString       = "LATEST :&nbsp;";

	var theSummaries = new Array();
	var theSiteLinks = new Array();

	var theItemCount = 9;
	//max characters for story 140
	
		theSummaries[0] = "Xmas Party 2010 Photos";
		theSiteLinks[0] = "http://www.irlamrangers.com/Photos/IR xmas 2010/xmas2010 index.php";

		theSummaries[1] = "Wicked Street Dancing";
		theSiteLinks[1] = "http://www.irlamrangers.com/Photos/Presvid10.php";

		theSummaries[2] = "BTEC Qualification in Sport - Man United Foundation partnership with Irlam and Cadishead College";
		theSiteLinks[2] = "http://www.icchs.org.uk/downloads/BTEC%20FOOTBALL%20EDUCATION%20ADVERT%20-%20MAN%20UTD%20FOUNDATION.pdf";
		
	    theSummaries[3] = "Click here to find out more about Respect";
		theSiteLinks[3] = "http://www.thefa.com/TheFA/Respect/";
		
		theSummaries[4] = "Respect Guide for Parents";
		theSiteLinks[4] = "http://www.thefa.com/respectguide/";

				
		theSummaries[5] = "Complete a Soccer Star course online";
		theSiteLinks[5] = "http://falearning.thefa.com/docent/bin/docentisapi.dll/lms,thunder,2151/?CMD=LOGIN&file=frameset.jsm";
		theSummaries[6] = "Complete a Soccer Parent course online";
		theSiteLinks[6] ="http://falearning.thefa.com/docent/bin/docentisapi.dll/lms,thunder,2151/?CMD=LOGIN&file=frameset.jsm";		
		
		theSummaries[7] = "Click here to see how to put away a Samba Goal";
		theSiteLinks[7] = "http://www.irlamrangers.com/Photos/Samba Goal.php";
		
		theSummaries[8] = "Under 13's League Champions 2009";
		theSiteLinks[8] = "http://www.irlamrangers.com/Photos/U13 team photo/Under 13 Team Photo index.php";
		

// Ticker startup
function startTicker()
{
	// Define run time values
	theCurrentStory     = -1;
	theCurrentLength    = 0;
	// Locate base objects
	if (document.getElementById) {	
		    theAnchorObject     = document.getElementById("tickerAnchor");
			runTheTicker();   	
		 }
	else {
            document.write("<style>.ticki{display:none;}.ticko{border:0px; padding:0px;}</style>");
            return true;
	}
}


// Ticker main run loop
function runTheTicker()
{
	var myTimeout;  
	// Go for the next story data block
	if(theCurrentLength == 0)
	{
		theCurrentStory++;
		theCurrentStory      = theCurrentStory % theItemCount;
		theStorySummary      = theSummaries[theCurrentStory].replace(/&quot;/g,'"');		
		theTargetLink        = theSiteLinks[theCurrentStory];
		theAnchorObject.href = theTargetLink;
		thePrefix 	     = "<span class=\"tickls\">" + theLeadString + "</span>";
	}
	// Stuff the current ticker text into the anchor
	theAnchorObject.innerHTML = thePrefix + 
	theStorySummary.substring(0,theCurrentLength) + whatWidget();
	// Modify the length for the substring and define the timer
	if(theCurrentLength != theStorySummary.length)
	{
		theCurrentLength++;
		myTimeout = theCharacterTimeout;
	}
	else
	{
		theCurrentLength = 0;
		myTimeout = theStoryTimeout;
	}
	// Call up the next cycle of the ticker
	setTimeout("runTheTicker()", myTimeout);
}


// Widget generator
function whatWidget()
{
	if(theCurrentLength == theStorySummary.length)
	{
		return theWidgetNone;
	}

	if((theCurrentLength % 2) == 1)
	{
		return theWidgetOne;
	}
	else
	{
		return theWidgetTwo;
	}
}
