var tips = ['Thomson Reuters Newsmaker with UK Conservative Party leader David Cameron - Watch the webcast',
			'Latest Innovations in Portfolio Risk Management - podcasts now available',
			'Thomson Reuters is named a top 50 Global Brand'];
var hrefs = ['http://uk.reuters.com/news/globalcoverage/cameronNewsmaker',
			 '/productinfo/risk/events/latestInnovations.aspx',
			 'http://www.thomsonreuters.com/about/'];						
var targets = ['_blank',
			   '_blank',
			   '_self'];						
			
var currentTipIndex = Math.round(Math.random() * (tips.length-1)); 
var intervalId;
var objNext = document.getElementById('TipNext');
var objPrevious = document.getElementById('TipPrevious');
							
function startTimer()
{
	var interval = 6000;							
	intervalId = window.setInterval("writeNextTip()", interval);								
}			

function writeTip()							
{
	var tipLink = document.getElementById("tipLink");	
	
	tipLink.setAttribute("href", hrefs [currentTipIndex]);
	tipLink.setAttribute("target", targets [currentTipIndex]);
	tipLink.childNodes[0].nodeValue = tips [currentTipIndex];			
}
							
function writeNextTip()
{
	window.clearInterval(intervalId);
	currentTipIndex = (currentTipIndex+1) == tips.length ? 0 : currentTipIndex+1;
	writeTip();
	startTimer();
}				

function writePreviousTip()
{
	window.clearInterval(intervalId);
	currentTipIndex = currentTipIndex == 0 ? tips.length-1 : currentTipIndex-1;
	writeTip();
	startTimer();
}
								
function initTips()
{
	writeTip();
	startTimer();
}
	
function tiphover(tipbutton)
{							
	if(tipbutton.src.indexOf("/productinfo/financial/images/arrow_white_on_blue_right.gif") > 0)
		tipbutton.src = tipbutton.src.replace("/productinfo/financial/images/arrow_white_on_blue_right.gif", "/productinfo/financial/images/arrow_white_on_blue_right2.gif");

	else if(tipbutton.src.indexOf("/productinfo/financial/images/arrow_white_on_blue_right2.gif") > 0)
		tipbutton.src = tipbutton.src.replace("/productinfo/financial/images/arrow_white_on_blue_right2.gif", "/productinfo/financial/images/arrow_white_on_blue_right.gif");
		
	else if(tipbutton.src.indexOf("/productinfo/financial/images/arrow_white_on_blue_left.gif") > 0)
		tipbutton.src = tipbutton.src.replace("/productinfo/financial/images/arrow_white_on_blue_left.gif", "/productinfo/financial/images/arrow_white_on_blue_left2.gif");
	else
		tipbutton.src = tipbutton.src.replace("/productinfo/financial/images/arrow_white_on_blue_left2.gif", "/productinfo/financial/images/arrow_white_on_blue_left.gif");
				
}						
