var nt=new Object;
nt.link=new Array();
nt.text=new Array();
nt.title=new Array();

nt.link[0]="http://resourceinvestingnews.com/30776-bgs-supply-risk-list-why-platinum-is-on-it.html";
nt.text[0]="BGS Supply Risk List: Why Platinum Is On It (Resource Investing News)";
nt.title[0]="View article at Resource Investing News";
nt.link[1]="http://www.independent.ie/national-news/shock-after-quake-strikes-with-more-tremors-predicted-3001813.html";
nt.text[1]="Shock after quake strikes ... with more tremors predicted (Independent.ie)";
nt.title[1]="View article at Independent.ie";
nt.link[2]="http://www.newscientist.com/article/mg21328493.900-frack-responsibly-and-risks--and-quakes--are-small.html";
nt.text[2]="Frack responsibly and risks - and quakes - are small (New Scientist)";
nt.title[2]="View article at New Scientist";
nt.link[3]="http://www.irishexaminer.com/breakingnews/ireland/minor-earthquake-recorded-in-donegal-537345.html";
nt.text[3]="Minor earthquake recorded in Donegal (Irish Examiner)";
nt.title[3]="View article at Irish Examiner";
nt.link[4]="http://leapingintosuds.eventbrite.co.uk/?ebtv=F";
nt.text[4]="SOLD OUT Leaping into Sustainable Drainage Systems (SuDS) (Eventbrite)";
nt.title[4]="View article at Eventbrite";
nt.link[5]="http://geovertical.co.uk/2012/01/24/the-church-inside-the-volcano/";
nt.text[5]="The church inside the volcano (Geovertical blog)";
nt.title[5]="View article at Geovertical blog";
nt.link[6]="http://www.guardian.co.uk/travel/shortcuts/2012/jan/24/seeing-northern-lights-in-britain";
nt.text[6]="Is there still a chance of seeing the northern lights in Britain? (Guardian)";
nt.title[6]="View article at Guardian";
nt.link[7]="http://www.telegraph.co.uk/finance/commodities/9023223/Potash-developer-Sirius-signs-up-Lord-Hutton-to-board.html";
nt.text[7]="Potash developer Sirius signs up Lord Hutton to board (Telegraph)";
nt.title[7]="View article at Telegraph";
nt.link[8]="http://www.telegraph.co.uk/science/science-news/9019598/British-scientists-find-lost-Charles-Darwin-fossils.html";
nt.text[8]="British scientists find 'lost' Charles Darwin fossils (Telegraph)";
nt.title[8]="View article at Telegraph";
nt.link[9]="http://www.dailymail.co.uk/sciencetech/article-2087622/Darwins-lost-fossils-Treasure-trove-chance-dusty-cabinet.html";
nt.text[9]="Darwin's lost fossils: Treasures that helped shape theory of evolution found by chance in dusty cabinet (Daily Mail)";
nt.title[9]="View article at Daily Mail";


nt.ix=0;
nt.item=0;
nt.id=0;
nt.fps=12;
nt.speed=1000/nt.fps;

function startTicker(){
	nt.id=setInterval('runTicker()',nt.speed);
	}
	
function runTicker(){
	var ntRef=document.getElementById('newsTicker');
	var ntlRef=document.getElementById('newsTickerLink');
	var htmlStr='';
	var currentItem='';
	var currentlink='';
	var currentTitle='';
	
	if(nt.link.length <= nt.item){
		// run out of items - start again at the beginning
		nt.item=0;
		ntRef.innerHTML='';
		ntlRef.href=nt.link[0];
		ntlRef.title=nt.title[0];
		}
	else{
		
		currentItem=nt.text[nt.item] + '          ';
		currentlink=nt.link[nt.item];
		currentTitle=nt.title[nt.item];
				
		if(nt.ix <= currentItem.length){
			// still got some text to output
			htmlStr=currentItem.substring(0,nt.ix);
			ntRef.innerHTML=htmlStr;
			ntlRef.href=currentlink;
			ntlRef.title=currentTitle;
			nt.ix+=1;
			}
		else{
			// reached end of current link
			ntRef.innerHTML=currentItem;
			ntlRef.href=currentlink;
			ntlRef.title=currentTitle;
			nt.ix=0;
			nt.item+=1;
			}
		}
	}
	
function pauseTicker(){
	var ntRef=document.getElementById('newsTicker');
	var ntlRef=document.getElementById('newsTickerLink');
	var currentItem=nt.text[nt.item] + '          ';
	var currentlink=nt.link[nt.item];	
	clearInterval(nt.id);
	ntRef.innerHTML=currentItem;
	ntlRef.href=currentlink;
	}
	
function continueTicker(){
	startTicker();
	}
	


