﻿//SETTINGS
var pos;
var tickerSpeed=100;
var tickerDivID="ticker";
var wordPause=2000;
var usp=0;
var monthlyRate=(30*24*60*60*1000)/750;
	monthlyRate.toFixed(0);
var startDate=1267365493000;
var tickerDate = new Date();
	tickerDate=Date.parse(tickerDate);
		//console.log(tickerDate);
var milisecondsSinceStart=tickerDate-startDate;
var	trainCount=19000+(milisecondsSinceStart/monthlyRate);	//equivalent to 750 students per month
	trainCount=trainCount.toFixed(0);
var uspArr = new Array();
	uspArr[0]="Over "+trainCount+" students successfully trained this year.";
	uspArr[1]="City & Guilds approved centres across the UK.";
	uspArr[2]="If unsuccessful in ‘Life in the UK’ test, then this is your alternative.";
	uspArr[3]="Official tracker in place to assist learners in their applications.";
	uspArr[4]="Pay only Once: no re-take fees and we train you until you pass.";
	uspArr[5]="For Immigration purposes we have liaisons with Checking Services & Immigration Experts who are OISC registered.";
	uspArr[6]="Language Support available through our friendly staff who speak Punjabi, Hindi, Gujarati, Pushto among other languages.";
//END SETTINGS

function returnNextChar(str)
	{
		//str="Over 11000 students successfully trained this year."
		if(pos>str.length)
			{
				pos=0;
				return "next";
			}
		else if(isNaN(pos) || pos=="")
			{
				pos=0
			} 

		pos++;
		return str.substring(0,pos);
		
			
	}
function incrementUSP()
	{
		alert("USP="+usp);
		usp++;
		alert("USP="+usp);
	}
function ticker(usp)
	{
		if(isNaN(usp) || usp>6)
			{
				usp=0;
			}
		var tickerDiv=document.getElementById(tickerDivID);
		var tick=returnNextChar(uspArr[usp]);
		var pause;
		if(tick=="next")
			{
				usp++;
				pause=wordPause;
				//var s=setTimeout("incrementUSP();",wordPause);
			}
		else
			{
				tickerDiv.innerHTML="<b>&#187;</b>&nbsp;"+tick;
				pause=tickerSpeed;
			}
		var t=setTimeout("ticker("+usp+")",pause);
	}